You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pulling the steps from the docker images there it seems these would be the steps
1.) Import the lake geometry into postgresql using imposm
2.) Export the geometry from postgresql into a shape file using pgsql2shp
3.) Calculate the centerlines using label_centerlines
imposm import -connection "$PG_CONNECT" -mapping "$MAPPING_YAML" -overwritecache -cachedir "$IMPOSM3_CACHE_DIR" -read "$FULL_PBF" -dbschema-import="$DB_SCHEMA" -write
query="SELECT osm_id, ST_SimplifyPreserveTopology(geometry, 100) AS geometry FROM osm_lake_polygon WHERE area > 2 * 1000 * 1000 AND ST_GeometryType(geometry)='ST_Polygon' AND name <> '' ORDER BY area DESC"
pgsql2shp -f "$CENTERLINES_SHP" -h "$POSTGRES_HOST" -u "$POSTGRES_USER" -P "$POSTGRES_PASS" "$POSTGRES_DB" "$query"
label_centerlines --output_driver GeoJSON "$CENTERLINES_SHP" "$CENTERLINES_GEOJSON"
This all seemed to work, but ogr2ogr will not load the resulting file.
ogr2ogr -progress -f Postgresql -s_srs EPSG:4326 -t_srs EPSG:3857 "PG:dbname=osm user=postgres host=localhost password=pgpassword port=5432" -lco OVERWRITE=YES -overwrite -nln "lake_centerline" "data/osm_lake_centerline.geojson"
ERROR 1: Failed to reproject feature 0 (geometry probably out of source or destination SRS).
ERROR 1: Terminating translation prematurely after failed
translation of layer osm_lake_centerline (use -skipfailures to skip errors)
When I compare it with the origional file the co-ordinates seem much different. for example
In the old file I see
{ "type": "Feature", "properties": { "OSM_ID": -6343.000000 }, "geometry": { "type": "LineString", "coordinates": [ [ -6.160017741542741, 57.202632052397163 ], [ -6.160017789121379, 57.20263208363577 ], [ -6.160017811116719, 57.202632126970215 ] ] } },
but in the file I made the co-ordinates are much bigger numbers
{ "type": "Feature", "properties": { "OSM_ID": -6343.0 }, "geometry": { "type": "LineString", "coordinates": [ [ -685730.038266069372185, 7801648.177360998466611 ], [ -685730.043562498758547, 7801648.183780899271369 ], [ -685730.046011009137146, 7801648.192686640657485 ] ] } },
I also notice the projections is "urn:ogc:def:crs:OGC:1.3:CRS84" vs "urn:ogc:def:crs:EPSG::3857"
So i guess my question is why the difference in numbers? am I exporting the shape file incorrectly? Is the newer (non .py) version of lake centerlines working differently? Anybody have any tips that may help me finally make this file?
well I think I may have gotten ogr2ogr to import my file with less options. The options I had used came from the openmaptiles import processes, so I am hoping without them it still works.
This worked
PGCLIENTENCODING=UTF8 ogr2ogr -progress -f Postgresql "PG:$PGCONN" -lco OVERWRITE=YES -overwrite -nln "lake_centerline" "data/osm_lake_centerline.geojson"
0...10...20...30...40...50...60...70...80...90...100 - done.
So I guess I can close this and see if the next step actually works!
Hi ungarj or anyone who may be able to point me in the right direction
I am trying to make a lake centerlines geojson file similar to the osm-lakelines project, which looks like it uses the older create_centerlines.py to make this geojson file https://github.com/lukasmartinelli/osm-lakelines/releases/download/v0.9/lake_centerline.geojson
Pulling the steps from the docker images there it seems these would be the steps
1.) Import the lake geometry into postgresql using imposm
2.) Export the geometry from postgresql into a shape file using pgsql2shp
3.) Calculate the centerlines using label_centerlines
I made did the following in bash to generate the file
( https://github.com/acalcutt/osm-lakelines/ )
This all seemed to work, but ogr2ogr will not load the resulting file.
When I compare it with the origional file the co-ordinates seem much different. for example
In the old file I see
{ "type": "Feature", "properties": { "OSM_ID": -6343.000000 }, "geometry": { "type": "LineString", "coordinates": [ [ -6.160017741542741, 57.202632052397163 ], [ -6.160017789121379, 57.20263208363577 ], [ -6.160017811116719, 57.202632126970215 ] ] } },
but in the file I made the co-ordinates are much bigger numbers
{ "type": "Feature", "properties": { "OSM_ID": -6343.0 }, "geometry": { "type": "LineString", "coordinates": [ [ -685730.038266069372185, 7801648.177360998466611 ], [ -685730.043562498758547, 7801648.183780899271369 ], [ -685730.046011009137146, 7801648.192686640657485 ] ] } },
I also notice the projections is "urn:ogc:def:crs:OGC:1.3:CRS84" vs "urn:ogc:def:crs:EPSG::3857"
So i guess my question is why the difference in numbers? am I exporting the shape file incorrectly? Is the newer (non .py) version of lake centerlines working differently? Anybody have any tips that may help me finally make this file?
The shape file and geojson I generated are up here if anyone wants to look at them https://github.com/acalcutt/osm-lakelines/releases/tag/v9.1
The text was updated successfully, but these errors were encountered: