I want to know is JSON padding 'jsonp' works in Google map API ?
In an application i have to implement google map by replacing bing map(already developed).
In below url bing uses jsonp to respond back the response
https://dev.virtualearth.net/REST/v1/Locations/37.556141,-122.287880?output=json&jsonp=LocationPane.drawLocationHistory_0_OnMap&key=SOME_KEY
I tried to prepare the url as and also tried many combination of it
https://maps.googleapis.com/maps/api/geocode/json?latlng=18.5236,73.8478&jsonp=LocationPane.drawLocationHistory_0_OnMap&sensor=false
but its not working as it works in Bing map.
Please let me know is json padding possible in google map or is there any better way to use geocoding
jsonp is currently not supported by the geocoding-webservice.
But you may use the geocoding-service of the JS-API to retrieve the results and pass them to the callback-function.
Related
I have stumbled upon this: when I use directionsDisplay.getDirections() API to fetch and display the results, it works, but when I do it via json:
https://maps.googleapis.com/maps/api/directions/json?origin=place_id:ChIJR0FT51wiDogRNuVKiLn9ZLA&destination=place_id:ChIJMWaiY0YpTIYRRdGvCMg7m0g&key=MY_KEY&waypoints=via:place_id:ChIJaWS37r88DIgRu-ak1l7eXAQ
I get "status" : "ZERO_RESULTS"
I am wondering why this might be happening? Any ideas?
Remove the "via:" keyword from the waypoints to get the response.
https://maps.googleapis.com/maps/api/directions/json?origin=place_id:ChIJR0FT51wiDogRNuVKiLn9ZLA&destination=place_id:ChIJMWaiY0YpTIYRRdGvCMg7m0g&key=MY_KEY&waypoints=place_id:ChIJaWS37r88DIgRu-ak1l7eXAQ
From the documentation:
The via: prefix is most effective when creating routes in response to the user dragging the waypoints on the map. Doing so allows the user to see how the final route may look in real-time and helps ensure that waypoints are placed in locations that are accessible to the Google Maps Directions API.
Caution: Using the via: prefix to avoid stopovers results in directions that are very strict in their interpretation of the waypoint. This may result in severe detours on the route or ZERO_RESULTS in the response status code if the Google Maps Directions API is unable to create directions through that point.
I am playing with the google maps sdk for ios.
I was wondering if it's possible to add an search function where you can search for your markers?
Or do i need to use the google places api?
You should use the Google Places API to make HTTP requests from your app. You should request a JSON file. Then you'll need to parse the response, and use it to add markers to a GMSMapView.
Update:
You could also use Places API for iOS
I am trying to implement google maps print for that i am using API
https://maps.google.com/maps?saddr=&daddr
To initiate print it is said to be that pw is the parameter . And i used like this
https://maps.google.com/maps?saddr=Raleigh%20Road,%20Chapel%20Hill,%20NC,%20United%20States&daddr=Chapel%20Hill%20Road,%20Raleigh,%20NC,%20United%20States&dirflg=r&om=1&pw=2
But it is not showing any result but 404.
Can someone help me with this?
That "API" is "classic" google maps. It was never documented officially and is no longer supported.
It has been replaced by the Embed API
I want to use Google Maps API with Processing. Until now I was just able to get Google Places data, but I'm struggling with the map itself. I know about other map options, like unfold or modestMaps, but I need Google. In particular because of the directions API in further progress. I've searched this forum and the web, without any help. I thought it should be quite
easy.
How can I use Google Maps with Processing?
I'm not sure about getting a full featured, dynamic Google Maps within your Processing app, but you might be able to modify the Processing library for the Google Weather API to instead use the Directions or Static Maps APIs. http://www.onformative.com/lab/google-weather-library-for-processing/
If you download the source and check out GoogleWeather.java you can see the constructor is calling the WeatherAPI and getting back the XML result. I think you could do the same thing except use the Directions API in it's place.
Here's a post on a Java blog about showing Static Maps API results in Java, which might be translatable into Processing: http://weblogs.java.net/blog/cajo/archive/2010/10/16/adding-google-maps-your-java-application
For something more dynamic, you might be able to adapt JXMapViewer, check out this article: http://today.java.net/pub/a/today/2007/10/30/building-maps-into-swing-app-with-jxmapviewer.html
Is there any way to create a KML overlay in Google Maps by passing the KML as a string rather than as a publicly accessible URL? AFAICT there is no such option in the Google Maps API v3. I am not asking about the API but about possible end runs around this limitation.
Personally I can think of only one: to parse the KML and generate equivalent JS. Does anyone have a better suggestion?
geoxml3 has a parseKmlString method, which will parse a string of kml and can create native google maps API v3 objects from it. I have used it to parse kml fragments out of FusionTables.
I've tried too but i haven't found a way to do this.
The reason is explained here: https://stackoverflow.com/a/6152916/2131283
For the tests my work around was sharing the kml file on my dropbox then give the direct access url with the token to the constructor
kmlLayer = new google.maps.KmlLayer
url: 'https://dl.dropboxusercontent.com/s/eg/gmaps.kmltoken_hash=HASH_CODE&dl=1'
Looking over the API it doesn't appear that this is possible.