Bing Maps throwing "Invalid Geocode" error on street intersection that it is able to get the Latitudes and Longitude from - bing-maps

I am currently working on a project that involves calculating Duration matrices from a collection of thousands of addresses using NEO4J and Bing Maps API. Since the data is sensitive, we're going to use the mock address (which actually produces the same issue I'm describing) '72ND & DODGE, OMAHA, NE 68132' to represent the format intersection addresses are being sent to Bing Maps API using their keys and basic url requests.
To preface this: the issue isn't with my code (which is also sensitive data), as all my code is doing is sending one url string of the above format plus the authorization key to Bing Maps and awaiting a response that contains the duration data of the trip. My issue is Bing Maps being seemingly unable to handle or work with intersections of streets to calculate distances/durations from other locations. When I throw these addresses into Bing/Google Maps in the web browser, they are able to be found and calculated in the exact same format as the above example.
I start off my program checking if an address exists/is valid by having it find the latitude and longitude of each address, so for the example '72ND & DODGE, OMAHA, NE 68132' it found: Lat: '41.259690' and Long: '-96.023770'. If it is unable to find the Lat/Long of an addresses, then it throws the 'Invalid Geocode' error, but in this initialization context it means the address does not exist, or is poorly formatted, which makes sense and is why I did this for the initialization phase.
However, if I go to use '72ND & DODGE, OMAHA, NE 68132' for any duration calculations between other addresses, it throws the 'Invalid Geocode' for '72ND & DODGE, OMAHA, NE 68132' over and over again with no explanation on why even though it passed the Lat/Long check. I'd also like to mention that this issue isn't consistent, as some intersections do not work while others do, but there is no consistency in knowing which ones will or will not work. Thus, I am ultimately wondering if Bing Maps is unable to calculate certain addresses no matter their formatting or whatnot.

Be sure to encode your query before putting it into the URL. Especially when you have & in your query since it would then break your query up, thinking you were asking just for 72ND and the rest of your query is query string parameter name. This is documented in the best practices section here.
In Java you can encode the query parameter like this:
String baseURL = "https://dev.virtualearth.net/REST/v1/Locations?key={BingMapsKey}&query=";
// query string
String query = "72ND & DODGE, OMAHA, NE 68132";
// URL encode query string
String encodeStr = URLEncoder.encode(query, StandardCharsets.UTF_8.name());
// final url
String url = baseURL + encodeStr;
Here is an example of how your query URL should look:
https://dev.virtualearth.net/REST/v1/Locations?key={BingMapsKey}&query= 72ND%20%26%20DODGE%2C%20OMAHA%2C%20NE%2068132

Related

How to add housenumber in nominatim API in OSM

The Nominatim API states
'street= '
It implies that there is a space between <housenumber> and <streetname>.
However, when I try to enter a space in the URL
https://nominatim.openstreetmap.org/search?city=berlin&street=skalitzerstrasse 9&format=json
I get an error (understandable).
How to properly add the housenumber?
First of all it's better to prefix the housenumber and than you just urlencode the space like:
https://nominatim.openstreetmap.org/search?city=berlin&street=142%20skalitzer%20straße&format=json
You'll also have only the street as a response if a housenumber (like 9) is not present or mapped, that's why I have chosen a different housenumber as an example.

Mapquest route matrix response

Hi I am using mapquest api to show the distance from source to destination in app
Problem:
I am sending below request to mapquest to get the distance
{ "locations":[ "40.2336,-111.6475", "33.621227,-111.917229","30.688181,76.706238"],
"options":{ "allToAll":true, "unit":"k", "doReverseGeocode":false,"manyToOne":true } }
Now in this case distance can be calculated from first lat long to second lat long as both are US based address but distance cannot be calculated between first and third location as third one is Indian location .
Now the response I am getting is
{"route":{"routeError":{"message":"","errorCode":0}},"info":{"copyright":
{"text":"© 2015 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif",
"imageAltText":"© 2015 MapQuest, Inc."},"statuscode":400,
"messages":["We are unable to route with the given locations."]}}
Which I suppose is wrong as distance between first two places should be returned .
Please suggest what can be done for this ?
Currently the matrix fails if any of the legs fails. Making this return any successful legs is on the team's backlog.
The reason for the error is that your locations are invalid. I ran it with the exact POST body you had, and got error 402. Looking at the MapQuest Directions API Status Codes, this is an invalid location. This makes sense, considering the coordinates include two in the US and one in India. This, AFAIK, is only a driving API, hence why overseas locations are invalid.
Another point unrelated to the main problem: your request is semantically invalid. You specify both allToAll and manyToOne as true, which is invalid. The API will ignore your manyToOne as a result, so make sure you are requesting exactly what you want.

Sharepoint URL to reference a lookup

