Incorrect work of autocomplete with Cyrillic - here-api

When sending a request to https://autocomplete.geocode.ls.hereapi.com/6.2/suggest.json?query=Вильнюс with an indication of cyrillic nothing comes and with a latin https: //autocomplete.geocode.ls.heraapi.com/6.2/suggest.json?query=Viln all is well. Tell me what the problem is or what I'm doing wrong?

You're not doing anything wrong. Autocomplete is designed to give you addresses that contain (perfectly match) your input string, and the results are sorted by relevance.
When you make your query in russian and provide only "Вильнюс" as input, the service is finding a lot of results (street names) that it considers are more relevant than the city. The city name is also found, but since the service doesn't think that this is what you're searching for, it puts the city much lower in the results list. You don't see it because you're limiting your query to give you only the first 10 matches (with the maxresults=10 parameter), but if you change the maxresults parameter to 20, for example, you will see that Vilnius appears in the 16th place of the API response.
If you want the service to better understand what is the thing you're querying for, you'll need to provide additional information. For example, if you continue typing and your input string is now "Вильнюс " (with a space at the end) or "Вильнюс Л" (a space and another letter), the service will understand what you mean and will return the result you want.
Another way of providing more information to change the way the service ranks the results is by adding a spatial filter, like the country, mapview, or prox parameters mentioned in the API Reference section of the documentation. Alternatively, the resultType parameter can help you filter out all the results with street names and return only city names, if that's what you want. These are just some options available, the one that is right for you will depend on your use case.

Related

Google places api not showing results for some places

