Google map search using KML - google-maps

i am using google map kml field (direct iframe code from gmap)
for showing different locations/shops on map:
Google map #my site,
i need to add a search box from where user can search nearest shops to his/her location...
can any body help me in this out..

It is my understanding that the API does not provide support for searching your provided KML:
google maps API geocode finds nearby KML
Google provides a service called placesService ( https://developers.google.com/maps/documentation/javascript/places ) which lets you make requests to their database of content and return results in the form of KML near a location within some bounded area - but to my knowledge you cannot specify the source to search. (You could try testing the placesService, with a KML layer set on your map and see if it includes your data).
Assuming you are generating your KML from a database, can you could regenerate it appropriately filtered or styled based on the user's search terms. This seems the most likely solution without additional details.

I have done google map search with python. But this one searches hospitals
You need to get google place api and place in code and reconfigure for search,
it will print out name, location address, and website
https://github.com/rockcastle/GoogleMap-Scrapping

Related

Free geocode API allowing store names and coordinates

My application should allow users to store events and their locations and then perform search on them - so I need those locations in my database with their names and latitudes/longitudes. Google API doesnt allow storing anything else but place IDs so I have to find something else that can autocomplete/suggest places on UI and allow storing it my database.
Does anyone know such a good service?
You can simply add your points in your DB based on each point Lat & Long values. So when user is searching somewhere you have his current location(Lat-Long), Therefore you can search in your DB and get the distance of each saved point with current location and retrieve the results you want to show (i.e in JSON format).
In client-side use some auto-complete jquery library to show the nearby places and somethings like that (with additional information).
Google Map API has a service that you can show some custom marker on the map with your custom configuration like marker icon, description and etc. You can show your additional information in description as HTML format.
You can see some example here:
Customizing a Google Map: Custom Markers
Hope these tips would be helpfull. Regards.
Suddenly I've found an answer that helps me:
https://productforums.google.com/forum/#!topic/maps/hNc1OOU6Zm8
So I can use some Google's data under some conditions.

How do I get a direct link to a place on google maps with the Place Id

I have the Place Id of a place on google maps in my app. Is there a way to put the place Id in a URL and have it directly link to the page? Or does it have to be done through the URL?
I can't seem to find anything detailing this in the docs. I've tried below, but it just gets me the standard google maps page:
https://maps.google.com/maps?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4
Recently, in May 2017, Google launched the new Google Maps URLs API. You can read about this API in the official documentation
https://developers.google.com/maps/documentation/urls/guide
So, from now on you can construct a URL for Google Maps using the place ID. In your particular case this URL will be
https://www.google.com/maps/search/?api=1&query=Google&query_place_id=ChIJN1t_tDeuEmsRUsoyG83frY4
Hope this helps!
Not directly, using the placeID you can get a variety of information in JSON or XML format, among them there are also the lat lng of the place and its address with which you can easily locate the map
google developer doc
The URL for a specific Google Place is returned by the places details API endpoint.
If for example you query:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJV2BQ4laeekgRFauLvdXbFXE&key=YOUR_API_KEY
You will see that in the returned JSON there is a key 'url' which points to https://maps.google.com/?cid=8148660811851344661
The correct format, at this time, to produce a general link that goes directly to correct google place is: https://maps.google.com/?cid=[place_id]&t=[maptype]
The map type parameter "t" is apparently necessary. Without it, google maps seems to perform a more general search when the link opens that is sometimes successful and sometimes not. With it, maps opens to correct place each time whether it opens in browser or in app on mobile.
Set this parameter to "m" for a street map and "k" for a satellite map.
A lot of answers on SO show the following syntax which often pulls unwanted results if two locations of the same name are nearby e.g.:
https://www.google.com/maps/place/Starbucks/#43.088554,-88.06579,17z/
If you are already using google places api, then you have the place_id, so i recommend using it to avoid ambiguity.

Google Distance Matrix API - Using the service without Google map

I wonder if anybody knows whether it is permitted to use a the distance matrix service in the code behind without displaying the google map on that specific web page. The google map will be displayed on another page on the same website, but does using the service elsewhere without the map violate the google terms and conditions?
According to the Google Maps API Web Services Documentation:
Use of the Distance Matrix API must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.
Looks to me like it's allowed so long as your application eventually displays that information on a Google Map, even if it's on another page.

How do I store and retrieve locations for google map into mysql database

I'm sorry, I'm extremely new to google map, thus I need some help here.
I want to store and retrieve locations that I've input and display in the google map.
Any startup for me to get me going? Thanks.
Try Google Earth, it will save locations in kml, and and you can feed data to it from an external source. You can also place marks in Google maps if you are signed in. Other wise you didn't give enough information

How to extract the lat/lng of pins in google maps?

I want to extract the latitude and longitude of a set of about 50-100 pins in a Google maps web page. I don't control the page and I don't need to do it more than once so I'm looking for something quick and dirty. I've got FireFox with FireBug as well as Chrome and all I need is something that's easier than re typing all the numbers.
Simply click the link shortcut on the map to retreive a URL for the map with pins in.
Next add &output=kml to the end of this url and use the link to retrieve a kml file containing all the pin data.
This kml file is actually in xml format so parsing it should be easy, you just need to look for <coordinates> elements which contain the latitude and longitude data you need.
The kml format is documented here: http://code.google.com/apis/kml/documentation/kmlreference.html
Just saving the .html file and using regex works:
These two reg-ex might be good starting points:
#[0-9]+\.[0-9]+,-[0-9]+.[0-9]+",geocode:"",sxti:"[-#A-Za-z .]+"
{id:"[A-Zloc0-9]+",fid
Google has change a lot the way you can extract information about google.maps and has set some limitations like numbers of queries by day.
To extract the lat and lon of Google maps you need a bit of knowledge about HMTL code and manipulating JSON/XML files. (all can be found in many tutorials.
I recommend you to extrac the data using de "Google Places API" it's VERY EASY! and you can extract about 150k locations by day for free. You have to get an account, activate your privileges of API Places (turn on/off buttom), get you secret KEY and then use a simple URL to extract the JSON/XML file. Here are two great links for that:
[1] https://developers.google.com/places/documentation/search?hl=en
[2] https://developers.google.com/places/training/basic-place-search?hl=en
If you want DETAIL info about the coordinates that you'll get, go to the section "Requesting Place Details" in the second link, that gives you info about what kind of site is that, the phone number and all the comments that users has made, if they are available.
Great coding and greetings!
Depending on the type of the map and whether the pins are set by latitude and longitude or by address, it might even work to just get the link (click on "Link" at the Google Maps page, the URL in the browser might not be the sam) and look for the "sll=[...]" parameters.