Hi I am using a bing maps 7.0 ajax api to display map. I have several addresses which i geocode to get latitude and longitude using rest services in javascript. I have setup up a GeocodeCallback method in the geocode request.
geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations?"+mapDataAddress[1]+"&output=json&jsonp=GeocodeCallback&jsonso="+mapDataAddress[0]+"&key="+credentials;
CallRestService(geocodeRequest);
When the address are found i get a response in my GeocodeCallback function but for few address i dont get a response. How to figure out this status and error.
I figured this out. So basically you need to do two things.
You need to change your URL structure. I have found out that sometimes if I have weird address, bing will return a 400.
use the suppressStatus parameter and set it to true. I can't find the docs at this moment but basically I have found that if bing returns a 400,404,etc it won't actually call the callBack function. So supressstatus says that no matter what, always return a 200.
Orignially you have:
http://dev.virtualearth.net/REST/v1/Locations?"+mapDataAddress[1]+"&output=json&jsonp=GeocodeCallback&jsonso="+mapDataAddress[0]+"&key="+credentials;
So you want to do this:
http://dev.virtualearth.net/REST/v1/Locations?addressLine="+mapDataAddress[1]+"&output=json&jsonp=GeocodeCallback&suppressStatus=true&jsonso="+mapDataAddress[0]+"&key="+credentials;
Also take a look at the Tips and Tricks for using the Bing Maps REST services listed here: http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/14/bing-maps-rest-service-tips-amp-tricks.aspx
Related
I'm successfully calling Bing's Truck Route API (below) to get a JSON response for a route.
https://learn.microsoft.com/en-us/bingmaps/rest-services/routes/calculate-a-truck-route
What's the standard way to get that to show up on a Bing Map? From their documentation here, I can't quite tell.
https://learn.microsoft.com/en-us/bingmaps/rest-services/imagery/get-a-static-map
To display a truck route result on an interactive map in Bing Maps, the easiest option is to leverage the directions module which supports truck routing. The directions module is an integrated part of the interactive map SDK. Here are some examples:
https://www.bing.com/api/maps/sdk/mapcontrol/isdk/directionscreatetruckroute
https://learn.microsoft.com/en-us/bingmaps/v8-web-control/map-control-concepts/directions-module-examples/calculate-driving-directions
If you want to instead directly access the REST routing API and display the results from that on a map, you will need to loop through and extract the route points from the route response, and create a line.
I'm working on a project, and I'm completely stuck.
I get the user's location using CLLocation and am able to get the place name using CLGeocoder, and using this I've constructed a URL to search the Google Places Web API.
My question is, how can I actually complete the search and return the top place result's phone number? Any help would be much appreciated!
let url: URL = URL(fileURLWithPath: "https://maps.googleapis.com/maps/api/place/textsearch/json?query=taxi+" + placeMark.locality!+"&key=" + self.GAPIKEY)
This is the URL I've come up in case that helps
The first thing you need to do is an HTTP GET on the URL to get the API results. Consult the following SO question for various ways to do that:
How to make an HTTP request in Swift?
The data returned will be a JSON document in the format described in the Google Places API Docs. Look for the formatted_phone_number and/or international_phone_number fields. See Working with JSON in Swift for how to parse the JSON string.
I am trying to point my twilio voice URl to my server.
So my routes files has this line:
GET /v1/twilio/ controllers.Application.call()
When I get the request from Twili, I get it as below:
/v1/twilio/?AccountSid=someRandomSID&
ToZip=0000&
FromState=A&
Called=%2B109213098234&
FromCountry=US&
CallerCountry=US&
CalledZip=9000&
Direction=inbound&
FromCity=xyz&
CalledCountry=US&
CallerState=A&
CallSid=randomSID&
CalledState=A&
From=%2B123455667&
CallerZip=90909&
FromZip=9890&
CallStatus=ringing&
ToCity=BLA&
ToState=AA&
To=%2B765213765&
ToCountry=PQR&
CallerCity=PT&
ApiVersion=2010-04-01&
Caller=%23123213&
CalledCity=BB]
SO you see, there are a lot of parameters.
My problem is that I am Not aware of all the parameters.
So when I just put above line in my routes file, I get an Error: 404 Not found.
How should modify the routes file so that I get the GET request?
If I ask twilio to send me POST request, then I don't have to worry about it as then I can simply get the parameter I need by Querying thee RequestData.
But there has to be some way I can get GET REQUEST to succed and reach my application controller.
Please help me here.
sorry if this is a silly question. But I am really struggling to get some info.
PS: I am using 2.3X version of play framework
Also, I dont have the control over parameters sent by Twilio.
I will simply get a GET/POst request, as per this : https://www.twilio.com/docs/api/twiml/twilio_request#synchronous
There's nothing unusual with this route, it works with sample URL like a charm (checked) maybe Twilio untrails return path by default? try to add spare route for handling this case as well:
GET /v1/twilio controllers.Application.call()
GET /v1/twilio/ controllers.Application.call()
I am using this link
http://maps.googleapis.com/maps/api/geocode/xml?address=wawa&sensor=false
but it return no results where as google maps application return about 8 results on "wawa" search.
can you please tell me that which is the best API which gives same results in the form of longitude and latitude as google map application give
I gave an answer some time back which explains the entire process of getting response from the api...
you can refer it here
I am facing a strange problem of google geocoding API.
My requirement is whenever a user types any address all the corresponding locations should show in my map View(I am using MKMap View) like it happens in google maps.
So what I do is I use google geocoding API that returns me a list of latitudes and longitudes for that corresponding location.
But for some location eg:- caribou coffee, chapel hil (When I search for this location in google maps,I get a number of annotations showing that address but when I type this address in geocoding I didnt get nothing.
request url:-http://maps.googleapis.com/maps/api/geocode/xml?address=caribou%20coffee,%20chapel%20hil%20&sensor=false
response:-
-<GeocodeResponse>
<status>ZERO_RESULTS</status>
</GeocodeResponse>
Can any body tell me why I am not getting any latitude and longitude that correspnds to this address like it shown in google maps or there is some other way so that I can integrate the behaviour of google maps in my applications(mk map view).
Please help me as I am stuck here.
Any suggestions will be highly appreciated.
Thanks in advance!
Note that the address is incomplete - e.g. searching for caribou coffee, chapel hill, nc does produce a result.
I would think that Geocoding API can't do anything with such addresses, and you may need to use some extra API - e.g. Places API (https://code.google.com/apis/maps/documentation/places/ ), which can return some results for queries like "coffee". You'd need to supply the user's location to use as a base, however.