Ive come across this website, http://gmaps.kaeding.name/, which allows you to plot multiple locations on a static google map.
My question is how is this done..? I'm not trying to copy what he's done, just understand as Im trying to achieve something similar.
In the blog it says "You enter as many addresses as you want, one per line. Then the script sends those strings through geocoder.us to get latitude and longitude"
Would this be a Visual Basic script...? Or am I barking completely up the wrong tree...?
sorry to be so vague but not sure where to start
The form posts to cgi-bin/map.cgi on the server, so any attempt to work out the implementation would be pure guesswork. There are implementations of this functionality in pure client-side Javascript, if you care to Google them, such as this one:
http://www.tomanthony.co.uk/blog/geocoding-uk-postcodes-with-google-map-api/
You don't need to rely on geocoding per se, as the Google Static Maps API allows you to provide addresses for locations plotted on a static map as markers.
From the docs:
Each marker descriptor must contain a set of one or more locations
defining where to place the marker on the map. These locations may be
either specified as latitude/longitude values or as addresses. These
locations are separated using the pipe character (|).
The Static Maps API includes features that allow you to overlay markers, lines, and polygons. So to implement something similar, you'd simply collect the form field values and then submit the request to the API (either via server-side or client-side [AJAX] code).
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 a store locator that until now only needed to look for one specific business name. So when a user would find a store near them, it would just use their current position and query for all the stores near them. However, now I need to include multiple different store types. So for instance, if I wanted to deep link to the maps app/site and search for both target and walmart, is that possible? Could this be done by passing a KML maybe?
Edit: To be a little more clear, I am not implementing my own map on my site. It is linking to google maps with a payload for the search. So it either deep links on mobile to the google maps app or the site on desktop. I am wondering if it is possible to construct a query for the URL to be able to display more than a single store on the map.
So for instance we have:
window.open("https://maps.google.com?near=&q=" + query,'_blank');
Where query would be the store name. However, simply using logic operators won't return two stores in the map. It will try to treat one of them as a street name or something to this effect.
You can make multiple queries, store them, and then show them with their corresponding markers.
What I need is the following.
Whenever I add any instance of object in my website, I need the server to add the location of the object to my own map either in Google maps or Bing maps (Bing maps docs are more clear therefore I'm going to use Bing).
Later, whenever I view the object in my site, the map should point to the location of the object and other my map objects in the same map.
How can this be achieved? Do I need to hold all the coordinates and object descriptions in my server, or somehow it is saved in the google or bing.
I went through the docs, but couldn't find any information I need.
You need to store them on your server and load them into the map on your webpage. There are ways with both google (fusion tables) and bing (spatial data services) of storing them with the provider but if you are already storing a copy for your website you are better off keeping them there for the map rather than maintaining two copies.
I'm not sure how technical you are but this best architecture approach is this:
1) Write a database query that finds objects to show on your map, ideally filtered by whatever the user can use to filter objects elsewhere on your site. Add to this query a filter by geographical bounding box (the range of latitude and longitude that can be seen on your map at any one point). The bounding box filter is just a simple sql BETWEEN clause but will mean you dont have to load every single object on to the map.
2) write a "webservice" that uses the database query in 1) and turns the results into JSON. This approach will lead to a much cleaner seperation between your mapping code in javascript and your server side code in the webservice.
3) Write your mapping frontend in Bing using javascript and use something like Jquery to read data from the webservice as the map is moved around re-load data that know should be shown on the new map view. As the data will be in JSON its much easier as JSON will just give you javascript versions of your objects
I'm developing a app that makes use of the Gmaps Places library and actually, I have two questions:
1) Does anyone know how long it takes to an added place(by POST request) to show up on the map? I only need it on the app's map, so I don't care if Google doesn't approve it. I've already sent the add request and received OK as response.
2) It is possible to search for markers, placed by me, as if they were places(and using radius)? Not necessarily using the Places library. I ask this to see if is possible to come with a backup plan if the waiting mentioned above is long(clients, clients...). Then I would have the places 'offline from Gmaps', mapped inside a JSON file.
If I understand you correctly, you want to combine Google's Places API with a custom location set? Without more detail I can't really tell you what the code would look like, but you'd basically want to mash up the results you get from places with your own data and place markers based on that merge. If you're searching by radius or polygon you can do a 'within bounds' search on your dataset and return any results that are within the search zone to feed into your marker creator.
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.