Mapbox Geocoder ignores country - geocoding

I'm trying to implement Geocoding with Mapbox. To get better results I want to limit my search to one country. I found this guide on how to do that.
But unfortunatly when I do it in my code:
$(document).on('keyup', "#place",
function() {
var text = $(this).val();
if (text.length >= 5) {
geocoder.query({query:text, country:'de'}, setMap());
}
it seems to ignore the country-options and searches worldwide...
Check out this minimal Jsfiddle.
Can anyone please help me?

A wrote the Mapbox Support Team. Unfortunatly limitation by country is not (yet) support via geocode.query.
But you can use country limited search via the API.

Related

I need assistance for api-here geocoding

I would like to know how to obtain all London postal codes that start with "W2", for example, something like this. We are using the geocode api but in the postalCode parameter it asks for the exact postal code. We have also tried to use the autocomplete api but I also do not get a list of all the postal codes, it does a search in different parameters and it is not what we need.
This need arises because we are changing from MapServer to Nokia Here and with MapServer the api geocoding if it returns a list of all the postal codes
We are using something like this https://autocomplete.geocoder.api.here.com/6.2/suggest.json?app_id=xxxxxx&app_code=xxxxxxx&query=W2&country=GBR
We would need to be able to indicate in the query a complete or partial postal code
this example verifies what we need
By the way, we are using a payment license, how can I request this assistance?
You can constraint search result upto maximum 20 using geocoding autocomplete API with the below parameter
maxresults = { Valid range: 1 to 20 }
This constraint is as per API design. For detail information kindly go through the below link.
https://developer.here.com/documentation/geocoder-autocomplete/topics/resource-suggest.html

Mapbox Geocoding language

The Mapbox API supports geocoding requests fine, but I always get the results in English. I'd like to be able to get results in a specific language.
For the Mapbox.js API, it's possible to display the map in a different language (by changing style), but I can't find a way to translate geocoding requests correctly.
For example, if I pass in the city 'Gent', I would expect to see that it's in province Oost-Vlaanderen and country Belgiƫ. However, I get 'Gent, Oost-Vlanderen, Belgium'.
This would be done using a request like: https://api.mapbox.com/geocoding/v5/mapbox.places/Gent.json?country=be&access_token=MYACCESSTOKEN
Is there a way to get the correctly translated result? Perhaps using a setting or extra parameter?
The localized names that I see in Streets-v8 (and likely in mapbox.places) are name_en, name_es, name_fr, name_ru, & name_zh.
This looks like you'll need to file a feature request with Mapbox, at least you may be able to have support for name_fr.
I like to use the Mapbox Command Line Interface to see the responses from the Mapbox querys. This particular query gives a response of "place_name": "Gent, Oost-Vlanderen, Belgium",
mapbox-cli> mapbox geocoding 'Gent' --country be
I also tried Ghent in the query, but still received English
The town shows as Ghent in the Mapbox language switch example.
Looks like a solution has been implemented!
Just pass in a language field on the initialization object like so:
var geocoder = new MapboxGeocoder({ language: 'es' }); //change lang to spanish
Got it from these docs: https://github.com/mapbox/mapbox-gl-geocoder/blob/master/API.md#mapboxgeocoder

Getting user checkin information based on place_id from Facebook

I was wondering if there is any way to get user checkin information for different places based on the place_id. Facebook documentation keeps changing around and I'm not sure if this is possible now? Seems like it was possible in older API versions.
Any help will be greatly appreciated.Thanks
Checkins are deprecated since Graph API v2.0. You can get the total count (field were_here_count) of checkins to a place with a call like
GET /BrandenburgerTorBerlin?fields=id,name,were_here_count
which gives the result
{
"id": "145183205532558",
"name": "Brandenburger Tor",
"were_here_count": 128511
}

Sitecore Lucene.net search with " Item name" only and sort it by hits

Hi how can we search an items name (http://screencast.com/t/vRAUNgQN) using Lucene.net in Sitecore and sort the search by the hits.
This shouldn't really be a question as there are lots of resources out there for this. This is my goto place for search:
http://www.sitecore.net/learn/blogs/technical-blogs/sitecore-7-development-team.aspx
I'll give you the benefit of the doubt though and get you started.
If you are using Sitecore 7 and above you can use the Linq style search.
using (var context = new ContentSearchManager.GetIndex("indexname").CreateSearchContext())
{
IQueryable<SearchResultItem> query =context.GetQueryable<SearchResultItem> ().Where(p=> p["name"].Equals("John"));
}
You can then call
SearchResults<SearchResultItem> results = query.GetResults();
This will have a hits collection
foreach (var hit in results.Hits)
{
hit.Document.Id;
var relevance = hit.Score;
........
Each hit will have a Score property which determines relevance (see above) - you should be able to sort by this. By default I think it sorts by relvance anyway. You can change the relvency by using the Boost function in the query.
For Sitecore 6.6
I'm a big fan of advanced database crawler module - it provides a nice wrapper for the search logic that sits on top of the standard search api.
http://sitecoresupport.blogspot.co.uk/2013/05/advanced-database-crawler-sitecore.html
Bear in mind though if you upgrade to 7 there are compatibility issues with this module.
Or you can use the standard Sitecore search api
https://sdn.sitecore.net/upload/sdn5/articles%202/administration/lucene%20search/lcd/lucene_search_engine-a4.pdf
I'm sure you'll figure the rest out

Amazon ItemSearch API reponse different from amazon.com search results

I am trying to figure out the right parameters for ItemSearch such that the API call will return the same result as on the website. Currently I am using these params it is not consistent with the website.
url_params = dict(
Service='AWSECommerceService',
Operation='ItemSearch',
AssociateTag=AMAZON_ASSOCIATETAG,
SearchIndex='All',
AWSAccessKeyId=AWS_ACCESS_KEY_ID,
Keywords=keywords,
ResponseGroup='Small,OfferSummary,Images'
)
For example if 'iphone%205s' is put in keywords, the API returns a list of iPhone protectors, while searching on the website gives iPhones as top results.
I am also trying to figure out why this is for book searches. One possible answer I found online was that the websites search feature might use more elaborate queries than just one simple API call. For example, it may take into account other factors into the search (not sure what that might be but it may).