How to track multiple vehicles with Maps API - google-maps

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

Related

Is there a platform agnostic HTML5 map service?

I have a Blazor combined client/server side app that uses HTML5 geolocation to return the user device latitude/longitude. I'd like to be able to provide the general "area" the user is in - a bit of a confirmation to the user the thing is working; and someday potentially enable the user to get lat/long for other locations as well. I have not been able to find a native HTML5 map service to go along with its geolocation capabilities, and in fact nearly every search leads to how to connect to Google Maps. I'm using Blazor, though, because I want the app to run and function on essentially every browser, so want to avoid Google Maps or Apple Maps, etc. I also checked quick on GitHub for potential API solutions but didn't see any. Ideas? Thanks!

Understanding Requests from Google Places API for Web w Place Autocomplete

We are considering using Google Places API for a new web application project and I believe we are vastly underestimating the number of requests we would use.
We would be using place search, Maps JavaScript API map load to grab Place IDs from Google as well as Place Autocomplete to help users find the defined location. So my questions are:
Would the Autocomplete be considered a request on every keystroke?
Would if also be a request when we select the suggestion (Places API)
and update to Map?
I have seen that with the premium Plan autocompletes use 0.1 Maps API Credit, while JavaScript API map load is 1 and Places API is 2 credits. Trying to understand how to count before the 150k limit and after
As mentioned in the comment of your question, Google is making some drastic changes to their collective maps API usage rates. Starting June 11th, the new pricing will go into effect.
Would the Autocomplete be considered a request on every keystroke?
As of now, places autocomplete is counted on every keystroke. Starting June 11th, you have the option to switch to session-based billing. They have different pricing rates which can be see in the pricing sheet link. Depending on your application, you'll want to use the option that minimizes API calls. I think if your use case is one time selecting of location by your users then you're better off with billing by keystroke.
Would if also be a request when we select the suggestion (Places API)
and update to Map?
Selecting a suggestion from Places API would not incur an API request (requesting the suggestions does), but updating a google map using the Map API would use an API request.
The 150k daily limit is going away in favor of the new billing rates, so I would suggest you look into that now. There are some free unlimited services still offered, like the Google Maps Embed API. Loading a map using the Embed API is not counted towards any billing (as of now).

For Developing Location based reminder mobile app, which one is good..... Google Maps or Nokia maps

