Google or Bing maps API - creating and using your own map - google-maps

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

Related

Free geocode API allowing store names and coordinates

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.

Is it possible to query google maps for multiple store names?

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.

How to feed location data from Twitter's streaming API into google maps

I'm building a twitter app on node and socket.io that should display the locations of streaming twitter data on a google map in real time. I'm having trouble figuring out the best way to grab the location from the Twitter Streaming API. The API has a coordinates attribute, but only 1-2% of all tweets have this data available, which kind of defeats the point of what I'm doing. There's also a location attribute for each user, which seems more promising. Given that user input/format is unpredictable, my current solution is to manually create a hash of US states/major cities with coordinates (in geo json- to feed to google maps) and reg ex to match with the user's location strings. Does anybody know of a better way to do this?
You can create a filter for the Streaming API which will only show you Tweets which have location information.
I assume, from your question, that you're only interested in messages from within the continental USA?
In which case, add the following parameter to your streaming request
locations=24.431150,-123.574219,47.683144,-59.238281
That's roughly the bounding box - you can adjust as you see fit.

Create routes/waypoints/polylines on google map; store and retrieve them later

I want to create a web app that lets me create, store and display my travels. Something similar to this service here actually.
The basic structure/ideas:
create my trips by the following options
load a gpx
create a polyline (e.g. flight path)
create a route using google directions
Each trip consists of one ore several "stages" or "legs" that each can be creates like above
store the routes so that i can display them on a google map or edit them (draggable) later
So one map would then contain several "trips" that look like this
I have already read a lot about this matter and I think I should be able to handle the part about creating the routes, however when it comes to storing them I'm not sure if I have understood what's possible and how to do it.
My questions:
Storing: I was thinking to either convert each trip once it is complete to their own XML file containing all the required information such as waypoints and stages. Those file would be stored on my webspace and can then be parsed to display the trips at any time
I see a problem however when creating a leg using google directions: how can I store/retrieve such a leg and conserve the directions informations? It's rather easy as long as I don't change the route by dragging wayoints (I coudl simply store the start and end points and create it on the fly) however I would like to be able to edit them later, again by dragging the line. Would it be possible to extract all the additionally inserted waypoints to recreate the route later by using not only the start and end point but also those additional points (i.e. will google show me the same variation of the route?)
Is there any aspect that is against the terms of gmaps?
I could also use a mySQL database to store the information, is this the better approach?
BTW I am new to the whole gMaps API programming. My system is php based.
I would recommend you a mysql database to store the information. A directions is only a bunch of lat-long pairs, travel time, and polyon points. Usually I store it in a JS array but you can also use a Json or JS objects. I think you can serialize the array and store it in database. I would use xml only for configuration or formated output with xlst. The idea is also to store the lat-lng as points and use a spatial index on it to get faster search.

Google Maps - Places library - Search for custom placed markers in radius

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.