I have a web site and I'm trying to implement this:
Some users (let's call them shop owners) will put a pin (to indicate a shop) and describe what's out there. They can save as many pins as they want.
Other users (customers) will make searches for shops.
Searches will only consist of location names.
For example, if a customer makes a search for "Champs-Élysées, Paris, France", the system should show him shops around Champs-Élysées.
Can I make use of Google Maps API (or Bing, if there is an API for it) for it? Or any other ways? I'm open to all kinds of guidance. So please feel free to comment on my requirements too.
Allow users to click on a map and create markers in your database (here). You can show a javascript prompt to let the customer type in the name of the store.
Create a form where users can enter a city. Search through your added markers for markers in that city. Or even better geocode what the user types in and use the lat/lng in the database to find markers within a certain radius
Related
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.
I have created one small application, where user can store his/her contacts with full address including map. Therefore I am using the Google Maps API, where user can point out his/her address.
For this I have given address fields with Country, State and City. When user entered this information, I am showing the default address on Google Maps, then the user has to drag the marker/pointer onto his/her exact location.
Now, in this case I want the zoom level of googles map to be set as per location's population.
This means if the user entered city with no mans land (less population or any desert place or any jungle place or very small area on city then zoom level should be more, so user can see proper area on map) otherwise zoom level should be less.
Can some one guide me how to do this?
This won't be possible using the Google API's alone, (I'm unsure if demographics info has been released for the US, I know it was in the works, but it certainly won't work elsewhere). You will have to find an external source to provide your demographics information for you.
The Google API's do not keep a public record of population density.
You could however be a but more tricksy and use an approximation. You could for example do a places search in the area (using an arbitrary radius), count the number of results and use this to set your zoom level (again using an arbitrary value to determine high/medium/low etc). It's a fair assumption (though still an assumption) that any area with a large number of 'places' returned will be densely populated.
You don't need to base this on the population of the location. Please check the follwing link. I think it should give you an idea of the options you have.
Google Maps API v3 - Geocoder results issue with bounds
Check both my question and my answer. You will probably want to use the viewport object.
Is it possible to insert a Google Map into a WordPress category archive that would read all of the data in the places on a category page and create markers for them?
I have a directory site where each place on my site has been geocoded. Places are individual posts. They are organized into categories by city. The output of the each category page is a list of all the places for that city.
My URLs look like this:
example.com (Homeapge)
example.com/city (City Archive Page - shows a list of all places in my db for that city)
example.com/city/famous-restaurant (Place Detail Page - shows all data about a specific place in my db)
I want to create a map once that I can put on top of example.com/city and it would show markers for each listing I have in my db for a specific city. I don't want to have to create individual maps for each city.
I found this tutorial but it would require an XML dump of my db on the fly.
Are there better ways to accomplish this?
Yes. You'd use a combination of the Google Maps API and get_posts()
https://developers.google.com/maps/documentation/javascript/overlays#Markers
and
http://codex.wordpress.org/Template_Tags/get_posts
Though, the posts will have to have the latitude and longitude stored with them. Otherwise, you'll probably need to use another part of the google maps API to look the places up...
I've been developing a website where users can add a place (say a store in a city) and it is stored in a database. Now I would like to be able to display these places on a interactive map on my website. I got a bing maps developer key but it seems i can only display the data if i have the coordinates (lon/lat). Is that true? And if so, how do I get the coordinates automatically once a user adds new data?
As an example: You add Store XYZ in City XYZ, but you DON'T have to enter the coordinates. Now, this info is stored, but I don't have the coordinates..
Any help is much appreciated!
If you don't have any plans on allowing your users to insert place locations in a map or by filling some lat/long data, I suggest you to use google web services to get geolocation of those places. You'll need to format the input you send into something like an address to get it working properly though.
See this Google documentation
I've embedded a map on a clients site, with their various store locations, using the google saved maps technique: http://passportal.com.au/stockists So basically I don't want store the marker locations in a database, I'm just interested in using the marker positions on the saved map as seen in this demo: http://maps.google.com/help/maps/getmaps/plot-multi.html
I've seen it on plenty of sites and am wondering if there is an easy way to add a search field to find the closest marker to the users address. Something like this: http://www.victoriantextiles.com.au/store-locator
The closest I could find was a google gadget that allows you to type in directions: http://www.google.com/ig/directory?synd=open&hl=en&gl=en&url=http://igwidgets.com/lig/gw/f/islk/89/slkm/ik/s/1329844/87/charles447/google-maps-driving-directions.xml
Any help would be great, thanks!
For this purpose, I use Google Maps API Distance Matrix where I would pass in one origin - user's location and multiple destinations - our dealers. Then I sort the results by distance and take 3 closest to display in a list. Works pretty fast, however, I don't know how you'd achieve this without having some sort of database of your store addresses.