I'm wonder if I can get Ski Trail Name from Google Map api.
For example, I picked a location on google map that displays as ski trail "The Main Street" on Google Map.
https://www.google.com/maps/place/39%C2%B015'31.7%22N+120%C2%B007'42.5%22W/#39.258805,-120.128457,17z/data=!3m1!4b1!4m2!3m1!1s0x0:0x0
Then I try using google geocode api to get the name of that location.
https://maps.googleapis.com/maps/api/geocode/json?latlng=39.274178,-120.119568&key=API_KEY
I couldn't get the name of "The Main Street."
I'm thinking I should be querying on a different layer of google maps, but I don't know where to look. Any help is appreciated.
You have to use the Google Place API to get the name or the detailed information about a location on the Google Maps, For specific trails or routes on the Google maps you have to use the Direction API. You have to get the Server API Keys for both the API from Google Developers Console and then put that in the API request call.
Follow the instruction on this Google's official documentation for Places API & Follow the instruction on the Google's official documentation for Direction API set up.
Please have a look at this example for implementation in your app code.
Hope this would Help!!
Related
I'm trying to find in the Google Maps documentation a way to search for a place and get it's GeoJson polygon but I got no luck finding something like that.
My goal is to create a search bar to search places and then send the geojson polygon to our back-end. I don't want to draw it on a map or anything front-related.
Nominatim is doing exactly what I want but Nominatim policy is very restricted so before I go for an alternative, I wanted to check if Google Maps could provide the same (especially since searching for a country on Google Maps retrieve the polygon and draw it on the map).
Thanks for your help !
Unfortunately Google Maps APIs don't expose any polygons data of geographic features. You can see very old feature request in the Google issue tracker to add this functionality, however it looks like Google didn't set high priority on this task:
https://issuetracker.google.com/issues/35816953
Feel free to star the public feature request to express your interest and subscribe to further updates from Google.
You should get polygons from other sources.
I currently have an application which takes a a start and end point from a user and sends a request to the google maps directions API, for example: https://maps.googleapis.com/maps/api/directions/xml?key=my_key8&origin=M460PU&destination=NN36NW&sensor=false&mode=driving&units=imperial&departure_time=1501752779
We then display the estimated journey time for a given route. The user has asked if it's possible for us to include a link directly to Google maps so that they can see the route on the maps and make sure it looks ok.
I've seen previous questions such as this one: Link to Google Maps but that seems to be a solution for a simple Google Maps search, where as in my case I want to see a route from the directions API.
I'm trying to figure out if I there's a way I can take the data from the Directions API response and plug that in to a http://maps.google.com/maps URL that the user can click on. Has anyone ever had any success doing this?
As mentioned #geocodezip you should use Google Maps JavaScript API or Google Static Maps API in order to show exactly the same route as the output of Directions API.
There is also an option to open Google Maps web site or native app using the Google Maps URLs. You can have a look at the documentation to figure out how to create the URL:
https://developers.google.com/maps/documentation/urls/guide#directions-action
The only issue is that the Google Maps URLs doesn't provide any parameter for departure time, so you will always get routes for "Leave now" that might have discrepancies comparing to a web service that was requested for a different departure time.
Based on your question I think the Google Maps URL might be
https://www.google.com/maps/dir/?api=1&origin=M460PU&destination=NN36NW&travelmode=driving
I recently started a google maps API course with Udacity, one of the questions involves geocoding and I have hit a brick wall with it.
the task that I have asked to do is "Using geocode WEB SERVICE request in your browser find the fun place that the following coordinate describes"
the coordinates being LAT:33.1262476 LNG:-117.3115765 the videos on the course didn't go into to much detail.
Any help?
Read about Google's geocoding API, and in particular the reverse lookup of lat/long coordinates -> addresses and/or named locations.
https://developers.google.com/maps/documentation/geocoding/intro#reverse-example
For your case, it will be something like making a request to this URL:
https://maps.googleapis.com/maps/api/geocode/json?key=YOUR_API_KEY&latlng=33.1262476,-117.3115765
Note that YOUR_API_KEY is something you'll have to create by registering a Google developer account (which is free).
I have read your answer on this.
Maps API keys for geocoding not working anymore?
Currently I am trying this:
https://maps.google.com/maps/api/geocode/json?address=n&sensor=true&key=apikeygoeshere
Giving me error:
This API project is not authorized to use this API.
Please suggest how can I complete my app. I am searching locations for my App.I can buy business plan later but for now I need to test for development.
I have following services on:
Google Maps Coordinate API, Google Maps Engine API, Google Maps Geolocation API, Google Maps JavaScript API v3, Google Maps SDK for iOS, Places API.
What you are referring to is not the Geolocation API. It is the Geocoding API. You need to enable the Geocoding API in your console. Please see the documentation.
Visit the APIs console at https://code.google.com/apis/console and log in with your Google Account.
Click the Services link from the left-hand menu in the APIs Console, then activate the Geocoding API service.
Hope this helps.
Try this URL,
You Don't have to enter API Key in URL
Just pass lat,lng in URL through a variable
http://maps.google.com/maps/api/geocode/json?latlng=-34.78,138.519&sensor=false
When you put your location (Capital Area Soccer League) in google map search, google plots the location in the map if it finds a correct geocodes but if it does not finds proper geocodes for the searched location then it shows suggestions of corrects locations in the dropdown. When you choose any of the locations from the dropdown - it has the correct lat long (geocodes) so it plots that in the map correctly.
So you should not use geocodes in the search rather open up a suggestions dropdown and when click on any of the suggested location then you have correct geocodes to plot in the map.
I've started developing a small app which main goal is to draw a map using Google Maps API (v3), and to show business in the area drawn (bars, restaurants and so on).
I found the Google Places API that was supposed to be released this month but it hasn't been. As far as I know the point of that API is to offer results from the Google's database of business, so later we could put those business in the map.
However now I've found this sample which is using the AJAX Search API and Local Search Control for Google Maps to do the same thing.
So the question is, what is the point of the new Google Places API?
Thank you in advance!
The Places API returns a list of locations near a specific lat/lng, while the Local Search API allows for an arbitrary search of Google's database of business listings and other POIs.