Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid polygons: geopackage layer not working #114

Closed
slautenb opened this issue Jan 24, 2020 · 4 comments
Closed

Avoid polygons: geopackage layer not working #114

slautenb opened this issue Jan 24, 2020 · 4 comments
Assignees
Labels
fixed in master Download https://github.com/nilsnolde/OSMtools/archive/master.zip and extract to plugin path QGIS bug?

Comments

@slautenb
Copy link

I used a shapefile polygon layer as the avoid polygon layer to get directions. Worked fine. Exported the shapefile to a geopackage and rerun get directions with the same settings. Got an error. Seems that the geometry is somehow lost - potentially similar to the scratch layer issue?
I have used a multipolygon layer (since avoid poly seems to use only the latest polygon in the layer, not all of them) but the same issue occured then using a single polygone object

directions with geopackage layer

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
https://api.openrouteservice.org/v2/directions/driving-car/geojson?
Parameters:
{ "preference": "shortest", "geometry": "true", "instructions": "false", "elevation": true, "id": 1, "options": { "avoid_polygons": null }, "coordinates": [ [ 8.960339, 48.9332 ], [ 8.964302, 48.940164 ], [ 8.964302, 48.940164 ] ] }

directions with shapefile layer

https://api.openrouteservice.org/v2/directions/driving-car/geojson?
Parameters:
{ "preference": "shortest", "geometry": "true", "instructions": "false", "elevation": true, "id": 1, "options": { "avoid_polygons": { "coordinates": [ [ [ [ 8.963599963217254, 48.938162988202 ], [ 8.963991513405508, 48.937218946562346 ], [ 8.962446, 48.93693 ], [ 8.96138559006528, 48.93743268648382 ], [ 8.961580298132365, 48.93837691600576 ], [ 8.963599963217254, 48.938162988202 ] ] ], [ [ [ 8.960542285965213, 48.93983287840176 ], [ 8.960541635103766, 48.94065856316303 ], [ 8.960541635103766, 48.94065856316303 ], [ 8.963888, 48.94044 ], [ 8.962896, 48.938592 ], [ 8.960542285965213, 48.93983287840176 ] ] ] ], "type": "MultiPolygon" } }, "coordinates": [ [ 8.960339, 48.9332 ], [ 8.964302, 48.940164 ], [ 8.964302, 48.940164 ] ] }

@nilsnolde
Copy link
Contributor

Oops, somehow I didn't get notified, sorry Sven. Will investigate!

@nilsnolde nilsnolde self-assigned this Feb 20, 2020
nilsnolde added a commit that referenced this issue Feb 20, 2020
@nilsnolde
Copy link
Contributor

This is the weirdest thing:

  • Export existing (Multi)Polygon shapefile to GPKG: works as avoid layer
  • Create entirely new GPKG and add a polygon geometry: gives the error you're describing

I think that's a bug in QGIS GPKG driver: When one creates a fresh GPKG with a fresh layer and adds new features, QGIS (or GDAL) somehow assigns the first feature an FID = 1 instead of FID = 0 (as for shapefile). I wrote the dev mailing list to test the waters before opening a QGIS issue.

Anyways was a quick, backwards-compatible and future-proof fix (after hours of stupid research in the wrong direction..). You can upgrade from the QGIS plugin repo in a day or two max.

@nilsnolde nilsnolde added fixed in master Download https://github.com/nilsnolde/OSMtools/archive/master.zip and extract to plugin path QGIS bug? labels Feb 20, 2020
@nilsnolde
Copy link
Contributor

Published on the official plugin repo.

@nilsnolde
Copy link
Contributor

Opened a QGIS bug report:

qgis/QGIS#34606

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in master Download https://github.com/nilsnolde/OSMtools/archive/master.zip and extract to plugin path QGIS bug?
Projects
None yet
Development

No branches or pull requests

2 participants