I am developing GPS based Location reminder in j2me. I am little bit confuse to which maps i use??.....Google maps & Nokia maps. Which one allows me good working... The working of my app are as follows :-
-User will provide a string to app to search a place of his/her desire.
-Then according to given string app will show a place on map by pointing marker on map.
-User can save that place or he/she can select a near by place rather than searched place by clicking on map or any other way.
-app will save that searched place coordinates & remind when it reached to near that place.
-When app remind to user about already stored place... that place should show on map by pointing an marker along with the how far he is from his destination.
The real choice here lies in whether to use a RESTful API like the Google Static Maps (or Nokia's RESTful Maps) or to use a native Java ME mapping library plugin such as the Nokia Maps API for Java ME. The latter has several major advantages:
Static mapping services such as the Google Static Maps API or Nokia's
RESTful Map API do not cache or tile the images when requested,
therefore each request involves a round trip to the server. If the
map on a mobile application needs to be refreshed at any time, using
a caching library will result in a reduction in network traffic after
around three maps have been displayed. An explanation of this can be
found here
As the name implies, Google's Static Maps API can only retrieve over
http static images for a requested coordinate point, image size,
image type and zoom level. Newer libraries offer additional
functionality out of the box offering dynamic Map content and touch
support, where the user can move around his/her current position,
zoom in, zoom out, modify the view mode to satellite or translate an
address to a coordinate point and show that on the map, among others.
This abstraction of the underlying functionality is hidden from the
developer so much less coding is needed in order to achieve the same
result .
Terms and Conditions for Nokia Maps are easier to fulfil than
Google - No legal restrictions of using the API outside a web browser
application or need to provide a link to the native Google Maps App
(if there is one), or to Google Maps (if there isn't one).
Nokia currently offer higher free daily request limits. Nokia Maps
API for Java ME supports up to 50,000 render requests per day and per
unique IP address (as of January 2012), for Nokia Developer
registered users (free of charge) while the limit for Google's Static
Maps API is currently 1000 unique (different) image requests per
viewer per day.
A couple of years ago there wouldn't be a choice, only RESTful solutions existed, but these days I would say a static http solution should only be used if you want a simple single image
As an abstraction of the underlying services, there are already a full set of examples to cover most of your use cases:
-User will provide a string to app to search a place of his/her desire.
-Then according to given string app will show a place on map by pointing marker on map.
http://www.developer.nokia.com/Commu...PI_for_Java_ME
-User can save that place or he/she can select a near by place rather than searched place by clicking on map or any other way.
Maybe you need to use a draggable marker:
http://www.developer.nokia.com/Devel...ples/#standard
Or react to the touch and find a Geocoordinate:
http://www.developer.nokia.com/Commu...PI_for_Java_ME
-app will save that searched place coordinates & remind when it reached to near that place.
This is known as geofencing and is covered by the Location API:
- http://www.developer.nokia.com/Resou...ty-events.html
-When app remind to user about already stored place... that place should show on map by pointing an marker along with the how far he is
from his destination.
Showing a Map with a Marker
http://www.developer.nokia.com/Devel...ples/#standard
For distance calculations, I guess you'd be after the ROUTING example
http://www.developer.nokia.com/Devel...mples/#routing
http://www.developer.nokia.com/Commu...g_with_Java_ME
Now you could re-write and all these services from scratch using RESTful APIs (and then go about debugging your code) , but I'm sure you'll agree it would be much easier to use an existing, working and tested framework for the low level plumbing and then just write your code on top using the services.
It is possible to encapsulate RESTful service in Java ME. As an example, added below is a screenshot from an app encapsulating the suggestion service
It is just a lot easier when someone else has already done this work for you and placed it in a library.

use multiple Google Maps API Keys for same server?

I have a server which acts as a mesh.
I have 3 mobile apps, each having it's own google maps api Key
all three apps call my server which calls the google apis with the specific app key.
so App1 has key1
App2 has Key 2
App3 has key 3
when I need the directions for App1, my server calls google api with key 1
when I need the directions for App2, my server calls google api with key 2
when I need the directions for App3, my server calls google api with key 3
So my server works like an API mesh. Is this against google terms? I am afraid they will look at the ip address of the server, see there are 3 keys used and assume I am using different Keys for same applications which is prohibited.
The short answer (drawn from the FAQ) is quite simply : no, you can't use two keys in this case.
See https://developers.google.com/maps/faq#usage_avoidance
- they even reserve "the right to withhold access to the maps API from any site" doing so, just as you feared.
Using more than one key, even though it could only be a matter of convenience for you, means for them trying to cheat and bypass the limitation of 25,000 requests per day and per service. And they don't like that, because they want big users of their maps API to pay, of course. Prices are listed on the same page.
You should read the FAQ paragraphs "Understanding the Terms of Service" and "Usage limits" completely - it is quite short but sometimes a little tricky. You'll see that there are a few situations in which you do not actually have to pay even when exceeding limitations :
you are using the google earth API
you are using a native maps API from a mobile platform
you are showing a google map through an embed only
your apps are "in the public interest (as determined by Google at its discretion)"
Also, you do not always need to provide an API key, though these products may still be available for limited use only : take for instance the geocoding API.
I guess you're not in one of those cases (at least bullets 2 and 3) since your calls transit through your server. Using the native APIs in mobile apps would solve the problem, but it does mean quite some development I guess.
It is also worth noting that you should apply for a special maps API for business license for some use cases, e.g. when only paying users get to see your map.
In conclusion, you need to have one single google maps API key when it comes to using their products that require one. Or rather, at most one per domain name.

List businesses - Google Maps APIs Terms of Service

The website I am working on should keep a list of many businesses located at different cities. I add those business manually into my database, and later need to display them with Google Maps using markers (so the main purpose of the map is to display a list of businesses). The map is public and no fees are charged. I am not retrieving businesses' information from Google. What I do not understand is whether I am allowed to use Google Maps to display a list of businesses or not.
I can not quite understand this point of their ToS
10.2 (b) No Business, Residential, or Telephone Listings Services. You must not display business listings Content in any Maps API Implementation that has the primary purpose of making available business, residential address, or telephone directory listings.
Does this basically say that I can implement a service to list businesses, but I cannot query Google to obtain information about other businesses and add them to my own list?
Thank you
Firstly I am not a lawyer but I have taken a good look at the Google Maps licensing and I would read it the opposite way that you have read it. I think that displaying business listings on a Google map violates their ToS.
10.2 Restrictions on the Types of Applications that You are Permitted to Build with the Maps API(s). Except as explicitly permitted in Section 8 (Licenses from Google to You) or the Maps APIs Documentation, you must not (nor may you permit anyone else to) do any of the following:
....
(b) No Business, Residential, or Telephone Listings Services. You must
not display business listings Content in any Maps API Implementation
that has the primary purpose of making available business, residential
address, or telephone directory listings.
It seems to me the criteria that is being evaluated is the type of service you are offering and if the type of offering is a business listing service (which it sounds like you service is) then you are not allowed to use the Google map API. This makes sense as it would be hard to differentiate that sort of business listing from the service that Google provide.
However, there are a number of free options you could use to put markers on maps that you should look at which avoid this issue. These include:
OpenLayers
GeoExt
PolyMaps
Leaflet
As you have created your own database I suggest you to create a web service of it and then use that data to display it on map.
Refer this link..This one is the best for your question. It explain each every steps from DB to Google Maps.
https://developers.google.com/maps/articles/phpsqlsearch_v3
Another thing which you can do is that you can upload the bulk data on Google's Places and then you can use Google's Places API to fetch the data. But one thing which you i would like to point is that if you use Places API then it will provide you maximum 20 results. Refer this links.
Bulk data upload
Hope this will help you....