Select to view content in your preferred language

Retrieve geometry of country boundary from OSM

231
0
04-01-2024 11:22 PM
Labels (1)
MarcHillman
Occasional Contributor

I would like to retrieve the boundary geometry of many countries so I can conduct some intersection tests with other geometry I have. I have been successfully doing this with local shapefiles via ShapefileFeatureTable, and also via a ServiceFeatureTable service. Having retrieved the geometry it's a simple matter to do a geometryengine.intersects test to see if the two geometries overlap.

I now wish to use OpenStreetMap (OSM) as my data source. I really need some guidance as to how to get started. There seems 15 different ways and wrappers to the OSM data. I know I can do an overpass query to get what I want, but I struggle to convert the result into a feature that I can do spatial testing on. I assume there is an easy way to query OSM and end up with a feature or featurecollection. As an example, I am trying to do the equivalent of the overpass query below to get the boundary for Alaska.

[out:json][timeout:25];
relation[boundary=administrative][admin_level=4]["name:en"=Alaska];
out geom;

This gives me geometry in json, but I have to convert it to a feature. I'm looking for a way to skip that step and get a query result from OSM in a feature/featurecollection.

My program is in VB.NET using EsriArcgisruntime 200, but I can follow C++.

Tags (2)
0 Kudos
0 Replies