I am making an Android app that stores 3 million city markers in MongoDB. Depending on the current google map view, I make a geospatial box query to Mongo to get all markers within the current view on the screen.
If the user wants to change the view, he/she can also perform a text search for a city and this will query three name fields across the markers collection and show the results. I currently use Mongo for this but due to naming conventions it is not working well at all (case-independent search is slow, normal search is fast but inaccurate if user forgets to capitalize/capitalizes wrong letter).
Is it possible to search the map with Google's map service? I don't want to find restaurants or bookstores, only cities.
If I would search for "los angeles" for example, I expect the map to take me to Los Angeles, not show any google markers, and let my markers load normally.
Is it possible to only extract the search functionality from google maps without the excess places database? Is it possible to get their suggestion box working when typing a search so that if there's two Los Angeles I can be informed of that?
Is it possible to search the map with Google's map service?
No, it does not support searching.
Is it possible to only extract the search functionality from google
maps without the excess places database?
Not from Google Maps, but look at the Geocoder class. You can pass a String location and get back a list of Address that match. You will have to go through the results yourself to pull out the lat/lng. Then you can move or animate the map as you please
using animateCamera or moveCamera.
Related
I'm developing a petrol price comparison app for my final year project in university (something similar to GasBuddy or PetrolPrices if you're living in the UK/US). I want to create an Android app that features an in-app map that's prepopulated with all the petrol stations in the country (Ireland).
I was going to use the Google Maps API for the in-app map and then add custom markers for all the petrol stations. I'm going to use Firebase as my database and wanted a section of it to be a list of all the petrol stations with their information such as; co-ordinates, opening times, petrol prices etc. I would use the Google Places API but I only want petrol stations to come up on the app without a user having to input a search query for them, which means the map will have to be pre-populated already.
Is there anyway that I can get all the co-ordinates of all the petrol stations listed on Google Maps to input into my database so I can prepopulate the in-app map with custom markers?
Thanks in advance
Note that Stack Overflow is not a free code writing service.You are expected to try to write the code yourself. After doing more research if you have a problem you can post what you've tried with a clear explanation of what isn't working and providing a Minimal,Complete, and Verifiable example.I suggest reading How to Ask a good question and the perfect one. Also, be sure to take the tour read this.
That said, you can use Places API - Nearby Search to achieve this. And by using the type filter and setting it to gas_station, you will get details of the place such as their coordinates. See this for the list of supported types.
IMPORTANT NOTE:
Be careful on what you store in your database. According to Google Maps Terms of service under 3.2.3 (a) No Scraping, customer will not: (i) pre-fetch, index, store, reshare, or rehost Google Maps Content outside the services
There is, however, some data that you can store/cache temporarily. See their service specific terms for more information on this.
I am making an android application and I am thinking instead of having a database and input numerous universities and schools in our area, is it possible to use google map instead? For the user to just type the location and identify the nearest college and universities base on the location the user typed by the use of google map?
I'm not sure if there are any search features built into the Android SDK, but you can certainly still use the Place Search API.
The following example is a search request for places of type 'university' within a 500m radius of a point in Sydney, Australia:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=university&location=-33.8670522,151.1957362&radius=500&key=YOUR_API_KEY
You simply need to specify the type as university or school. See here for other supported types.
Use the google place api as follows
https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=university&location="current lattitude","current longitude"&radius=500&key=YOUR_API_KEY
for more info visit https://developers.google.com/places/web-service/search.
I want to develop an application for searching Near by places(restaurants, ATMs etc), Currently I am using Google Places API and it is working fine but the problem is it is not giving me the names of local restaurants present near to me or also giving some restaurants name which are far away from my current location.
All my local restaurants are present and shown on Google Maps in restaurant Category but not providing the same in nearby searches.
When I tries the same using application NearMe on play Store its is showing the proper data including all my nearby local restaurants and more precise results.
Is something needs to be done at coding level to get all these local restaurants data and more precise results or NearMe using some different API ?
I was having this same issue when working with the Google Places API. I was trying to grab the closest places within a specific radius and Google Places would return a random assortment of places within that radius as opposed to the closest 5 or so places.
I did find a very rough work around that might work in your case. I noticed that by tightening up the search radius or distance I received closer places in my query (obviously). But this was the only way I could get the closest places that I knew existed within the API that were close to the current location.
Check out this post that is the same issue.
Google Places Api sort by distance
I want to add markers on map for my android app. I do know how to do it (overlay items). My question is: Since I am manually putting markers on points(on the map) whose lat/long's I already know, I want to know if there is any way to get the exact latitude and longitude of a place on google map? Right now I am asking my people to go to the particular places and use this ( http://bit.ly/K4fOcy ) app to determine the lat/long of that place and send it to me via e-mail. I use these lat/long values to put markers on my map in the app. But the latitudes and longitudes i get are not accurate. they have around 300-2500m error (on real scale).
Or shall I use the Google Places API? How does it work? What about the places which are not in the Google Places database? How do I exactly mark them on the map? I would be very grateful if someone points me in the right direction.
Thanks
If you are working with establishments that aren't represented in the Google Places API and want to be able to pull coordinates directly from http://maps.google.com/, you simply:
Find the location of interest on the map, using an address or just knowledge of the area
Right-click on the map and select What's here? from the context pop-up menu
The Lat-Lng coordinates will be automatically populated in the search input box and usually, the address will also be displayed in the dynamic side-panel (and very often a Street-View photo).
If you are looking for a way to query for the coordinates, you can use the Geocoderdev-guide service to turn addresses into coordinates.
Have you looked at the geocoding API for google maps? It allows you to pass in an address, and returns a Latitude/Longitude pair in response, there is an accuracy value returned with each response to let you know how close the geocoder was able to resolve the location. https://developers.google.com/maps/documentation/geocoding/
I was wondering how I can channel or simulate Google Maps just in the sense of a user types in a location in text, such as a restaurant name and a city name. Then Google suggests 5 or so places they have indexed, and presumably they know the GPS coordinates because Google then puts them on a map. I want to be able to use that feature- not the map, just getting the location.
My goal is for a user to type in a query, 5 options or so to be shown, and if they user chooses one of them, then the GPS coordinates, or a location object, is saved representing that place.
Ideally I could just send the query to Google and steal the results back to my app. Obviously building my own database of locations and an algorithm to suggest them is out of the question.
Thanks for the help and advice in advanced!
Note 1: To clarify, this does NOT involve the current position of the user/device.
Note 2: I looked at the Google Maps add-on API, but it looks like that is for a visual map, not the querying a location part. You are already supposed to know your location, and it will map it.
Use geocoder.getFromLocationName, you get back a list of Address objects, in those objects you will find all the information you need about the location.
To test this on the simulator you need an image with the Google APIs included. In a device should be fine if you have the market installed.