I am trying to develop the feature in my website to search the nearest Stores for the given location/address.
For example.
http://www.tesco.com/store-locator/uk/
After I have done some research, I think, I need to use the Google Places API to locate the nearest places. I have tested with some examples and it's working.
However, I don't know how to upload my chain of stores onto the Google Map and how to find the nearest stores (only mine, not other stores). I couldn't find a feature to upload my places onto the Google Places by using their API.
Could you please guide me how I could achieve it? Thanks.
I am attempting a similar feature.
First, you will need to upload your business locations to google. I think this is an important step it getting your places to show up on google maps. You can do that here: https://www.google.com/local/manage/#/list
After uploading you can download all of the locations in csv format. Once you have all of your locations in csv format you can parse the data and create a list of addresses to search.
Once you have your addresses you can use google's distance matrix api https://developers.google.com/maps/documentation/distancematrix/
you can search up to 100 places and get back a distance result for each location. Finally you can parse the distance results to find the closest location.
A few drawbacks here. There is a URL length limit of 2000 characters. If you are searching a lot of places this will fill up fast. Also, the free version of the API has a limit of 100 places per search and a maximum of 100 places per 10 seconds so if you have a lot of places or a lot of users this will be an issue.
Related
I've been looking into this for quite a bit, but couldn't find a solution. Is there a way to find out whether railway tracks are near a users position?
The APIs don't provide a places search like this (see Google Places supported types for this). One possibility would be to download the OpenStreetMap dataset for your region, import it in a database and extract the datasets Railways. Then you could pass the users position to your database (PostGIS) and check if there is a railways matching your filters.
Moreover there is the OpenRailwayMap, if you just need a possibility to do some visual identification of railway tracks. See OpenRailwayMap API site for further usage information.
I have a csv file with around 40.000 addresses which I need the lat and lng points from to pinpoint the position of the marker. I know there is a 2500 request limit per day using googles geocoder. but I was wondering if it was possible to geocode these addresses and save the lat and lng points inside my database and repeat this every day untill I have the coördinates of all addresses and if possible, how would I do that?
All help will be highly appreciated.
You can technically do it using javascript code as suggested in the commments. Their are even other methods and techniques you can do this with but please be aware of the Google Policies.
Quoting from the official Google Documentation
No mass downloading. You will not use the Service in a manner that gives you or a third party access to mass downloads or bulk feeds of any Content. For example, you are not permitted to offer a batch geocoding service that uses Content contained in the Maps API(s).
This is a question specifically for the Google Developer Relations team. I have read the Geocode API T&Cs and I am aware that I am not allowed to store data except by way of a temporary cache (e.g. for performance). Is this the end of the matter? I am developing a product which requires a search with results sorted by distance from a place, meaning that all my records need a lat/long. I was intending to use the Geocode API to get the lat/long when a user adds a record, and then adding that lat/long info to the record. We would then use the Haversine formula to calculate the relative distances and sort the results.
If I follow this approach, will I be in breach of the T&Cs? If so, is there another approach using the Geocode API which will allow me to hold onto lat/long data so that I can sort my results by distance, within the letter of the T&Cs?
For anyone else commenting, please observe the following restrictions: (1) we don't have a budget to buy a postcode-lat/long dataset; (2) we don't want to use a static dataset of our own, eg GeoNames, because we don't want to have to maintain data which is, effectively, public; (3) we have to support users who have javascript disabled.
To be absolutely clear, what I need here is to have the lat/long for all of my records in hand so that I can do effective searching and sorting by distance relative to another lat/long as provided, e.g. by a user searching.
Google Team, please respond to this message with contact details so we can speak.
I think the question has been answered here before,but i could not find the desired topic.I am a newbie in web scraping.I have to develop a script that will take all the google search result for a specific name.Then it will grab the related data against that name and if there is found more than one,the data will be grouped according to their names.
All I know is that,google has some kind of restriction on scraping.They provide a custom search api.I still did not use that api,but hoping to get all the resulted links corresponding to a query from that api. But, could not understand what will be the ideal process to do the scraping of the information from that links.Any tutorial link or suggestion is very much appreciated.
You should have provided a bit more what you have been doing, it does not sound like you even tried to solve it yourself.
Anyway, if you are still on it:
You can scrape Google through two ways, one is allowed one is not allowed.
a) Use their API, you can get around 2k results a day.
You can up it to around 3k a day for 2000 USD/year. You can up it more by getting in contact with them directly.
You will not be able to get accurate ranking positions from this method, if you only need a lower number of requests and are mainly interested in getting some websites according to a keyword that's the choice.
Starting point would be here: https://code.google.com/apis/console/
b) You can scrape the real search results
That's the only way to get the true ranking positions, for SEO purposes or to track website positions. Also it allows to get a large amount of results, if done right.
You can Google for code, the most advanced free (PHP) code I know is at http://scraping.compunect.com
However, there are other projects and code snippets.
You can start off at 300-500 requests per day and this can be multiplied by multiple IPs. Look at the linked article if you want to go that route, it explains it in more details and is quite accurate.
That said, if you choose route b) you break Googles terms, so either do not accept them or make sure you are not detected. If Google detects you, your script will be banned by IP/captcha. Not getting detected should be a priority.
I am in the process of building a booking system and I'm wanting to do a lookup, based on a text field, that searches both businesses and addresses.
For example, a user is presented with an Input Box that asks them to enter a location. I want it to support Businesses and Addresses.
My current implementation uses the Geocoding web service, but it's unable to find businesses, so I need to bring in the Places API.
I also need to find the distance between these places using the Google Distance Matrix Web Service.
I thought I'd solved my problem by JUST using the Google Places API, but not all addresses are listed on it.
Any ideas / previous experience is greatly appreciated.
You can use both of these on the page, and place a condition for an unsuccessful search on one (i.e. missing or empty variable) to trigger the other.