Some postcode searches returning inaccurate results - here-api

I'm using the Here Geocoder API using free-form input and getting random results when searching for postcodes in the Isle of Man.
I haven't tried all postcodes but the couple I have tested (from customer complaints) do appear to have a problem.
You can test the postcodes on the examples page and see the response yourself - https://developer.here.com/api-explorer/rest/geocoder
When searching for the postcode IM4 4LH the response returns an address for IP4 4LH but if you search for IM4 4 you get the right general area.
Another example is if you search for IM5 1HD you get the right response but if you search for IM51HD you instead get a response with IP5 1HD as the postcode.
IM4 4LH & IM5 1HD are legitimate postcode areas so I was wondering if there is something else we can do to more accurately target postcodes.
I know results could be more accurate with more search data but I would have thought a postcode on it's own would be more than enough.
Any help would be appreciated.
Thanks,
Jason

In the core map for United Kingdom and for Isle of Man only sector postal codes are available. E.g. " IM5 1".
The Geocoder additionally uses an extra product which provides the full postal codes (seven digits). Until last quarter they were covering only United Kingdom. E.g. postal code " IP5 1HD" is coming from these products.
Starting from this quarter it will cover also Isle of Man. This still need to be integrated into the Geocoder database. As soon as we are done, full postal codes will also be available for Isle of Man.
We work on it but cannot yet commit on a timeline.

Related

How to transform geocode to real address in R

I used the twitteR package to extract data from Twitter API, and now I try to filter data by country name.
Most geocode packages are designed for inputting the real address and returning the corresponding geocode, but my needs are just the opposite.
For example, when I input c(38.897957, -77.036560), the result is "Whitehouse, D.C., U.S."
I ran into the revgeo package which performs Reverse Geocoding with the Photon Geocoder for OpenStreetMap,Google Maps, and Bing .
By default it uses photon which provides free data.
I'm using the example from the package itself.
require(revgeo)
revgeo(longitude=-77.0229529, latitude=38.89283435)
#"700 Pennsylvania Avenue Northwest, City Not Found, Washington, D.C., 20004, United States of America"
You can give it a try.
This blog below does mention that some locations are missing form their dataset, and it throttles down the speed after certain number of queries. There are other good pointers at the blog. https://towardsdatascience.com/reverse-geocoding-in-r-f7fe4b908355

Here maps geocode wrong postal codes for Israel

I've just started checking the Here Geocode API and it looks really nice, although I experience an issue with postal codes for Israel: instead of 7-digits codes, it returns only 5 digits.
Tried it via REST:
https://geocoder.api.here.com/6.2/geocode.json?app_id=YOUR_APP_ID&app_code=YOUR_APP_CODE&searchtext=הרצל+50+חיפה
returns postal code 33211
while the actual postal code, according to Israel Post website is 3321103
Is this the API problem or do I miss something?
HERE Map currently supports postal codes for Israel is 5 digits.
So the response postal code of geocoder API for Israel will be return only 5 digits.

bbox not restrict search results

I'm reviewing HERE API, and I can't figure this issue:
I'm interesting in Geocoder API, and I tried the following query:
http://geocoder.cit.api.here.com/6.2/geocode.json?
&app_id=***
&app_code=***
&searchtext=london
&bbox=41.9085286,-87.6762943;41.8682739,-87.6041965
&gen=8
The bonding box I defined is around Chicago USA, so I expect to get no results.
But the response contains London information and I cant figure why.
I read in this question that If I use the landmark request the bbox is not always taken into consideration.
But here i'm using geocode requirest.
The geocoder does include prominent results (like London in this case) in the response in case of bbox, maybe you can use country as an additional filter ?

Retrieving all the possible postal codes with only the street name and country (Germany)

