Is it possible to identify what's the nearest street on google maps?

135
June 12, 2019, at 2:40 PM

Is there a way to know the nearest street without using the Directions API of google? Like Uber and 99 does.

https://i.imgur.com/ZO95muw.jpg

Answer 1

You can use Roads API exactly Nearest Roads request like:

https://roads.googleapis.com/v1/nearestRoads?points=60.170880,24.942795|60.170879,24.942796|60.170877,24.942796&key=<YOUR_API_KEY>

to get JSON response like:

{
  "snappedPoints": [
    {
      "location": {
        "latitude": 60.170877918672588,
        "longitude": 24.942699821922421
      },
      "originalIndex": 0,
      "placeId": "ChIJNX9BrM0LkkYRIM-cQg265e8"
    },
    {
      "location": {
        "latitude": 60.170876898776406,
        "longitude": 24.942699912064771
      },
      "originalIndex": 1,
      "placeId": "ChIJNX9BrM0LkkYRIM-cQg265e8"
    },
    {
      "location": {
        "latitude": 60.170874902634374,
        "longitude": 24.942700088491474
      },
      "originalIndex": 2,
      "placeId": "ChIJNX9BrM0LkkYRIM-cQg265e8"
    }
  ]
}

Than, you can pass the placeId to the Places API or the Geocoding API to get the names of nearest road segments from JSON response.

READ ALSO
How to add colum JTable to Jcombobox in Java Eclipse

How to add colum JTable to Jcombobox in Java Eclipse

I add the column value of JTable to JComBoBox full of null notifications

177
App Crashes when decimals operated using Rhino Library

App Crashes when decimals operated using Rhino Library

I am using Rhino Library to eavaluate a string in android studioWhile Doing it I got an error, the app crashes when decimals are multiplied

141
Java - Reflect a method which has a Enum as parameter [on hold]

Java - Reflect a method which has a Enum as parameter [on hold]

How to get a reflected method reference which has a Enum as parameter ? I have this -

144