if I look up this address:
Maanweg 174, 2500 BD The Hague, Nederlands
google maps finds it perfectly. if I look it up this way:
Maanweg 174, The Hague, Nederlands 2500 BD
It does not, because the postal code is out of place.
Now my question: I have 4 fields: Address, City/Region, Country and Postal Code. if the user starts to type the address, a lookup on google maps comes up with a list of addresses the user can pick from. I break the user selection appart and fill-in my 4 fields.
However... if the user changes some part of the address, I need to reconstitute it into a string to feed it to google... but I don't know the proper order. in the Netherlands, the postal code goes after the address. in the US it goes at the end, right before the country.
how can I find out what the proper order is?
There is no unique format, you should use the format as it will be used in the particular country (see: https://developers.google.com/maps/faq#geocoder_queryformat )
According to http://www.bitboost.com/ref/international-address-formats/netherlands/ the order of the first example is correct(for the Netherlands).
Related
I have a google sheet where it will record payment done in paypal. So basically the users will enter address in all way, so to reduce the errors I have all the possible address the user might enter (This is because this is a payment system for residents in my residential area so I have all the user's address in database). So can anyone help me to find a formula it will find the actual address in "USERNAMES" worksheet and only take the house number and street from the actual data. I have attached some images to explain myself better. I want the formula to be in worksheet "Paypal 2". Please guys I need this help.
https://docs.google.com/spreadsheets/d/1bM8l6JefFsPrlJnTWf56wOhnuSjdIwg3hMbY1tN1Zp8/edit#gid=0 - Link to my google sheets
The address entered by users
The sheet to look up for the actual address
Sheet to split the house number and street
Try this:
Delete your formulas from 'Payment Configuration'!B3:C3. (This will temporarily remove all results from B3:C.
Place the following formula into cell B3:
=ARRAYFORMULA(IF(LEN(PaypalData1!C3:C),PROPER(REGEXEXTRACT(PaypalData1!L3:L, "(\d+)[,\s]+([^,]+\d+)")),))
REGEXEXTRACT allows for extracting more than one grouping, as I've done with this formula; so this should produce a uniform result for B3:C.
The RE2 expression reads "Find the first number(s) followed by any number of commas or spaces and extract the number portion as group one; then find any string after that which does not contain a comma and ends in any number of digits and extract that as group two."
Is there any way to retrieve different levels of placeIds from a specific placeId? Like when you load the address components of a place, you get 'country' 'city' 'region' and so on... But you only get the names of the different levels of position. Is it possible to get the placeId of the country, city.... ?
When I am storing data in the database, I need to also store the country placeId, city placeId together with the original placeId. Do not want to store the name of the places in the database, when a lot of places have the same names.
As you noticed there are no place IDs in address components array. You cannot get this information executing only place details request. Developers have already created a feature request in Google issue tracker:
Add place_id in each address_components
You can star it to add your vote. In the meantime the workaround to get place IDs for country and locality consists in executing a reverse geocoding requests for coordinates of the original place ID with result type locality and country.
For example, I have a place ID ChIJEygrJmSYpBIRUXOjvF0QSLw. The details request for this place
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJEygrJmSYpBIRUXOjvF0QSLw&key=MY_API_KEY
gives coordinates 41.3886875,2.130554. Now I can execute additional reverse geocoding request to get place IDs of locality and country:
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.3886875%2C2.130554&result_type=country%7Clocality&key=MY_API_KEY
The last one gives me
place ID ChIJ5TCOcRaYpBIRCmZHTz37sEQ (Barcelona)
place ID ChIJi7xhMnjjQgwR7KNoB5Qs7KY (Spain)
I hope this helps!
I have a site that validates zip codes. If a user types in a zip code I store the formatted address, lat, long, etc. If they go back in to edit the form the next day, I set the field to the formatted address and revalidate. The problem is not all formatted addresses return the zip the second time - even though I'm passing it in to the query.
-- RETURNS FORMATTED ADDRESS: Woodland, CA 95776, USA
https://maps.googleapis.com/maps/api/geocode/json?address=95776&key=
-- DOESN'T RETURN A POSTAL CODE - GIVES APPROXIMATE EVEN THOUGH I'M PASSING IT IN
https://maps.googleapis.com/maps/api/geocode/json?address=Woodland, CA 95776, USA&key=
-- RETURNS POSTAL CODE AS EXPECTED, EVEN THOUGH LENEXA, HAS MULTIPLE POSTAL CODES
/maps/api/geocode/json?address=Lenexa, KS 66227, USA&key=
I would suggest storing the place ID instead of the address string. This is recommended by Google:
https://developers.google.com/places/web-service/place-id#save-id
So the first time you execute
https://maps.googleapis.com/maps/api/geocode/json?address=95776&key=YOUR_API_KEY
and store the resulting place ID ChIJARdFFWLRhIARK6RIUxEbJ30.
The next time you should execute the place ID lookup to get exactly the same result as the original request
https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJARdFFWLRhIARK6RIUxEbJ30&key=YOUR_API_KEY
Hi I am using an API from Postcode Anywhere, the idea being to add a company by searching by postcode to select the address, this is pretty standard and the code works fine.
Just some background info, PAW works in two stages, 1 the post code search criteria is sent off to their services, which returns an array of possible addresses, you then select the address you want, and in stage 2, the full PAF file for that ID is returned and stored to the table.
The problem I am having is that the array they send includes an Address Field which includes house number and street address in one field, making it difficult to sort alphanumerically.
This is the sample data I have in my table:
and this is how it looks in my application:
As you can see it is not ideal and I have no control on how they send the data.
Does anyone have any ideas on how I can search a string based on numbers that can be 1, 11, 2, instead of 01, 02, 03, etc, or at the very least be able to split this into two rows. Also please note, that it most cases, the post code search will result business/property names as well as house numbers, as seen in this example.
Any thoughts would be greatly appreciated.
Have you considered using a different API provider for the data, Allies Computing (who I work for) have a single step API, where the initial postcode search returns all fields in the response. It also orders these results by premise number/name.
Give it a try here - https://developers.alliescomputing.com/postcoder-web-api/address-lookup/premise
There are also other providers of PAF data that do it this way such as Crafty Clicks and Ideal Postcodes.
It might also be worth checking the PAF license with your provider to ensure you comply with that too.
I have a Fusion Tables table containing location data for all of the Congressional Districts in Minnesota here.
I want to have a user enter her address, have the Google Maps API geocode it, and spit out the district in which she lives from the table.
I had hoped I could just pick the closest district by using orderBy: ST_DISTANCE in the query. However, this doesn't always return the district the address is actually located in. For example: http://jsfiddle.net/2vGSB/
Assuming it's even possible, how might I return the district that a set of coordinates is located inside of?
EDIT
After digging through the documentation a bit, I found where: ST_INTERSECTS. It appears to be doing what I need: http://jsfiddle.net/DY49c/