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

Use building:levels as an indicator for height #5

Open
jaskiratr opened this issue Oct 21, 2018 · 1 comment
Open

Use building:levels as an indicator for height #5

jaskiratr opened this issue Oct 21, 2018 · 1 comment
Assignees

Comments

@jaskiratr
Copy link
Contributor

Current Behavior
image

Expected Behavior
OSM Buildings
image

OSM Data Source
image

@jsteele2003
Copy link
Member

There's almost certainly a better way to do this, but it works for syracuse at least!

Filter
.features | .[] | select(.properties.building != null) | (select(.properties.height != null) | ((.properties.height = try (.properties.height | tostring | capture("(?<num>[0-9]+)")| .num | tonumber) catch .) )) , (select(.properties.height == null and .properties["building:levels"] == null) | .properties.height = 1), (select(.properties.height == null and .properties["building:levels"] != null) | .properties.height = try (.properties["building:levels"] | tostring | capture("(?<num>[0-9]+)")| .num | tonumber) catch .)

Sample
[ { "type": "Feature", "properties": {"party": "Green", "building": "yes", "height" : "10"} }, { "type": "Feature", "properties": {"party": "Republican", "building": "yes"} }, { "type": "Feature", "properties": {"party": "Democrat", "building": "yes", "height" : "20 m", "building:levels": 31} }, { "type": "Feature", "properties": {"party": "Salty", "building": "yes", "building:levels": "31"} }]

Output
{ "type": "Feature", "properties": { "party": "Green", "building": "yes", "height": 10 } } { "type": "Feature", "properties": { "party": "Republican", "building": "yes", "height": 1 } } { "type": "Feature", "properties": { "party": "Democrat", "building": "yes", "height": 20, "building:levels": 31 } } { "type": "Feature", "properties": { "party": "Salty", "building": "yes", "building:levels": "31", "height": 31 } }

I am noticing however that the levels property isn't an exact match for height- so might require some more arithmetic to approximate height a bit more accurately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants