stgeorges / gismo

Gismo is a free Grasshopper plugin for GIS environmental analysis
Other
80 stars 22 forks source link

OSM Shapes: solve issues on failed reprojection #11

Closed krnkktz closed 4 years ago

krnkktz commented 4 years ago

The OSM Shapes component failing reprojection results in a crash, giving no helpful error message. Defining the variable util solves the NameError, while the return statement allows the error message to be displayed instead of going on assuming a successful reprojection, which eventually crashes because reprojectedShapefile is None.

This only changes the Python file, as I don't know how the .ghuser files are generated for this project, but I'd be happy to do that if given any pointers!

Thanks!

stgeorges commented 4 years ago

Hi @krnkktz , Thank you for reporting this, and fixing the bug of the missing "util" variable. Can you please attach your .gh file?

krnkktz commented 4 years ago

Hi, Thank you!

Here is the .gh file: osmshapes_issue.zip

It turns out that I was looking at an empty location (the bottom one in the .gh file), which is why Reproject() failed. I am proposing a fix for that in another pull request.

I am still seeing "The component generated invalid shapes data" with the top location, which has some streets, but I guess it is an unrelated problem (should I open an issue?) and, this being my first experience with Gismo/WinMapGIS, I am slightly overwhelmed.

Edit: found the post on the GH forum explaining that the invalid shape data is not Gismo's fault, sorry!

stgeorges commented 4 years ago

Hi @krnkktz , Thank you for posting the .gh file! Indeed you were right: that location for given radius (OSM Shapes component uses 100meters by default), didn't cover anything in openstreetmaps. Here is a screenshot: image

If you increase the radius to 300 for example, you will get the geometry generated from OSM shapes component, as it will cover these roads on the left side of the location.

But you were right, "utils" variable should have been defined.

As for the "The component generated invalid shapes data", delete your "c:\gismo\osm_files" folder, and then use the create_3dbuildings_trees_streets.gh example file by changing to your location. If the error still appears, open a new topic about it on forum.