We have a client that wants a store locator on their website. I've been asked to find a webservice that will allow us to send a zipcode as a request and have it return locations within x radius. We found this, but it's maintained by a single person, and doesn't look like it gets updated or supported very well. We're looking for something commercial, ideally that updates their zipcode database at least once per quarter, and that has a well-documented API with PHP accessibility. I won't say price isn't an object, but right now we just want some ideas, and my google-fu has failed me.
I've already posted this over on the webmasters forum, but thought I'd cover my bases and post here too.
I've repurposed this outstanding script to conquor this same challenge. It's free, has been very reliable, and is relatively quick.
In my script, I have addresses stored in the DB. So rather than show a page to enter addresses, I simply pass them as a string and let the magic happen.
He says it in the app, but ensure that if you go this route you get your own Google Maps API. It won't work with his!
If you want to go a bit less technical approach, here's a MySQL query you could run on your locations (you'd have to add lat/long to your DB or setup a GEOCODING service) to give you distance as the crow flies.
Google Maps has a geocoder as well and it geocodes to the specific address.
It's limited to x number of requests but that shouldn't be a big deal if your site is small and if you cache. You can get more requests if you pay.
It can be accessed via javascript or via PHP (and there are several prewritten PHP modules out there)
Link here:
http://code.google.com/apis/maps/documentation/javascript/v2/services.html
(I worked for a company that did upwards of 800,000 requests a day, so it's stable and fast :) )
PostcodeAnywhere has a Store Locator feature - I think it's pay per use, but I've used their other products before and they're very cheap.
http://www.postcodeanywhere.co.uk/store-locator-tool/
Related
I'm trying to make a PHP-based location search. I want it to be as 'smart' as possible, being able to find both addresses and hotels, musea etc.
Now I am currently using the Google Geocoding API, but the problem is that it can only seem to find addresses (when I input a hotel name it finds either nothing or some location on the other side of the planet).
I looked further and found the Places API, which can find all kinds of businesses and other locations. Problem is, I don't think (though correct me if I'm wrong) it can find normal adresses.
So my ideal situation would be being able to look for adresses AND other places at the same time. I would like to receive either a list of results sorted by relevance (determined by Google), or only the most relevant result.
Thanks in advance!
Wouter Florign,
Your current problem has a few components:
(1) the request/response from the Google Geocoding API
(2) the request/response from the Google Places API
(3) your workflow to process the responses/data from the above to API calls.
The main objective of your code is to maintain consistency between related and dependent objects without sacrificing code reusability (the continuation of your workflow is dependent upon your API responses). In order to ensure this, you should use the Observer pattern to wait for your requests to complete in order to continue your workflow. The reason for using the observer pattern and not using promises is that PHP is almost completely single-threaded. Beacuse of this, an implementation with a promise will block your script until it is complete.
If you feel more comfortable using promises, you can have your promise fork from the main script, (using the PCNTL family of functions). This will allow your promise code to run in the background, while the main script continues. It makes active use of pcntl_fork, which allows you to fork a new thread. When the Promise completes, it comes back. It has drawbacks - the biggest of them being the inability to message the main process by anything but signals.
Another caveat:
I implemented something very similar to this a couple of years ago. I believe I ran into the same problem;
In my case, I was able to leverage the Yelp API. This API is really fantastic]. All you have to do is perform a GET request on the Search API using the optional longitude, latitude parameter (it also has a radius parameter to limit your search). With this, I was able to get all kinds of information about businesses given the locations: hotels, restaurants, professional services [doctors, dentists, physical therapists]) and I was able to sort it based on various metrics (satisfactions, relevance, etc).
Please let me know if you have any questions!
my question for professionals I think may be stupid but I had a problem which regards to search for my solution for my problem. Technically I am developing social networking site and I want to integrate Google Map API and my question is, is there any way that I can download the crop image so that it stores to my server so that my web server doesn't need to request to Google Server again. If not, can you give an alternative solution that may fit to may problem and If yes can you give a hint or tip which it could possibly usable to my development process. I am newly in such Web API. Thank you. Regards
try to use something like this
<img src="https://maps.googleapis.com/maps/api/staticmap?center=-15.800513,-47.91378&zoom=11&size=200x200&sensor=false">
will look like
Using the static map api it will return you an img, then you can save it easily as a normal image, but my recomendation is just to have columns with the user's location stored in your database, the address or the coordinates (lat,lng).
Later on when you want to display the map just request it from google using the staticmap or the javascript v3 API.
Advantages:
You save bandwidth and storage space
Easier maintaining of your database and or files structure
Google's server probably has better response time and speed than yours
More dynamic: reverse-geocoding the location or using the coordinates you can display the static map, the normal map (which is not hard, I can tell you), Street View, Google earth and probably a lot of other stuff
You are not going against the Rules
Disadvantages:
Google's daily limits, which are up to 2500 or 1000 requests per day and 10 per second, you can look it up I don't remember. But, if you use tha JavaScript v3 to display the map, the prints are counted on the browser, so it would be 1000(in the worst case) prints per browser(per ip actually), so that means that each user can print 1000 maps per day. It's not really a problem, if your site gets that many views you are doing great xD
Sorry for this one but I'm lost. I'm trying to build a search page that uses either a UK Postcode or location to find an airsoft site (Lets call them "stores" so I don't have to explain to those who don't know what airsoft is), every store I have included a column Geo_location_lat & Geo_location_long alongside postcode, county, town/city and address where possible.
However I'm struggling to figure out how I go about taking the user input of "London" or "ST15" convert that to long/lat and search for all stores that fall within "X" radius. I have done a fair bit of googling and one or two scripts that are incomplete or require license.
Seen I can do it via Google API but they all involve markers and so on and I don't require maps etc... Unless I am missing a trick somewhere...
TL;DR - I need a store locator, all "stores' have long/lat stored already however not sure how to do the search.
Have a look at Ordnance Survey's OpenData API. Code-Point Open looks like it might be good for you: http://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/index.html
Google's API should do the trick for you. You want the geocoding API, not the maps one.
https://developers.google.com/maps/articles/geocodestrat
I am currently working on a special interest social network. The part that I'm having trouble with is the location of individual users.
My ideal solution would be a system where users enter their city/state and/or zip code, and could search for other users within their own area.
What I think separates my question from many existing threads is my needs and my resources. I don't have much capital at all to invest in a paid database, nor do i need all the features offered by the ones i've come across. I'm really looking for suggestions in which direction I need to go in. I've seen a lot of threads with similar ideas, but none that give the type of answers i need for my project. I'm not sure where to start with this, so any help would be greatly appreciated!!
Also, I'm building my application in php5.
these barebones hosting packages include MySQL... 1and1.com
so you could store the locations, and use the Haversine formula to find nearby users: http://code.google.com/apis/maps/articles/phpsqlsearch.html#findnearsql
For getting the data in Lat/Lng format, you could consider using navigator.geolocation...it's fairly well supported, but you could do a test for it: if(navigator.geolocation) and if it's NOT, provide a text field for city/state or ZIP, and then geocode that to get to Lat/Lng (google has a service here: http://code.google.com/apis/maps/documentation/geocoding/ ) but it does have some limitations, like 2500 queries/day unless you pay for an upgraded license
Actually, even if the navigator approach is available, you might want to provide a confirmation step (in case their ISP is returning an different location)...like "you appear to be HERE, is this accurate, or would you like to supply your own location"
Thank you Robot Woods, Your answer inspired some creative googling that lead me to the answer to my problem. Yahoo offers PlaceFinder! http://developer.yahoo.com/geo/placefinder/
PlaceFinder can be used to get a Latitude/Longitude from a user inputted city/state combination or a zip code. And best of all... Its Free!!! Fits my budget perfectly!
I've almost looked everywhere but nothing found, so my only hope would be here though! :(
I want to make a PHP based script for finding UK address by entering postcode, so a list would show with a number of houses' numbers!
Any idea how I could do that, I know that I must use API, even though I search for Google Maps API for this, but nothing found whatsoever!
Any idea?
I need this particular script for an additional registration script which allows uk residents to be able to register for a specific reason, so please help if you know where I could get started!
Thanks in advance! :)
Generally these systems utilise the Royal Mail PAF database, but this does cost quite a lot of money.
There are services out there that offer X amount of requests for a set price (or a monthly price), so if buying the full thing isn't an option then you could have a look into one of those services.
It is something you are going to need to spend money on though - it's not a service that anyone (that I've ever found) is offering for free.
I don't think this is something you can get out of Google maps either.
Well, there are quite a few projects working on this dataset - just look at e.g. http://www.freethepostcode.org/ and the associated projects.
You can fetch the postcode latitude and longitude using google api:
http://maps.googleapis.com/maps/api/geocode/json?address=(POSTCODE HERE)&sensor=false
then using the lat and long from that you can get the street name
http://maps.googleapis.com/maps/api/geocode/json?latlng=(LAT),(LNG)&sensor=false
see reference here:
http://code.google.com/apis/maps/documentation/geocoding/
We can get all UK addresses by postal code with api.getaddress.io API. You can found an example on https://usingphp.com/post/how-to-get-all-uk-addresses-by-postal-code