I'm essentially trying to build a kind of store locator using Google Maps geocoder, but I want to find a way to write code that returns the nearest stores as hyperlinks on the page (probably inside a div), without placing everything on a map. I don't want to use a map, or markers and infowindows, etc... at least not to begin with.
I've followed a lot of the Google Maps API tutorials online, and it's been easy enough to build a basic working store locator that returns a set number of results inside a given radius by checking the input latlng against the values in my database, but I'm not all that skilled at js, and was wondering if anyone knew of any tutorials that might demonstrate the use of the geocoder for returning latlng search results just in text format, without a map.
Thanks.
The use of the Google geocoder is not allowed without using the results on a Google Map.
Note: the Geocoding API may only be used in conjunction with a Google
map; geocoding results without displaying them on a map is prohibited.
For complete details on allowed usage, consult the Maps API Terms of
Service License Restrictions.
Related
I have a MySQL table containing a list of properties in the UK. The table contains the full address of each property including the post code. I need to be able to query the database to show all properties within a certain radius (e.g. 3 miles) of a given post code.
I've searched SO and couldn't find a similar question.
Research on Google seems to suggest I need to use Google Maps but I can't find any material to get me going. I don't need to display the results on a map at this stage, a simple list of the properties will suffice.
I'm not asking for someone to code this for me (although that would be nice!), I'm just after a point in the right direction.
Thanks.
If your properties are already accounted on the Google Server the Google Places API would be able to retrieve them. You just need to set the radius of 3 miles as parameter.
https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters
More details related to the parameter passed can be found in this official documentation.
If these places are not accounted in Google than they wont be displayed after requesting this REST API. Then you have to follow the standard procedure of:
Creating a query of fetching the requesting the address in within 3 miles with given postal address.
Select address from table where radius=3 & postalCode=xxxxx;
When you have the address convert them into Lat/Lng using Geocoder API.
Finally display them on Google Maps.
Hope this helps!!
I'm trying to get a list of all the Hungarian city names from google maps, but I don't know how. Is this at all possible?
As far as I know, there is no such possibility. Although Google Maps API lets you determine the name of the location by its coordinates (the Reverse Geocoder API) and lets you find coordinates of places that match the given name query (the Geocoder API), I'm pretty sure that it won't let you get all objects that match a certain criteria.
So the short answer is: no, it's impossible.
How can I code something which'll calculate the driving distance between 2 zip codes within the USA in PHP. An API or web service that has SOAP or REST will also do.
But I understand GoogleMaps API can't be used because it violates the TOS.. So I need a way without using Google Maps, because I have no intention of using their maps, just calculate the distance.
There isn't a whole lot out there that's free, other than Google Maps. The MapQuest API may give you what you need. Here's their guide to the service - it addresses getting driving distances/times between a set of points. Their terms of service don't appear to require that you display a map, but take a look and see if that meets your needs.
Google Maps Distance API has this exact Functionality. You can get a return as either xml or json.
Here is the documentation
https://developers.google.com/maps/documentation/distancematrix/
Here is a sample of the request url :
http://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&mode=bicycling&language=fr-FR&sensor=false
One nice thing is you dont have to calculate the long/lat first
I have an array of latitudes/longitudes and Descriptions that I want to display on a Google Map.
Does anyone know of an API (or even better a tutorial) that describes a good way to accomplish this or something similar using PHP and/or Javascript?
http://code.google.com/apis/maps/index.html
The static maps API is the simplest to use. You can use PHP and cURL to grab the map you need with the data you have (latitude/longitude).
Google labss: Google fusion tables: then make those two lat/lon fields the "location"
google for the term: google fusion table map
For the site I am building I want the user to be able to search for a location, however because I don't have a list of locations for the UK, I have developed a script in PHP which calls: http://ajax.googleapis.com/ajax/services/search/local in order to get the lat and lon coordinates of this location to store in the database for future use.
This works well apart from if I search for a town, for example Heaton, it brings back the one in Staffordshire rather than the one in Newcastle for example.
The whole reason I'm using the google ajax api is to cut down the google requests per day because I don't want to exceed the daily request limit.
As you can see though, I've hit a brick wall because the search isn't refined enough to bring back the correct location.
Can anyone suggest another way around this? I'm quite stuck. Thanks
I don't know if you have seen this already, but there is a parameter in the Google Search API that allows you to specify a boundary for the search:
GeocoderRequest object specification
The specification for a geocoding
request to be sent to the Geocoder.
Properties Type Description
address string Address. Optional.
bounds LatLngBounds LatLngBounds within which to search. Optional.
language string Preferred language for results. Optional.
location LatLng LatLng about which to search. Optional.
region string Country code top-level domain within which to search.
In your case I would specify a bounds around northumberland, so something like:
http://ajax.googleapis.com/ajax/services/search/local?q=heaton&v=3.1®ion=GB&sensor=false&bounds=(55.395,%20-2.510%20,2054.342,%20-0.417)
might work...? I don't know if this would be relevant to your app though. Good luck!