TLDR: I want this, but I am happy to send the data in my database to google as it is created (any user can create a location on the map).
I need to create a lot of map markers on a google map for a website I am creating. Insertions and deletions will be required, but I will never need to filter the data. I found several links showing how to create this map to make it accessible through the use of google docs' spreadsheet, however I have a database of latitude/longitude coordinates in google app engine. My preferred method would be for google to host the map and me to send insertion / deletion queries to the map itself (as the map is constant for all users). This sounded exactly like fusion tables, but I couldn't actually find out how to do it programatically in fusion tables
I know how to create individual points on a map, but there will be a lot of points so sending every single point to the client will be way too slow. My backup plan is simply to use a quad tree and get the client to send the server the bounds of the map and reply with everything in there, but I suspect google has a better solution.
Depending upon the size of your data set and how many insertions and deletions you need to make each day, you might want to consider using the Fusion Tables API. You can do a "replaceRows" operation to swap out the entire table contents, or individual "insert" and "delete" calls. (Of course then your data is stored in Fusion Tables.)
You can then embed your map in the website of your choice, or even host it on Google Drive.
Related
I'm working on new application in my workplace as described below:
We have tens trucks working for us. I've installed a GPS module on each of them to track their position and store their coordinates in a database.
I need to see their movements in real time on a map (Google Maps, or Bing Maps) but I don't know how to do this.
I don't want code or snippets, I prefer Guidelines and API Docs or framework to build it!
If you have any question ask without problem! Thanks guys
Since you have the data in a database, the first step would be to expose that data to your app. There are a couple of different ways to do this depending on the type of app you want to create, however the most universal solution would be to create a web service that any of your apps can connect to. Here are a couple of good blog post on how to create spatial web services.
http://blogs.bing.com/maps/2013/07/31/how-to-create-a-spatial-web-service-that-connects-a-database-to-bing-maps-using-ef5
http://blogs.bing.com/maps/2013/08/05/advance-spatial-queries-using-entity-framework-5
Once you have a web service you can then create the app that will display the truck locations. You have a lot of options here; web, mobile, desktop (WPF, Windows app), cross platform. Web apps tend to be the most common as they can be accessed from the most locations. Connecting to a REST service from JavaScript is fairly easy. There is a number of different ways to load in real time data. The easiest is to use a timer that calls your web service regularly and grabs all truck locations. A slightly more complex option, but more efficient is to timestamp the last update of each location and then keep track of the last timestamp used to request an update. By doing this you can limit your request to only retrieve updates that have occurred since the last request. This would significantly reduce your bandwidth and make your app faster. Displaying the actual truck location on a map is easy. Your web service will return the location information, likely as either two number properties (i.e. latitude/longitude) or as a well known text string (simply parse this as shown in the previous blog posts). If using Bing Maps and you have two number properties, you can create a pushpin and add it to the map like this:
var loc = new Microsoft.Maps.Location(latitude,longitude);
var pin = new Microsoft.Maps.Pushpin(loc);
map.entities.push(loc);
Here are some useful resources around developing with Bing Maps:
https://www.bingmapsportal.com/ISDK/AjaxV7
https://msdn.microsoft.com/en-us/library/dd877180.aspx
Note, if you use Bing or Google maps (or just about any other major mapping platform), they require all asset tracking applications to have a license to use the maps. If you use Bing Maps, you can find details on licensing here: https://www.microsoft.com/maps/licensing/licensing.aspx#mainTab4
I would like to create a Map by the excel sheet values (.csv files too).
By using FusionTableLayer API, I think it is possible. At first step we could upload the excel values to the database. Then we create a map by the database annotated value. It is very good idea. This is what I wanted. But One thing is problem to me with FusionTableLayer API is google's Drive has been pointed for the fusion table. It means that all my business data will be shared with google. I don't want to be like that.
Instead of Google's drive My database has to be pointed out. From my database I would like to create a map with FusionTableLayer API. I have been searching through internet, I dont find this is possible. But I believe that it is possible. Please guile me to specify the way to trigger it out ?
Regards,
ArunRaj.
If you want to use your own database, then you cannot use the Fusion Table API as it's meant for the Google Infrastructure. You will have to find another API to take care of this.
One workaround I can suggest to you is to parse points you have as drawing objects for your map. So for each point, create new google.maps.Marker with the respective coordinates. Each region can be denoted with google.maps.Polygon, and lines with google.maps.Polyline. There's plenty more you can do, but it's just a bit more work, and possibly less secure depending on your implementation. Furthermore, you can also add info windows to each of those areas using the Google Maps API by attaching respective listeners to those objects created.
Hope this helps!
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 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.
I have a KML-file with lots of data in it. I would like to show the data in a google map (or something similair) When the KML-file updates, I would like the google map to update. Is this possible?
What to you mean KML-file updates?
Are you generating the KML from your database so updates means that more points are inserted to your db?
Anyway if that's the case you can construct the browser to periodically ask the server if this KML is updated,retrieve it and finally remove the expired file from the map and show the new.
Because as far as i know there is no way you can "sync" the KML overlay automatically.