Closed jayqi closed 8 months ago
thanks for working on this! 😄
some of the roads that are in the shapefile, aren't showing up in the nbviewer visualization. (QGIS on the left showing source shapefile, your nbviewer on the right)
(also, i need to look at why some of the roads don't seem to be in the source shapefile, e.g. North Main Street / BUS US 131)
the final output should be a points (here's the Cambridge20m.shp
from https://github.com/mittrees/Treepedia_Public/tree/master/sample-spatialdata
@danbjoseph It looks like that road has the property highway=tertiary
. It's one of the road types that gets filtered out:
This is logic from the Treepedia version:
@ayoakin did you mean to merge or was that a mistake? I didn't think @danbjoseph had finished reviewing.
i'm not terribly concerned about what's in a given PR at this point (no one outside those working on the project is using the code). i asked @ayoakin to review as he had been building familiarity with the code while working in a Google Colab.
@jayqi please note my comment about the final output from this step being a points file (not lines). the other items can come later (e.g. figuring out the best method for cleaning/filtering the different roads features... should the user do it in a GIS software before starting the scripted process? should we have configurable filters in the code? something else?) as they aren't blocking moving onto the Mapillary API calls and other steps
@jayqi I merged so I can pull and check as we don't have a job for that atm on here. Like @danbjoseph mentioned I don't think what's in main should matter at this point.
I am mainly checking for functionality and reproducibility. Might make some suggestions once I am able to make it run locally on my end. Thanks so much!
@jayqi please note my comment about the final output from this step being a points file (not lines). the other items can come later (e.g. figuring out the best method for cleaning/filtering the different roads features... should the user do it in a GIS software before starting the scripted process? should we have configurable filters in the code? something else?) as they aren't blocking moving onto the Mapillary API calls and other steps
The output is indeed a file of points, and sorry that this wasn't clear. In the notebook, I've subsetted the map to only show a single road for as a demonstration, but the actual workflow of using the script produces a output file that contains the interpolated points for all roads (with the same filtering in the Treepedia script).
This is a rewrite of
createPoints.py
from mittrees/Treepedia_Public using geopandas, a modern popular geospatial Python library.A few key points:
createPoints.py
in accepting and writing different vector data formats.createPoints.py
in accepting input data in any CRS as long as the CRS is defined in the data itself.You can see the Jupyter notebook
notebooks/0.0-jyq-create-points-demo.ipynb
for a demo. Note that the folium maps do not directly load in GitHub, but you can see the rendered notebook here via nbviewer.The script can also be called as a command-line program with
python src/create_points.py
orpython -m src.create_points
. Use the--help
flag for documentation.