I am doing ETL and want to extract city, province from 1000s of addresses. I have tried SUBSTRING( «character_expression», «start», «length» ) transformation in SSIS but could not get the result becuase I don't know in each address, where is the start of substring and what is length of each required substring.
Following are the examples from which I want "M.D.A. ROAD" , "MULTAN" etc.
PAKISTAN COTTON GINNERS' ASSOCIATION PCGA HOUSE, M.D.A. ROAD, MULTAN
PAKISTAN CROP PROTECTION ASSOCIATION 2-A, INDUSTRIAL ESTATE ROOMY COTTON FACTORY, MULTAN
PAKISTAN AGRICULTURE & DAIRY FARMERS ASSOCIATION 16-C, PEOPLES COLONY, FAISALABAD
THE FAISALABAD CHAMBER OF COMMERCE & INDUSTRY FCCI COMPLEX, EAST, CANAL ROAD, FAISALABAD
Thanks in advance.
There's two strategies that you could use, depending whether the address structure is regular or not
Use the location of the , characters to break up the address into components
Use a lookup table of known streets and provinces to identify them in the address
Option 1 is the simplest - but relies on the address format being consistent: i.e. all components are separated by a ,, province is always the last component, city is always the second last.
You'd use the TOKEN function to break the address up by ,
For province (the last component) it would be something like:
TRIM(TOKEN([Address], ",", TOKENCOUNT([Address], ",")))
For city (the second last component), it would be:
TRIM(TOKEN([Address], ",", TOKENCOUNT([Address], ",") - 1))
Related
Using geocode api to get location data and full address details from an address string. This address string might include the property name, city and state or an actual street address. Been using for years with good results. Some buildings, particularly in cities like NY, use multiple addresses. Although the maps pin is in the same location, these equivalents return different coordinates and are not equivalent. Willis Tower, Chicago IL, is the same as 233 S Wacker Dr, Chicago, IL...but not exactly.
Queries are simple...In python...
GMAPS = googlemaps.Client(key=settings.MAPS_TOKEN)
res =GMAPS.geocode(address text string with building name or street address)
with the res, I pull out city,state,county,long,lat...
Is there a technique for identifying equivalence for buildings that have one structure, but multiple possible addresses
My requirement is as follows,
say my business product is available for sale in many stores. When user goes to find location of these stores who carry my product,
1) based on user Ip address the location should be detected (nice to have)
2) provide zip code field and let filter by distance (10mi,25mi,50mi).
fetch all business locations that carry my products by the provided zipcode.
3) I show results on map and also in following format
Costco , 10 Lawrance Exoressway, Sunnyvale CA, Hours, phone number, website
Safeway, 1500 almaden Expressway, San Jose CA, Hours, phone number, website
wholefoods , blossomhill rd, Losgatos CA, Hours, phone number, website
Any information or examples will be really appreciated Thanks
Geocode returns postal_code value null for certain addresses and I am not able to do reverse address lookup to retrieve the zip at that level.
An example address is "Peachtree Dunwoody Road, Atlanta, GA, United States"
There is no street number; Dunwoody is also a city name in vicinity. It is not happening for all two words street names, but happening only if one of the word(second one in the street name) is also a city name.
It works for most of the cases but just a few certain types ie "Peachtree Street Northwest, Atlanta, GA, United States"
The search is for "address".
geoLocationScript: "https://maps.googleapis.com/maps/api/js?",
geoLocationSensor: "sensor=false",
Is it a google glitch? and Is there any work around?
Zip codes actually only correspond to mailing routes. "Peachtree Dunwoody Road, Atlanta, GA, United States" isn't a mailing address and as such Google is trying to give you the best results it can, balancing exactness with usefulness. It's likely that "Peachtree Dunwoody Road" traverses multiple zip codes, and Google returns a pin at a geometric center for the road (try the search in Maps) but doesn't try to guess a zip code. Zip codes can be complicated and it's probably best not to make a guess unless the entire street is contained in one zip code. For instance, sometimes, the east side of a road has one zip code but the west side has a different zip code.
As for whether there is a workaround or not, I believe the answer is no. To illustrate, you might look at the SmartyStreets demo site and fill in the address components as much as possible. I just tried "Peachtree Dunwoody Road, Atlanta, GA, United States." While I was typing, SmartyStreets suggested the following three results:
Peachtree Dunwoody Rd, Atlanta GA
W Peachtree Dunwoody Rd, Atlanta GA
Peachtree Dunwoody Rd NE, Atlanta GA
Full disclosure: I worked for SmartyStreets, an address validation company.
Some location entries returned by the geocoder won't have postal_codes. The response for "Peachtree Dunwoody Road, Atlanta, GA, United States" is of type "GEOMETRIC_CENTER".
A "road" doesn't necessarily have a postal code (it isn't a postal address).
I have a list of latitude/longitude which point to some cities in England.
For each of these coordinates I want to get the region they belong to.
By region, I mean one of these: https://en.wikipedia.org/wiki/Regions_of_England
For instance: For coordinates (53.38112, -1.47008), ie. Sheffield, I need to find Yorkshire and the Humber.
To achieve this, I tried to use Google Reverse Geocoding API:
https://maps.googleapis.com/maps/api/geocode/json?latlng=53.38112,-1.47008&key=
Google then tells me that:
country is United Kingdom
administrative_area_level_1 is England, which is a State (or kind of)
administrative_area_level_2 is South Yorkshire, which is a County
administrative_area_level_3 is Sheffield District, which is a District
So Google returns me the correct State, County and District. However, Region is missing.
Is there any way to obtain it?
Looking at the documentation I don't think the Google API returns such information.
An alternative way to get round this would be to build a list of which counties belong in which of the 9 regions and then look up the region based on the county name. Obviously, this would be a bit of work on your part putting all the county names into a list.
While this doesn't directly answer your query, you could use a set of polygons which trace the regions and a point in polygon algorithm (this example is in PHP but the algorithm exists in many languages) which would allow you to check which of the regions any latitude and longitude is in
I have some markers on a map and when the user click them I use the google geocoder to get the address information. The issue is the format that Google returns this data. I want to display the address in a consistent format such as
Vancouver, British Columbia, Canada
Seattle, Washington, United States
Sydney, New South Wales, Australia
does any one know a simple way to parse this data so I end up with some nice simple json like
{"city":"Vancouver", "region":"British Columbia", "country":"Canada"}
Thanks.
Oh man, the days when I thought political geography was this simple were sweeter days. If Google could return data like this, they surely would. Instead you get a mess of locality, sublocality, administrative_area_level_*, country, etc.
To illustrate this, consider the following:
http://maps.googleapis.com/maps/api/geocode/json?address=11215&sensor=false
http://maps.googleapis.com/maps/api/geocode/json?address=10010&sensor=false
For Manhattan, you're in okay shape. You get the borough (Manhattan), the city (New York), the county (New York), and the state (New York). For Brooklyn, things aren't so clean. You get the borough (Brooklyn), the county (Kings), and the state (New York).
Now if you go a little ways out onto Long Island, you get more fun:
http://maps.googleapis.com/maps/api/geocode/json?address=40.723464,%20-73.716282&sensor=false
In this case you get the village (Floral Park), the town (Hempstead), the county (Nassau), and the state (New York), but everything is kind of muddled up.
This is the variation within 20 miles in one state. If you move out of that, you can count on even less. In the UK, what most of what we'd want to see as London, will be some smaller borough of Greater London.
Google provides a deep and rich taxonomy to deal with this variation, but you will still need to apply your own rules to make sense of it (often at the state by state and country by country level)