I have two SharePoint lists used for Support case management. The first list contains Case Numbers and information about the case. The second list contains exhibits that support the case itself.
We have a convention that the Case Number is a String supplied by the worker, ex 20150205-001. When the exhibits are joined to the Case it is through a Lookup. I want the Exhibit ID, a String, to be of the form Case Number + _[A-Z] -- and be auto-assigned.
I want to use a Workflow (MS Sharepoint Designer 2013) to assign the Exhibit ID. The problem I face is that I cannot get the actual Case Number from the Lookup. The closest I have gotten so far is to get the ID (1, 2, etc) but not the actual String value represented.
Tried working with the following URL:
http://[mySiteURL]/_api/web/lists/getbytitle([listName])/items?$select=Title,Case/Id&$expand=Case/Id&$filter=Case/Id%20eq%2020150205%45001
substituted ascii: $filter=Case/ID eq 20150205-001
without the filter I get all list items (understandably) but the filter does not work properly because the ID is not the actual lookup value.
This is a SPD 2013 limitation. You have to use a web service call from within Designer to get the specifics of a lookup column from SharePoint. You make a REST call ad then parse the JSON response for the specific data from the lookup column. It gives you access to all of the columns from the list item that you looked up:
Build {...} Dictionary (Output to Variable: requestHeader )
Call [%Workflow Context:Current Site URL%]... HTTP web service with Variable: Request (ResponseContent to Variable: PoleIDData |ResponseHeaders to Variable: dictionary |ResponseStatusCode to Variable: responseCode )
Get d/Pole_x0020_ID from Variable: PoleIDData (Output to Variable: PoleID )
Set Name to Variable: PoleID
Your actual web service call will be formatted like this:
[%Workflow Context:Current Site URL%]/_api/web/lists/GetByTitle('List Name')/Items([%Current Item:ID%])/LookupColumnNameOnOtherList
Sorry for the formatting, I would post a screenshot but I cannot.
This article is good for showing you some of the other specifics about formatting your HTTP Request, especially the Request Headers which must be setup right.
http://www.fiechter.eu/Blog/Post/37/SharePoint-2013--HTTP-Web-Service-Action---Use-Managed-Metadata-as-Text-in-Workflow

How do I list cards for a specified customer using Balanced API?

I am using PHP to try to get the card from Balanced.
I can get all the cards using
$marketplace = Balanced\Marketplace::mine();
$cards = $marketplace->cards->query()->all();
I can look though the $cards array and in each card object I find a values like this
uri : /v1/marketplaces/TEST-MP4K6K0PWGyPtXL4LZ42sQSb/cards/CC5N3HHUDrAyvhNwQOoUd3UX
this appears to be formatted as
"/v1/marketplaces/MARKETPLACE ID/cards/CARD ID"
However I only want the cards for a specific customer so I tried
$customer = Balanced\Customer::get("/v1/customers/CU6vs1tjxBtifgTuzKjCGtVS");
$cards = $customer->cards->query()->all();
Now when I look thought the card object the format of the uri has changed
uri : /v1/customers/CU6vs1tjxBtifgTuzKjCGtVS/cards/CC5N3HHUDrAyvhNwQOoUd3UX
So it gives the uri as
"/v1/customers/CUSTOMER ID/cards/CARD ID"
Question, can I use this customer based uri for all card functions such as charging and deleting?
Or, if I have to use the marketplaces format do I rebuild the URI (which balanced warns against) or is there some why I can get the uri in it's proper format?
You can use either of those uri's. They are just using different endpoints, but will result in the same successful transactions.

How to get multiple adrresses from GoogleGeocoding API?

I want to retrieve all the address locations (latitude,longitude,format address) for a single 'search address' request (a little vague such as "Tata Consultancy Services") in MapKit.
I searched on the net and came across GoogleMapsAPI WebServices .
http://code.google.com/apis/maps/documentation/geocoding/
But problem with response is that, it returns only a 'single object' in 'results array' response for a address search.
As an example if you search "Tata Consultancy Services" you get only one location whose formatted address is "TCS Rajshree Business Park, Tadiwala Rd, Sangamvadi, Pune, Maharashtra, India".My question is how can i get details of other locations as we all know that this is not the only office of TCS.
I would like to quote two documentation links related to your problem.
http://code.google.com/apis/maps/documentation/geocoding/#GeocodingRequests
"Generally, only one entry in the "results" array is returned for address lookups, though the geocoder may return several results when address queries are ambiguous".
So you may found one or more result. but as you are requesting it from iPhone and sensor is by default true. you receive nearest matching result for your query.
The solution is "Viewport Biasing".Please find its details at below link under heading name "Viewport Biasing":-
http://code.google.com/apis/maps/documentation/geocoding/#Viewports
Another options you can try on:
try setting sensor as false.
try region biasing as described on the same page cited above.
try some other word like "hotel near placename" and check the
response result