Closed danbjoseph closed 2 months ago
Quick look in geopandas suggests there are features with None as geom type, which seems weird but which I assume is what causes create_points
to fail.
>>> gpd.read_file("./jakarta_road_sample_small.zip")
highway osm_id geometry
0 tertiary way/155964624 LINESTRING (106.85513 -6.32937, 106.85518 -6.3...
1 tertiary way/157974609 None
2 residential way/157974611 None
3 residential way/158979934 None
4 residential way/158979937 LINESTRING (106.85874 -6.32874, 106.85866 -6.3...
.. ... ... ...
78 living_street way/1228079958 None
79 living_street way/1240606898 LINESTRING (106.85774 -6.32645, 106.85772 -6.3...
80 living_street way/1240606900 None
81 residential way/1245158482 LINESTRING (106.85653 -6.32900, 106.85631 -6.3...
82 tertiary way/1259596877 None
Adding a geomtry type column in QGIS shows something similar:
... and from an eyeball it doesn't look like QGIS is displaying 83 features:
How did you generate the dataset?
Regardless, would be a good idea to add a check to check_points
to check that geom_type
is not null. (I can have a go at this when I have some time)
I used the vertex tool to remove some of the roads and segments from the overpass query/export that I didn't want for the sample. Must have only deleted the vertices and not the feature itself. Interesting!
If testing before a check for this is implemented, you can delete features with null geometry following: https://gis.stackexchange.com/a/276800
I've made a check to detect this and will make a pull request.
if (gdf.geometry.isna()).any():
raise ValueError("Input GeoDataFrame contains null geometries.")
But checking first - is it desireable to add an argument to create_points
to optionally drop null geometries? Or is it better to just raise and error and let users fix the dataset before using it?
I think it would be nice to have the raised error message and then have an option to deal with it inside the program (instead of having to go back to QGIS). What do you think?
Something like...
Input GeoDataFrame contains null geometries. Rerun with --dropNull to drop these geometries.
Has this been resolved? Looks to be that way so closing for now...
it has. if you run python -m src.create_points --help
it will include details on --drop-null
the --help
command is mentioned in the readme, do you think we need to mention each flag in the readme or is mentioning how to get details through the help flag enough?
can't get the
create_points
process to work with a different sample dataset. i can't find a difference that would lead to the failure.the file: jakarta_road_sample_small.zip
the error message:
(not working) Jakarta sample details
(working) Three Rivers sample details