Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Conversation

perliedman
Copy link

I noticed the Area object has wkb and wkt methods, but lacks the geojson method.

I guess this is because the geojson methods in Node and Way are implemented on the node-osmium side rather than relying on libosmium's GeoJSON serialization; with the current API, the same thing is not possible to do for areas.

I've hacked up a fix that uses libosmium's GeoJSONFactory to serialize an Area, and then parses the resulting string using JSON.parse. It feels a bit iffy, but seems to do the job.

Since this is my first dive into node-osmium/libosmium, I totally expect there to be better ways to do this. Any pointers on alternatives or improvements would be great!

@joto
Copy link
Member

joto commented Oct 29, 2015

You are right, your solution is a bit "iffy". I found a better one and just committed it. There is now a geojson() function on the Area object, too.

@joto joto closed this Oct 29, 2015
@perliedman
Copy link
Author

Thanks, your fix does indeed look much cleaner!

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

Successfully merging this pull request may close these issues.

2 participants