Trying to build a dialog with a single text box where a user can (among others) enter just a street name in Germany, and the dialog should then display a list of all the postal codes (PLZ) possible for that street name in the whole of Germany. So basically I would need a list of all the PLZ + street name combinations in Germany ordered by streets in bigger cities first (or bigger streets first, if possible). I Have tried several different HERE APIs, but cannot yield any results when doing a search with only the street name, with country set to Germany. If I additionally fill in the city (streetname + city), then I get a nice response with all I need. So is there any way to get results for queries containing only street name and country (where country='DEU'), and without any city? The search would need to be location agnostic, only assumption being that the user is in Germany.
This kind of minimalistic search seems to work at here.com map site. The only problem on the here.com site is that it's locating me on a wrong city, and thus the 3 results it's giving me are not really relevant for my location. For instance, I'm in Berlin and here.com locates me in Leipzig, and I'm searching with "Chausseestr.".
Any thoughts if an address search with only the street name and country is feasible?
Thanks!
This looks like a structured Geocoding request, but unfortunately a street only geocoding request is too broad to return a valid response. Neither does a request combining street with country. Your best bet here would be to split Germany up into a series of non-overlapping bounding box geocoding requests covering say the north-east, north-west and south of the country and to amalgamate the results.
This request looks for 'Hauptstrasse' in Eastern Germany and returns up to 100 post codes only
http://geocoder.cit.api.here.com/6.2/geocode.json?street=hauptstrasse&responseattributes=none&locationattributes=none,ar&app_id=APP_ID&app_code=APP_CODE&gen=3&addressattributes=none,pst&country=deu&mapview=LAT,LONG;LAT,LONG&maxresults=100
street sets the street name to look for,
country=deu restricts the results to Germany
responseattributes=none removes confidence meta info from the response
locationattributes=none,ar restricts the responses to address only
addressattributes=none,pst restricts the addresses to post code only
mapview defines the limit of the bounding box of the request.
maxresults=100 ensures up to 100 results are returned.
Repeat this with Western Germany, Southern Germany and so on.
What works for here.com, and may work for your dialog box, is to use the suggestion end point from the places api. Try making a series of suggestion requests as the text box is filled setting the X-Map-Viewport to cover Germany :
http://places.cit.api.here.com/places/v1/suggest?X-Map-Viewport=LNG,LAT,LNG,LAT&q=haupt&app_id=APP_ID&app_code=APP_CODE&accept=application/json&size=100
There is even a ready made JavaScript component which could do this.
have you considered just try the geocoding ? and not taking just the first result, I would suppose this is what you see on the service example you are refering to. Thus do actually loop through all of replies. Of course see the API you are using, and make sure you are setting some nice number for the max results before doing any queries.
At least in some HERE offerings the reply data also includes address, thus you could fetch the postal code from there.
Also if it is not there, then do revercegeo query with the location gotten, then at least you should be getting it
Never too late to answer such a question.
Install QGIS (free).
Then "Plugins" -> "Manage and install plugins..." -> install "OSMDownloader"
Then "Vector" -> "Openstreetmap" -> "Download data" after you've zoomed into the area of interest
When you have the .xml file, use simple unix command line utils to slice and dice accordingly.
Quick hack (bit of a caveman solution but worked for me):
$ grep -A1 'addr:post' OSM_input.xml | egrep -v '^--$' | sed 'N;s/\n/ /' | grep 'addr:street' | awk -F'v="' '{print$2"#"$3}' | sed 's/"\/> <tag k="addr:street" //' | sed 's/"\/>/,/' > output.txt
The output.txt will contain a mostly accurate (needs some manual cleanup) file whose format is: zipcode#streetname (one per line).

Where to get geography data?

I need geography data for new website.
Data required is
States (With names and standard abbreviations)
ZipCode (List of zip code with all available data like where zipcode belongs to)
What would be my best source to get this data?
Any help is appreciated.
Thanks for all answers,
Sorry i went offline for fewdays. Yes i am talking about US zipcode data.
I think postal service data most reliable I will go with that.
Other alternative mentioned has similar and in better format data. but i think going with postal service will be the best option
(US assumed, "zip code" sort of implies the US 5-digit code, whereas "postal code" is the generic term)
States and their abbreviations are easy, it's on the Postal Service website. (including Guam & other parts of the US that aren't states)
Zip codes: the Postal Service would be the authority in question, but it looks like they don't offer the basic database of zipcode <-> town, other than through an interactive one-by-one lookup. They do offer street-level zipcode databases and other information for $ale. However the Census Bureau has a nearly identical set of information available. (ZCTA = ZIP Code Tabulation Areas) This has also been prepackaged more easily in a Sourceforge project (in their forum they claim this is from the Census Bureau data).
For postal codes Maxmind Free Postalcode Database is the most comprehensive freely available list I know of.
For a list of countries with names and ISO ALPHA-3 codes see Countries or areas, codes and abbreviations.
Of course there is Wikipedia with a list and some pointers to other useful resources Wikipedia - List of Countries
Here's a torrent that might help: http://www.mininova.org/tor/761374
I believe it's legal since it's just geographic data that's publicly available. Also, if you're looking for an access database: http://databases.about.com/od/access/a/zipcodedatabase.htm
For what country? Australia Post has a downloadable file with all the data you're after here. Seems like the sort of thing postal services in other countries would also provide.
Edit: was just listening to .NET Rocks no. 437 and Bob Beauchemin mentions most of this data is available at census.gov
I assume you're talking about the US (if you need states and zip codes...).
The TIGER/Line data is freely available. Not sure if it includes zip codes etc, but worth a look, since it's in the public domain.
Or you can check data.geocomm.com. I don't know what the exact legal status of that is though.

Resources