The question title pretty much sums it up. I want to restrict the map search to USA only. Right now I'm only using the BING Maps geocode service, so I guess there should be a way in there to do this. For example, if I search Paris, I only want to get 'Paris, TX' and not 'Paris, France'.
Thanks!
Have you tried just appending ", USA" to the query?
Without knowing how you're capturing/sourcing the values you're searching for it's hard to offer a more specific solution.
Related
First post on Stackoverflow.
I am using the Google API to sort images taken while traveling into organized folders, append tags and rename files with relevant information. I have my code working well but am not always happy with the results. I want to be able to focus my query results on major tourist attractions such as National Parks, Ski Resorts, Beaches, etc. The problem I am finding is that the prominence "rankby" variable and the "radius" are not giving satisfactory results. Here is a typical query for Zion National Park.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=37.269486111111,-112.948141666667&rankby=prominence&radius=50000&type=natural_feature,tourist_attraction,point_of_interest&keyword=&key=MYAPIKEY
The most prominent result is Springdale which is the town where you enter the part. Zion National Park is listed much further down in the results. What my code does is use the LAT and LON extracted using EXIF and does a Google API nearby search request to find the Place ID for where the photo was taken. It then does another API request for Place Details using the place_id provided by the previous step to cut down on the information I need to parse.
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJ8R5RCzaNyoARegi3rqVkstk&fields=name,address_component&key=MYAPIKEY
I can force the nearby search to return a National Park by searching against "National Park" in the keywords variable but that limits my project to only being able to provide National Park results since the keywords field can only accept one string.
I would like a park of my query to be able to return the most prominent tourist attraction at the general level, i.e. Zion National Park, Yosemite National Park, etc. so I can sort images into the general name folders and another part of the query provides the exact location. i.e. I am on this trail or at this lookout. The problem is the Google API sees these specific locations "Trail, Lookout" as tourist attractions, parks, establishments, etc. as well so it chooses those first.
What I need help with is trying to figure out if there is a better way to structure my query to return the high-level / name of the major park. From my understanding, the types field only searches on the first type even if there is more in the list and the keywords field can only accept one string as well making it impossible for one phase to capture all major destinations at a high level.
Perhaps it needs to be done with more queries but I am trying to limit the number of queries to stay inside the free quota. Maybe it will just take a long time to fully sort my files.
Read through and implemented Google API structure. I hoping someone can provide a more detailed query structure or method to parse out truly prominent locations rather than googles interpretation of prominence as it can be affected by user ratings, etc. It is not always accurate.
I made a ecommerce app for learning purpose.
I have implement search box using elasticsearch, it can search and give suggestion item's name.
example :
input -> macbo
suggestion :
laptop macbook 14
laptop mackbok xxxxxx
now I want implement search box for "general" means nothing category selected so when we type a something it's not give us spesific item's name but something like most popular search query/terms.
I cannot figured out how the basic ideas behind this, can someone give me some advise.
Thanks
I guess you are looking for suggestions, not the actual search results and If I understand this correctly then you could use the term suggestor available in Elastisearch.
Is there a way to get all the street names in an area with a Google API? Im trying to get all the street names from Sherwood Forest, Jacksonville, Florida.
As far as I know this is not possible with the Google API. You could search within a 50 mile radius for places ( using the places api ) and then parse each places address for streets and exclude duplicates.
If you do not need to use google maps then I would suggest looking at this.
http://www.openstreetmap.org/#map=2/71.3/-96.8
Im still figuring how to use google map api's, I want to get all locations in my country (nigeria) and then put it in a dropdown, an example is something like jiji.ng, when trying to search they have a drop down with info of places, states etc in Nigeria, when the user searches it filters the locations, i tried typing in 'United State of America' & it showed me nothing because it is limited to Nigeria only, that is exactly what i want, check out jiji.ng pls, just to be sure.
Google map is not really needed in doing this, You can download the list of places from Geonames then you can use it within your app (To my understanding, its free maybe only some licences)
I am looking for geocodes with the google geocode-API:
http://maps.googleapis.com/maps/api/geocode/json?address=london%c2+UK&sensor=false
The problem is, that the input isn't very accurate (specially the street) and sometimes google mixes things up and ignores UK, because the street has a perfect match (as street and city) somewhere else. e.g. US.
Now i cannot solve this issue (input data), but I am wondering if there is a parameter, which forces google to search in UK and return no result instead of a completly wrong result.
You can add component filters in the url to constraint results. In this case you can use:
http://maps.googleapis.com/maps/api/geocode/json?address=london%c2+UK**&components=country:UK**&sensor=false
For more information about how to use component filtering see:
https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering