Group Abstract Group Abstract

Message Boards Message Boards

Unable to identify a road at a given longitude and Latitude

Posted 2 years ago

I'm trying to identify objects at a given longitude and Latitude.

GeoIdentify[All, GeoPosition[{54.612947, -5.900967}]]

only gives high level stuff like country, city etc.

GeoEntities[GeoPosition[{54.612947, -5.900967}], All]

seems to die not suggest anything.

Any suggestions would be appreciated.

POSTED BY: Sean G
11 Replies

You can try this:

position = GeoPosition[{54.612947, -5.900967}];
region = GeoDisk[position, Quantity[2, "Kilometers"]];
mp = GeoGraphics[region, GeoBackground -> "VectorLabels"]
Cases[%, _Text, All]
POSTED BY: Gianluca Gorni
Posted 2 years ago

Thanks Jose,

Interesting, when I use

GeoGraphics[region, GeoBackground -> "VectorClassic"]

it displays the correct region (if I use a region of less that 1km). If I do this with:

DynamicGeoGraphics[
 Tooltip[GeoMarker[Last@#], (First@#)["Name"] <> " (" <> 
     EntityTypeName@First@# <> ")"] & /@ entityPositions]

It fails to zoom to the correct level.

Either way, from what I can see, there is no entity in GeoEntities that supports "Road" so I still cant find the name of a road at a specific GPS coordinate.

POSTED BY: Sean G

I can explain that difference:

When the first argument of GeoGraphics or DynamicGeoGraphics contains several point-locations then we show a map of a region that contains all those locations, with a bit (say around 10%) of padding. The same thing happens when the first argument contains something with a finite size (say a disk, or a polygon).

But when there is only one point-location we cannot infer a notion of size, and we default to a radius of 10 miles. This is what happened when you restricted the region to 0.5 km: GeoEntities only found one entity, and therefore GeoGraphics and DynamicGeoGraphics did not know how to compute a map radius. Adding GeoRange -> region or GeoRange -> Quantity[0.5, "Kilometers"] would indicate the scale you want, and solve the issue.

And yes, we don't yet have entities for streets.

Posted 2 years ago

That makes sense, thanks.

Based on this thread, it seems to me that its not possible to identify a road using GPS coordinates with Mathematica. Is that a fair statement?

Maybe other options might just be to interact with various open source maps using an API.

POSTED BY: Sean G
Posted 2 years ago

As Jose mentioned, WL does not have entities for streets. You could use a free reverse geocoding service e.g.

Import["https://geocode.maps.co/reverse?lat=54.612947&lon=-5.900967", "RAWJSON"] // 
Dataset

enter image description here

POSTED BY: Rohit Namjoshi
Posted 2 years ago

Thanks, this is a good workaround.

POSTED BY: Sean G
Posted 2 years ago
POSTED BY: Rohit Namjoshi
Posted 2 years ago

Thank you, Rohit.

I tried to get a satellite image for these coordinates:

GeoImage[GeoPosition[{54.612947, -5.900967}], 
 GeoZoomLevel -> Automatic, ImageResolution -> 200]

enter image description here Now how can I get the satellite image for the year 2018 for example?

Thank you again for your time.

POSTED BY: Alex Teymouri
Posted 2 years ago
POSTED BY: Rohit Namjoshi
Posted 2 years ago
POSTED BY: Sean G

It's possible to get more street names in the maps by zooming enough. You can do this by clicking the + sign on the lower right of the DynamicGeoGraphics maps, or by adding GeoRange -> region or GeoRange -> Quantity[0.5, "Kilometers"] to the DynamicGeoGraphics call.

You can also use GeoGraphics instead of DynamicGeoGraphics, and then use one of the vector backgrounds, for example with GeoBackground -> "VectorClassic", that may give you access to other labeled elements. Try for example:

GeoGraphics[region, GeoBackground -> "VectorClassic"]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard