Query with structured data on the HERE API suggest endpoint - here-api

I am currently developing an auto-suggest adress-input form. The flow will be quite classical, so consumers enters first the postal code and get suggestion of the city connected to the postal code which will be inserted into a second input field
After this the consumer should enter the street into a third field.
By this I have country, postalcode and city as seperate values. Is there any way of sending those data points as structured data into the suggest API?
Querying for Germany+Berlin+10405+P results in the correct suggestions of streets starting with P in the postalcode area 10405 but also contains one entry for a completly wrong postal code area:
"address": {
"country": "Germany",
"state": "Berlin",
"county": "Berlin",
"city": "Berlin",
"district": "Kreuzberg",
"street": "Puttkamerstraße",
"postalCode": "10969"
},

Geocoder API will list all possible combination for the search text present in search critera. Hence it is returning Puttkamerstraße, by ignoring 10969. You can apply filtering the result criteria while rendering though.

Related

Get country, county and street name from layers

currently we fetch the address information from reverse.geocoder but we are also using rme and pde so i was wondering if I can everything without reverse geocoder call?
What we need at the end is
STREET NAME, COUNTY, COUNTRY
Country and street name we have, but the county (federal state name) is only an id in ROAD_ADMIN_FC. Is there a way to map it to a name?
Geocoder API is the best to get street, county and country information all in one query. But depending on your usecase, you can also check out ROAD_NAME_FC* and ROAD_ADMIN_NAMES_FC* to get these information. Refer tcs.ext.here.com/pde/layers?region=WEU&release=18135&url_root=pde.api.here.com to check the responses you can get from these PDE layers.

Geocode searchText with State and Country provided shows results outside of State

When using the Nokia Here Geocoding Service the State parameter is ignored when searching by searchText: 315 NE 14th Street, State: FL and Country: US.
The only result returned is a location in Louisiana. Adding the State to the end of the searchText doesn't work either.
Google and MapQuest properly return the result in Florida. The client does not want to include a city but rather an address, state and country.
I know that the Nokia Here algorithm does not filter down a closely as Google and MapQuest but expected that the inclusion of the State parameter would force the result search.
You can try setting a search area, so you can further narrow down the results. The following Android example will return one result in Homestead, Florida City:
String query = "315 NE 14th Street Florida US";
GeocodeRequest geocodeRequest = new GeocodeRequest(query);
GeoCoordinate areaCenterCoordinate = new GeoCoordinate(27.82353, -81.760254);
geocodeRequest.setSearchArea(areaCenterCoordinate , 15000);
According to documentation GeocodeRequest processes text string queries, so I believe you can omit state or country parameters and add state or country as part of the search term. Please note that multiple results can be returned if they all match to the given search term.
An example on how to use GeoCoder can be found here.
Depending on your use case, maybe consider to use SearchRequest instead. If this does not help it would be great if you can provide more details in your question, e.g. what API flavor you are referring to.

Is it possible to get consistent address_components data from the geocoder API?

