Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 2.04 KB

geometry-data.md

File metadata and controls

44 lines (30 loc) · 2.04 KB

Geometry data needs to be inserted into the database for place search to work

Use ogr2ogr (in GDAL framework) to convert from ESRI Shapefile to PostGIS. The tool will insert the data.

Example command:

/Library/Frameworks/GDAL.framework/Versions/2.1/Programs/ogr2ogr -f "PostgreSQL" PG:"dbname=napote user=napote host=localhost" ~/suomenkunnat.shp -nln finnish_municipalities -s_srs EPSG:3067 -t_srs "+proj=latlong +datum=WGS84 +axis=neu +wktext"

Options:

  • -f "PostgreSQL" set the output format to postgres insert
  • PG:"database connection" defines the pg connection to use
  • -nln tablename sets the target table name
  • -s_srs source SRS of the Shapefile (like EPSG:3067 for Finnish materials)
  • -t_srs target SRS (WGS84, the +axis=neu flips x/y)

Countries

Finland

Geometry for Finland was generated with QGIS by combining all counties and dissolving them with the vector tool. The resulting area is taken with buffer (0.05 tolerance).

Other countries

ogr2ogr -f "PostgreSQL" PG:"dbname=napote user=napote host=localhost" ne_10m_admin_0_cyprus.geojson -nln country -t_srs "+proj=latlong +datum=WGS84 +axis=enu +wktaext"

  • GeoJSON original country codes did not match ISO3166-1-standard and duplicates have been replaced
  • GeoJSON didn't have finnish or swedish country names, those have been added with a script
  • This was converted into a migration SQL file

Continents