I am developing a small, local delivery website using Wordpress and Woocommerce. I am trying to implement a conditional field or part of code that geofences (may not be the correct term) products to their postcodes. For example people who type in a particular postcode radius are only able to view a selection of products available in their area. It seems I'm looking for a type of SauceyApp.com or Just-Eat.co.uk type search feature. I'm assuming this requires the use of some form of Google Maps plugin. I have been searching for weeks and can't even get insight on where to begin. I was wondering if anyone knew how I can go about this or even a vague idea on where to start?
Google Maps has a Places API where you can put in a location and radius and get an autocomplete for searching local places and lists of places to map by category. To get a users location you could use the Geolocation Api which is supported by most browsers (IE 9+) or a geolocation service. All that's required is an Api key from google, location, and radius. They you can send in options to filter the data. Information on these parameters is listed here in googles docs.
An example query would look like this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&rankby=distance&types=food&key=YOUR_API_KEY
There are several open source wrappers around this api to give you something to start with:
python-google-places
google-places-api-java
Ruby wrapper for Google Places
Related
As the title says, my app takes parameters from the user and displays relevant locations around them. But from what I understand, the Google Maps API terms prohibit you from doing this. Can this use be termed as a listing service, where I'm simply displaying the data I got from Google. I'm also providing all relevant attributions.
I would like to use the api like airbnb. I have search and read all posts/stackoveflow/google group that i can. I couldn't find the answer
In general i would like to do the following:
Would like the user to have the ability to insert advertise with full address
I would like to search in my db by city/street/country and radius according to users ads
Does i have to use api key? I have found autocomplete example without the api key and i works fine
Hope it makes sense.. I have looked on this Google group thread and this stackoverflow thread.. But i am not sure if this flow is allowed and optimise.
Thanks
I am developing a node.js application which (amongst other things) will recieve location information from remote users and allow them to interact with each other via the server.
I'm using the Google Tracks API because I like the idea of being able to track users when appropriate, set up geofencing to define my coverage areas and to visualise what's happening.
The Google tracks API documentation is reasonable, however I'm not sure how I would go about actually visualising the entities and geofencing I have setup on a map - this is not something that I can find covered elsewhere.
Ideally I would be able to simply embed a map into a webpage which could link with my Tracks API account and show all of the fencing and entities. Another nice feature would be the ability to 'draw' a geofence, is there anything out there which would allow this?
Thanks :-)
Tracks API does not currently offer any kind of server-side rendering for your Tracks data, so the best approach is to use the API to retrieve the crumbs (or just current location) and render them using polylines (or just markers) in the Google Maps API. You can similarly get all your geofences and render them using polygons.
Because this is done clientside, you'll probably want to limit your data to a reasonable number (depending on the browser/OS combination, something like O(thousands) of vertices).
All this assumes that your app meets the terms of service of the Maps API so check those out as well.
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.
I need all locations of type cafe, gas_station, and restaurant using Google Places Api. Here is my query via the API:
https://maps.googleapis.com/maps/api/place/search/json?location=41.104805,29.024291&radius=50000&sensor=true&key=AIzaSyAVH0qHD6BPxRlnck3rIqcxC5TTwOTyfds&types=gas_station||shopping_mall
This returns mosque location types only. I'm not getting shopping_mall, gas_station, or restaurant types. here i am checking type in google place api
How can i get all these types?
Unfortunately, Google Places API does not appear to have anything under those categories in that area.
Use types=establishment to get a more complete list of businesses etc. in that area.
Unfortunately, you will have to find some other way to determine what is a gas station, etc. Google Places API does not appear to have that data, at least at this time.
It may be possible to contribute that data yourself.
Since the answer above was posted, Google has added support for additional location types.
https://developers.google.com/places/documentation/supported_types
It was suggested in other SO thread, that you use 'keyword' instead of 'types' in your query to Google. Related SO thread:
How can I search places with specific types using Google Places API?