Hello i am using simple google map places api to get near by atms for users. My client lives around new york and for some strange reason api shows zero results for that place, but works fine near me (pakistan) . I searched for it a little and found out it was google's issue and some other places were also experiencing the same problem. But i never quite found any solution for this.
This is the get call i use
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.7128,74.1059&radius=10000000&keyword=atm&key=MY_KEY
I would really appreciate the help. Thank you :)
Google place nearby search maximum 50,000 meters (31 miles) . if you try enter more than 50,000 it not work proper.
There is another way for find all ATM in a city. google provide Text Search Requests
https://maps.googleapis.com/maps/api/place/textsearch/json?query=atm+in+Reno,NV,89501,USA&key={API_KEY}
query = keyword + in + city Name
for get city name using latitude longitude
http://maps.googleapis.com/maps/api/geocode/json?latlng=39.52963,-119.81380&sensor=true
For more information how to get city name using latitude longitude
https://developers.google.com/maps/documentation/geocoding/start?csw=1#ReverseGeocoding
for more information about how to use Text Search Requests
https://developers.google.com/places/web-service/search
OR (second way)
There is another way for find all ATM in a city.
Open Google Maps .
create 10-12 or more points latitude , longitude value to trigger
request.
Then use a loop to find all places within these points.
If you want more appropriate results, increase first trigger points
for your requests.
- It is just a logic i created in php.
$triggerPoints = array("lat1,long1", "lat2,long2", "lat3,long3",....);
foreeach(triggerPoints as $tP){
$requestUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=$tP&radius=[YOUR_RADIUS_VALUE]&type=[YOUR_TYPE]&name=panera&key=[YOUR_KEY_HERE";
$results = file_get_contents($requestUrl);
//Do what you want with response JSON data
}
SHORT ANSWER: Use logical types with your needs.
In my case i used food types instead of supermarket. In some cases, my local market named A101 wasnt found under supermarkets. To find which keywords is best for you, you can search below url with your location and map_key and find most common keywords under types for each query and use it.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.986527896166244,%2029.24326049097467&rankby=distance&keyword=a101&key=YOUR_MAP_KEY

How does Google Maps decide when to use a specific icon?

I am using the Google Maps Places library to do a search for nearby hospitals, but it returns results that aren't necessary hospitals (but have 'hospital' as one of their types). However, I've noticed that actual hospitals have a hospital icon on the map, so Google must somehow know which establishments are actually hospitals. Does anyone know if the public has access to this data?
This is the icon I'm referring to: https://www.dropbox.com/s/1jfqcayxavjhlyi/Screenshot%202015-03-17%2017.20.19.png?dl=0
Example of request I'm making:
var request = {
location: self.location,
radius: 20000,
types: ['hospital'],
keyword: 'hospital'
};
Example result that isn't a hospital:
{"geometry":{"location":{"k":44.815958,"D":-68.808244}},
"icon":"http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png","id":"de6e60bd70b90ba4cb86afe149a60169553607f1",
"name":"Penobscot Community Health Center",
"opening_hours":{"open_now":true,"weekday_text":[]},
"photos":[{"height":320,"html_attributions":[],"width":320}],"place_id":"ChIJj--4INRKrkwRN0z2XkoJtVU",
"rating":3.1,
"reference":"CoQBdAAAADmf3YA0659efzMbCSPOK6SZttkfus7aWBDhrZZyX63Szl256BRcpz81LH6rIuONldYv256tsN7Zv-N6ZkOkJadlD2VS01bs7C4ierKvGUMyJOJu657xL5MvidF3Tgs9iejeJcXsxjDJYOwtN3m3sbfClfWYVnnIL4hMLYV8P9TnEhBurfJv_30CAG2wp1V73POVGhR-7fz1mCdh4OYWSa3Pw0mPupckoQ",
"scope":"GOOGLE",
"types":["hospital","pharmacy","store","health","establishment"],
"vicinity":"1012 Union Street, Bangor",
"html_attributions":[]}
My guess is there are a couple ways to get around this. You might remove the keyword argument from the API, which acts like a search term rather than a specific match on a type of location like the type field does.
You may want to be careful about your radius value choice.
Next, if you do a search on Google Maps in general you'll get a broad assortment of results. Do you need every result to be an actual hospital or can you do your own filtering afterwards?
If you do your own filtering it looks like type information and even icons are embedded in the result JSON. You might see if there's a distinguishing characteristic between the types of results you want and filter by that. Otherwise, any additional graphical data would not be accessible via the API.

Geocoder Request No Response - Fail

Is it possible to have the Geocoding API works and sometimes doesn't work for some reason?
Here is the detail what I am trying to request:
http://geocoder.cit.api.here.com/6.2/geocode.xml?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&gen=4&country=Australia&state=Tas&district=Wynyard&postalcode=7321&street=86 Jackson Street
and Here is the demo version from the official website:
http://geocoder.cit.api.here.com/6.2/geocode.xml
?app_id=DemoAppId01082013GAL
&app_code=AJKnXv84fjrb0KIHawS0Tg
&gen=7
&housenumber=425
&street=W+Randolph
&city=Chicago
I am using the Free version of it and I have no idea why it works sometimes and doesn't in other times.
Thank you
When you are making a structured address query, by default, all parts of the address need to match. Given that there is no international standard for addresses, the HERE geocoder could be placing parts of the address in an alternative part of the structure.
In your case Wynard is recognized as a city, not a district. Now it is possible you could want this to fail as an invalid address, but it is also possible to tell the Geocoder to be a little more lenient by using the FlexibleAdminValues parameter in the AdditionalData
see the User Guide here
FlexibleAdminValues
N (positive integer <= 1). Customizes flexibility in the input values
for the admin hierarchy defined in LocationFilterType. The value is a
bitmask defining which hierarchies might be swapped without impacting
the match level:
0: No swapping at all (default). Exact admin hierarchy values are
expected as input
1: City and District swapping
Please note this
option is for geocoding addresses and needs at least street level
input to work as designed. It will not return expected results when
the input is a named place only (e.g. city or district name).
So the following url will work for you provided you have a street address:
http://geocoder.cit.api.here.com/6.2/geocode.xml?app_id=APP_ID&app_code=APP_CODE&gen=7&AdditionalData=FlexibleAdminValues,1&country=Australia&state=tas&district=Wynyard&...etc
Another alternative is to not use the structured input parameters but let the HERE Geocoder sort out the identification and categorization of the input tokens.
By using the searchtext parameter and providing all your data as the input value the Geocoder can match and score the tokens.
E.g.: http://geocoder.cit.api.here.com/6.2/geocode.xml?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&gen=7&searchtext=Australia%20Tas%20Wynyard%207321%2086%20Jackson%20Street

Using filters to track hits for multiple URLs

We have a large website that is split up into groups of organisations with a number of micro-sites. We would like to provide one organisation within a group with their own set of data and I am having troubling getting the filtering working.
I think my main problem is I have 2 include filters. According to the documentation:
"If you apply multiple Include Filters, the hit must match every applied Include Filter in order to save the hit."
Our website urls would go something like this: https://[host]/[group]/[site]/[params]. I would like to track the following, given that this client (id 9) is in group "foo":
https://mysite.com/foo/live/default.aspx?id=9
https://mysite.com/foo/live/?id=9
https://mysite.com/foo/reporting/9/*
so that any hits on those urls would be captured for this particular client.
Our 2 current filters (type="Include") are as follows:
/foo/Reporting/9/
/foo/[^\?]*\?id=9
but these do not seem to track everything we think they should. Any help would be much appreciated.
By the time the first filter is done there is nothing left for the second filter to match - the first filter throws everything away that does not match (that's what Google means by "the hit must match every applied Include Filter").
I would suggest you first use an advanced filter to transform your urls so they follow all the same pattern (i.e. grab the value from the query parameter and append it to the url path) and then apply the include filter. I'm pretty certain that would be easier than trying to include different url structures (if you need help with the filters holler away in the comments, but the example given in the advanced filters interface should give you a clue how this works).

DBpedia : Get list of Chinese universities and their adresses to populate google map?

I'm trying to get list of Chinese universities and their adresses. The minimum being the City/Town name. I will use these addresses to populate a googlemap, fiddle here.
I saw interesting code such as:
SELECT ?resource ?value
WHERE {
?resource a <http://dbpedia.org/class/yago/CitiesAndTownsInDenmark> .
?resource <http://dbpedia.org/property/populationTotal> ?value .
FILTER (?value > 100000)
}
ORDER BY ?resource ?value
Since CitiesAndTownsInChina doesn't work,
1. Where to find the exact name of the class I'am targeting ? and
2. Where to find dbpedia's operators manual ?
Note: I'am a very active user on Wikipedia, I'am well aware of all the data available there, but the dbpedia ontology/syntaxe/keywords is quite hard to get.
Personal note: queries on http://dbpedia.org/snorql/ , http://dbpedia.org/sparql/ , http://querybuilder.dbpedia.org/
(Expanding on my reply to How to find cities with more than X population in a certain country)
CitiesAndTownsInDenmark exists because people use the category http://en.wikipedia.org/wiki/Category:Cities_and_towns_in_Denmark in wikipedia. Wikipedia categories are pretty loose and as a result there's a lot of variation in style, so even if a useful category exists the name may not be guessable.
In addition categories are maintained manually, and may not be consistently applied.
A good place to start is looking at the data. Visiting http://dbpedia.org/page/Beijing I see yago:MetropolitanAreasOfChina which seems promising, but if you follow that link you'll see it's not well populated.
As a consequence avoid relying on the existence of such categories and directly querying for populated places in a country. This information comes from wikipedia infoboxes, and they're much more consistent than categories. Taking Beijing as an exemplar again I found:
select ?s {
?s a <http://dbpedia.org/ontology/PopulatedPlace> ;
<http://dbpedia.org/ontology/country> <http://dbpedia.org/resource/China>
}
(The relevant properties and values for my query were found by copying link location in the Beijing page)
with the result:
"http://dbpedia.org/resource/Hulunbuir"
"http://dbpedia.org/resource/Guangzhou"
"http://dbpedia.org/resource/Chongqing"
"http://dbpedia.org/resource/Kuqa_County"
"http://dbpedia.org/resource/Changzhou"
... nearly 3000 results ...
You'll notice that position is encoded multiple times (geo:lat and long, georss:point, various dbpprop:latd longd things), and there seem to be two values excitingly. You can either simply deal with the multiple values in whichever format you prefer, or try picking just one using GROUP BY and SAMPLE.
As for a manual, almost everything I know of are academic papers, and not very useful. However the data is reasonably self documenting.
for your first question:
you can see possible classes by querying one member of your intended set of entities (ex: Shanghai).
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?type WHERE {
<http://dbpedia.org/resource/Shanghai> rdf:type ?type.
FILTER regex(str(?type), ".*China", "i").
} LIMIT 100
which gives this result:
dbpedia:class/yago/MetropolitanAreasOfChina [http]
dbpedia:class/yago/PortCitiesAndTownsInChina [http]
dbpedia:class/yago/MunicipalitiesOfThePeople'sRepuBlicOfChina [http]
dbpedia:class/yago/PopulatedCoastalPlacesInChina [http]
they are CamelCase versions of the categories that you will find at the bottom of wikipedia pages. I was fooled for a while by the erroneous capitalization of RepuBlic and finally saw that it contains only 4 cities, so it is of limited use for you.
so I would propose to go with #user205512 answer and get the cities by linking 2 properties.
for your second question:
I would advice you to search/ask on http://answers.semanticweb.com

Resources