google matrix api zip code origin address change automatically - google-distancematrix-api

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=53022,DC&destinations=35210&key=xxx
origin changes to 53170
what to do to fix it.

So, I recreated your issue and found that it does change to 53170 but I also see that it refers to an location in france.
But when I specify in both origin and destination the country:
origins=53022, USA
destinations=35210, USA
this is what i get:
"destination_addresses":[
"Birmingham, AL 35210, USA"
],
"origin_addresses":[
"Germantown, WI 53022, USA"]
even thou the numbers stays correct I see that is not in DC.
My advice is the more specific your addresses are, the better results from google you will have, your query is no very specific so google try to make sense of it to its own way and give you thouse results.
Happy Coding :)

Related

GoogleMaps Autocomplete (Places API)

I am trying to fetch airports using the Places API autocomplete feature.
Looking at the types parameter, if this is an airport I display the result or else show it as no airports found.
I want to enhance this app, I want to show terminals within each Airport object that I display on the front end.
I have found the nearby search within places API but it is difficult to create a search query using keyword, and type to get exact results for all the airports around the world.
Does anyone have any idea as to what would be the best way to get airports and their terminals using the Places API?
Well I'm not sure if this is really your expected result but here's what I tried:
Get the placeId of an airport using Place Autocomplete.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=dublin&radius=500&types=airport&key=API_KEY
Then use that placeId to do a Place Details request and get the coordinates of the airport.
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJLxmTab4RZ0gRVfMlt7UbElU&key=API_KEY
This also returns an overview of the airport wherein in this case the result says: "
"Airport with 2 runways, a 2nd terminal opened in 2010 plus buses into Dublin & other towns/cities."
Then after having the coordinates, I use that to do a Nearby Search request.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?keyword=terminal&location=53.42644809999999,-6.249909799999999&radius=10000&key=API_KEY
This managed to get the terminals around it, I just threw in some radius but I guess it should be different on other locations. I also tried this with other Airports and it somehow worked.
If this won't work for your use case. Another thing I think you could do is to store the coordinates of known airports (Please note that coordinates/placeID are the only thing that is allowed for us to store/cache. Please see Specific Terms). And create an object which also stores the coordinate of their corresponding terminals. This would be an extensive work if you want to do this with airports all around the world.
Hope this helps.

Street Bearing from Google API?

Kind of what it says on the tin: is there an API method, anywhere in the Google Maps/Directions/Geocoding APIs, that gives the bearing of a street relative to north when given a PlaceID? I've already tried maps/api/place/details, but it doesn't seem to contain the information I want.
I hope this will help you.
Try this:
https://maps.googleapis.com/maps/api/directions/json?origin=Disneyland&destination=Universal+Studios+Hollywood4&

linkedin api company search results for location

I can't seem to find this in the documentation, its probably there, I just can't see it.
I make a request like below, but I want to limit the results to a geographical region. Is there a query parameter I can use to do this? Something like location={something}?
https://api.linkedin.com/v1/company-search:(facets,companies:(name,description,square-logo-url,website-url))?keywords=something&oauth2_access_token=xxxxxxx&format=json
I worked it out.
https://api.linkedin.com/v1/company-search:(facets,companies:(name,description,square-logo-url,website-url,locations))?oauth2_access_token=xxxxxxx&keywords=company+name&facet=location%2Cau%3A0&count=1&format=json
(you can remove the count=1 that was for my purposes)
so basically you would need to use an encoded geographical location code
so in my URl I'm targeting Australia which is au:0 or us:0 for the US.
You can also target a geographical location by changing the 0 to another number you can most of these numbers from here. So us:84 would be the San Francisco Bay Area.

Extract relevant address from string?

I am developing an address matching application using Google geocoding API.
The problem is that some of the addresses in the database I am trying to validate are something like:
ATTN: Mr. THOMAS WONG 2457 Yonge St., Toronto, ON, N2S 2V5, Canada
rather than
2457 Yonge St., Toronto, ON, N2S 2V5, Canada
The first string returns null results (because it starts with a person's name), the second one will validate and return a full correct address.
My question is: What would be the right approach to this issue?
I am thinking of a way to extract only the relevant part from the address string (with some function) but maybe there are better ideas?
Thank you,
M.R.
I work at SmartyStreets and wrote the address extractor which we now offer with LiveAddress API. It's hard. There are a lot of assumptions you need to force yourself not to make, including "if the address starts with a number." (Sorry DwB -- there's a lot to consider.)
If you have US addresses, you may still find our tool useful (it's free to sign up and use, to a point). Here's another Stack Overflow post about the extraction utility: https://stackoverflow.com/a/16448034/1048862
The best way to do this would be to use an address validation service -- one that can validate delivery points and not just address ranges (which is most common, so be wary of claims to "address validation" when it's really just guessing within certain bounds).
Be aware, too, that Google does not validate addresses. It may standardize them, and will return results where the address would exist if it were real, and if it is actually valid, it's your lucky day.
If the desired part of the address always starts with a number, try this:
find the first digit in the string.
get a substring from the first digit to the end of the string.
you now have the address.
In order to parse addresses, you need to know all possible formats.
Do you need to include:
Santa, North Pole.
The Queen, Great Britian
Captian Hootberry
Bob Goldenberry, rural route 7, MN
Jackie Blam, P.O. Box 78, Hootville, OH
For a comprehensive address parsing solution, you will need to provide several algorithms for different address formats then determine which algorithm to use based on the input.

Script for the USPS

I am trying to write a script that does a zip code look up at the USPS.
URL="http://zip4.usps.com/zip4/citytown_zip.jsp". The data gets submitted by POST is:
zip5=YOURZIPCODE&submit.x=3&submit.y=22&submit=Find+ZIP+Code
The part I am having a hard time finding is how these numbers get generated:
submit.x=3
submit.y=22
The above two always "submit" values for X and Y always change. I can figure out
those number get put into the string.
Any thoughts would be greatly appreciated.
Those are the coordinates for a image-button click. Their values just give the mouse position on the button when it was clicked. In this case, they are going to be meaningless, just make them both 1 or something.
"Users may view and download material from this site only for the following purposes: (a) for personal, non-commercial home use"
http://www.usps.com/homearea/docs/termsofuse.htm?from=global_footer&page=termsofuse
From the link above.
As the first answer says, that is just the USPS trying to keep anyone from building an automated script to access data through that form. They expect slightly different numbers for each request from a given IP address.
"when you can prevent someone from doing something, you can get paid to allow them to get things done"
Just put in random numbers between 1 and the max size of the image button and it will work.
And I would not bother trying to do it "legally", their legal terms make no sense:
http://techref.massmind.org/techref/ecommerce/shipAPIlegal.htm also see the "Shipping" link in the heading for that page.

Resources