-
Notifications
You must be signed in to change notification settings - Fork 2
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
Generate the NCN layer #47
Conversation
def makeNationalCycleNetwork(): | ||
tmp = "tmp_ncn" | ||
ensureEmptyTempDirectoryExists(tmp) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity, a comment linking to https://data-sustrans-uk.opendata.arcgis.com/ useful. The arcgis URL isn't discoverable or could change with another version
layers/generate_layers.py
Outdated
run( | ||
[ | ||
"wget", | ||
"https://services5.arcgis.com/1ZHcUS1lwPTg4ms0/arcgis/rest/services/National_Cycle_Network_Public/FeatureServer/0/query?outFields=*&where=1%3D1&f=geojson", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How'd you get this link? I got https://opendata.arcgis.com/api/v3/datasets/5defd254e78745bfb12d0456abc1bcf1_0/downloads/data?format=geojson&spatialRefId=4326&where=1%3D1
by going to https://data-sustrans-uk.opendata.arcgis.com/datasets/5defd254e78745bfb12d0456abc1bcf1_0/explore, clicking download, going down to geojson, choosing the file that's already there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it from Robin's comment 👀 good point that I should check they match
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got the same link as you, will use it instead and rerun
layers/generate_layers.py
Outdated
tmp = "tmp_ncn" | ||
ensureEmptyTempDirectoryExists(tmp) | ||
|
||
# Get the shapefile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment, this isn't a shapefile
layers/generate_layers.py
Outdated
] | ||
) | ||
|
||
reprojectToWgs84( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file I downloaded is already in WGS84
layers/generate_layers.py
Outdated
f"{tmp}/national_cycle_network_download.geojson", f"{tmp}/national_cycle_network.geojson" | ||
) | ||
|
||
# def fixProps(inputProps): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The props in there look fine. We could be lazy and just plumb everything through, then only display some fields later. Or do work here to strip out unused stuff like segment ID, global ID, shape_length, etc. If it's not hassle, just listing the fields to keep or to delete could be nice, to keep things clean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good here! I re-ran locally and copied to S3. Looking at the frontend PR now
def fixProps(inputProps): | ||
propsToRemove = ["LinkNo", "Lighting", "RoadClass", "SHAPE_Length", "GlobalID", "SegmentID"] | ||
for prop in propsToRemove: | ||
inputProps.pop(prop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never seen pop
on a dictionary, only ever to remove the last thing from a list. But it works! TIL more python
No description provided.