I'm using this:
geocoder.geocode( geoRequest, function(results, status) {
...
...
}
The problem is that the data returned from the geocoder seems to be inconsistent. It is probably worth mentioning that when I load the js file for the maps API before calling the geocoder, I specify the language, (and that I also specify the country (e.g.: AU for australia) in the variable geoRequest in the geocoder.geocode call).
To make it simpler for others to see what I try to understand we can just use this URL:
http://maps.googleapis.com/maps/api/geocode/json?components=country:AU&language=en&address=darwin
The interesting parts in the result is that this request returnes these address_components long_name:
Australia
Northern Territory (short_name=NT)
Darwin
If I include "briggs street" in the search so I get this url:
http://maps.googleapis.com/maps/api/geocode/json?components=country:AU&language=en&address=briggs+street,darwin
then I get these address_components long_name:
Australia
Northern Territory (short_name=NT)
Darwin Municipality
Darwin City
Briggs Street
My questions:
Why is "Darwin" not returned in the second example where I search for "briggs street,darwin"? In this case the text is:
Darwin Municipality
Darwin City
Is it possible to inform the geocoder API that I want consistent hierarcical results returned, both with and without specifying e.g. a road?
The reason I'm asking is that I want to gather som statistical information, based on user specified locations, either by entering a name of a city, or a street. I hope to be able to use the returned component_addresses to build at database with other information from the client (user).
But the statistics reports will not be very consistent if e.g. one want to see some statistics for Darwin (those registered by users only entering "darwin"), since the data entered by a user entering "briggs street,darwin" will not get the data stored below the location "Darwin" (as for the first user) - since "Darwin" is different from "Darwin City" and "Darwin Minicipality".
Similar inconsistency can be observed searching for "fulton street,brooklyn" and "brooklyn"
This search for brooklyn:
?components=country:US&address=brooklyn
returns:
USA
New York (short_name=NY)
Kings County
New York
Brooklyn
But... this search for "fulton+street,brooklyn":
?components=country:US&address=fulton+street,brooklyn
returns:
USA
New York (short_name=NY)
Kings County
Brooklyn
Fulton Street
Why is there no "New York" between "Kings County" and "Brooklyn" in the last result above? Again... there seem to bee some inconsistency.
Here is another example, now for Denmark:
A search for odense:
http://maps.googleapis.com/maps/api/geocode/json?components=country:DK&language=en&address=odense
gives me this result:
Denmark
Region Syddanmark (administrative_area_level_1)
[...]
If I search for the street ryttergade in odense, like this:
http://maps.googleapis.com/maps/api/geocode/json?components=country:DK&language=en&address=ryttergade,odense
then the region "Region Syddanmark" (administrative_area_level_1) is not in the resultset. Why is it so?
Is there a way to inform the geocoder that I do want administrative_area_level_1 returned in resultsets where e.g. street name is included?
You can get them by reverse geocoding latlngs, but not always by geocoding street-level addresses.
Darwin
address=Darwin returns a colloquial city, which is different from the "Darwin City" you get address=briggs+street,darwin. Colloquial cities are marked with "types": ["colloquial_area", "locality", "political"] instead of "types" : ["locality", "political"]
The (non colloquial) of "Darwin City" is contained by the "Darwin Municipality", while the colloquial city of "Darwin" is not. The latter is only contained by the next (greater) political division, "Northern Territory", which also contains the "Darwin Municipality". This explains the components you see.
Brooklyn
Brooklyn and a few other parts of New York City are a bit special. There, the name of the city (New York) is not relevant for postal addresses. This is why street-level addresses are not supposed to have the locality, and so is address_components
Odense
Same as in Brooklyn, except that this seems to be the case in the entire country: the administrative_area_level_1 component doesn't show up because it's not relevant for street-level addresses.

Get city and street name for a link from PDE

In the project I am working on, I need to get the address of a link(street, city, postcode, country) for links returned from RME.
For the postcode and country, I can get the tileXY and level from index resource, and then use the ROAD_ADMIN_FC3 layer from the tile resource. But I couldnt find a way to find city and street.
How can I get the city and street name of a link from PDE while having only the link ID?
Note: I prefer not to use the routing api.
The Layer ROAD_GEOM_FC3 should give you the road name and ROAD_ADMIN_FC3 contains ADMIN_PLACE_IDS, this along with ADMIN_PLACE_1, ADMIN_PLACE_2 should give you city details.

How to extract Companies per country from Freebase

I am new to Freebase. I am trying to extract all companies per country (The Head Quarter's country). The simplest approach I thought was to list them all and filter by country such as this test
[{
"name": null,
"type": "/organization/organization",
"/location/location/containedby": "Japan",
"limit": 4
}]
The problem is that I get schools as well. It is not very clear unlike DBpedia that has a class called "Company", how one can find distinguish the companies in Freebase while there is no clear type for it? I thought the organization/organization domain will do but it is too general also there is Business domain.
Why not use /business/business_operation or /business/consumer_company or some other more appropriate type if /organization/organization is too broad?
A bigger issue with your query is that it is only going to find entities contained directly in Japan, not those contained in all locations contained by Japan (e.g. prefectures, cities, etc). You may want to investigate using the Freebase Search API instead of MQL since I think it will compute the closure for you (or do radius searches). Alternatively, you'll probably need to run a few variations of you query with different levels of location nesting.
Here are some example search queries/filters:
https://developers.google.com/freebase/v1/search-output
restaurants near SF Ferry building - filter=(all type:restaurant (within radius:1000ft lon:-122.39 lat:37.7955))
https://developers.google.com/freebase/v1/search-cookbook
Japanese volcanos - filter: (all category:volcano (any part_of:japan))

Resources