Message Boards Message Boards

Questions about the use of OpenStreetMap data

I found a new function (OSMImport) in the function library. It can download the road data of OpenStreetMap for analysis.

(*Central Park,New York; coordinate is {40.783333, -73.966667}*)
osm = ResourceFunction["OSMImport"][
     GeoBoundsRegion[
      GeoBounds@
       GeoCircle[#, 
        Quantity[200, "Meters"]]]] &@{40.783333`, -73.966667`};
(*Show Map*)
GeoGraphics[
 Values[Line[Values[osm[["Nodes", #Nodes, "Position"]]]] & /@ 
   osm["Ways"]], GeoBackground -> "StreetMap", 
 GeoRangePadding -> None, AspectRatio -> 1]
(*Calculate the road length around Central Park; The total length of \
the road is 21853.8 m*)
GeoDistance[#] &@Values[osm[["Nodes", #Nodes, "Position"]]] & /@ 
   osm["Ways"] // Values // Total

enter image description here
But there are still some questions about the use results. First, the above example does not filter road types, but only a few roads are included. Second, if I want to know the area of ​​the grassland, how to do it?

I hope that those who have studied these issues can provide suggestions.

POSTED BY: Tsai Ming-Chou
Posted 3 years ago

Tsai:

One of the best things about the function repository is that you can dig into the code behind the function by downloading the Source Notebook.

I do not know anything about the OpenStreetMap API. But, the code behind this function is fairly short and looks to be well written. You should be able to modify the code to access more of what the OpenStreetMap API offers.

Have a great weekend.

POSTED BY: Mike Besso
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract