Message Boards Message Boards

Unable to identify a road at a given longitude and Latitude

Posted 1 year 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
Posted 1 year ago

Thanks, this is a good workaround.

POSTED BY: Sean G

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

Hi Alex,

I am not aware of a way to get historical satellite images in WL. You could try the Landsat image archive which has images going back to 1972.

POSTED BY: Rohit Namjoshi

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 1 year 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

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 1 year 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

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"]
Posted 1 year ago

Thanks Rohit,

Unfortunately it still doesn't show me the road name. I also tried to zoom in a little by setting the region smaller by changing this: region = GeoDisk[position, Quantity[0.5, "Kilometers"]];

Instead of zooming in, it zooms out for some reason (maybe a bug). If I change the units to meters it still doesn't zoom in correctly.

Because Mathematica uses OpenStreetMap, my guess is that Mathematica should be able to get the streets somehow but maybe there is a bug/limitation?

POSTED BY: Sean G
Posted 1 year 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

GeoEntities requires a region within which to identify entities.

position = GeoPosition[{54.612947, -5.900967}];
region = GeoDisk[position, Quantity[2, "Kilometers"]];

entities = GeoEntities[region, "Building" | "Company" | "HistoricalSite"]
positions = #["Position"] & /@ entities
entityPositions = Transpose[{entities, positions}]

(* Tooltip shows entity name and type *)
DynamicGeoGraphics[
 Tooltip[
    GeoMarker[Last@#], (First@#)["Name"] <> " (" <> EntityTypeName@First@# <> ")"] & /@ entityPositions]

enter image description here

POSTED BY: Rohit Namjoshi
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