I have build employee location history tracking app in Ionic 4.
The process is as follows:
1- There is a service which fetches the current location after 5 second
2- Upload the fetched coordinates to database
But sometimes the location fetched is incorrect i.e 4-5 meters away from where the current employee is. I dont know why is this happening even though I am using accurate location fetching.
Anyway,
In admin panel, I draw the polygon on Google map from the coordinates which were saved.
As you can see the polygon and the whole track is quite weird.
Is there any way to draw the lines as we get in directions API?
Or something like trailing line drawn like this in life360 App.
I want the history locations to be drawn quite smoothly on maps instead of weird polygons line which doesnt bother the roads and paths
You can use the Directions API. Input all the points as waypoints and the response will contain an encoded polyline that will be on actual roads and look nicer than a polyline.
https://developers.google.com/maps/documentation/directions/
Related
I'm making an application that is uploading data from a gps device (the collection of points of where the vehicle has traveled). I'm having an issue when the vehicle stops or moves very slowly. The gps uploads repeated coordinates, which are unnecessary data.
Is there a way to check whether two (lat,lng) coordinates fall within the same road segment?
Maybe you can check by reverse geocoding and checking the reference-id in response
https://developer.here.com/api-explorer/rest/geocoder/reverse-geocode
Or you can use Route Match Extension to try to get the correct route.
https://developer.here.com/platform-extensions/documentation/route-match/topics/overview.html
I am playing around with the Google Maps JS API, Mapbox API and I was curious, how are markers actually added to a map? Does the backend code take a set of map tiles, convert the edges to lat/long, and then simply interpolate the lat/long of the marker coordinates along the X and Y axes?
I ask because I am building an application that would need 1000-5000 simultaneous markers, and want to build my own backend system as using the Google Fusion Tables API can get expensive.
how are markers actually added to a map
In the simplest implementation, markers are represented as GeoJSON or similar, and requested from the server, and then 'projected' into screen coordinates from lat/lon; see node-sphericalmercator for one example of that logic.
For the 'performant' case, like TileMill or Google's pre-rendering mode, markers are baked into raster tiles, PNG files, that show them and their locations, and you do magic like UTFGrid to do interaction.
Note that both of these are compromises: you can get speed, flexibility, and simplicity, but it's very hard to get all at the same time.
I have a GPS device which populates data continuously. I need to show the movement on Google maps. Like for example user is moving from Phoenix to LA. I need show his movement with blue marker on google maps showing his movement along with path traveled.
Is it possible is there an Maps API that does it for me like: I keep pinging the new lat, long to Google maps. And google maps keep showing the advancing movement on the map.
You need to implement a LocationListener which will force you to implement 4 methods. One of those methods is the onLocationChanged this method, when your location changes will update and do something that you want. I guess you want to update and show your current location.
It is very important that you use requestLocationUpdates() and check this out:
http://developer.android.com/training/basics/location/locationmanager.html
thats my scenario: I want to load a list of places of interest of a user based on his location (using HTML5 geolocation). But the problem is, I have a very big list of places (I don't want to have to load all places from my database), so the solution I have adopted until now is only to call mysql for the results in a given radius from the user, let's say, 1 km. But I'd like when user is dragging google maps to explore the map, load progressively the places for the area is shown on the map (basically something similar to what foursquare does).
Is there any simple way to achieve that? Hope I was clear with the question, thanks in advance, any help is appreciated.
Jesús.
General approach:
get the bounds of the map and query your data base for markers that are currently in view
optional, add padding to the bounds so some markers are available just out of view if the map is dragged
display the resulting markers
when the map is moved (bounds_changed event), query your database for additional markers
process through the returned markers, only adding those that are new (requires an array of existing markers and a way to determine that the existing marker and a newly downloaded marker are the same)
Searching the Google Maps API v3 group (and the Google Maps API v2 group, the concepts will apply but the code samples may not) should give you some examples.
We have a database of addresses that we deliver to. It consists of the following data;
StreetName
NumberFrom
NumberTo
ZipcodeId (points to seperate table with zipcodes, which holds cityName)
StoreId
Would it be possible to highlight all those addrresses on a map like GoogleMaps (preferred), Bing, OpenStreetMap, etc. ?
I know how to add polylines, and have done geocoding in the past for addresses.
A possible issue with the data, is where it covers whole street they practise have been to just set the NumberTo to 9999. If i plot an address into google Earth with 'StreetName 999, City' it will place the point in the middle of the length of the street.
Also tried a random number, and it placed the marker on a building instead of on the street.
I don't know if it's different for GoogleMaps..
Update
I think that the DirectionsService in GoogleMaps API is the way to go, now i only need to figure out if and how i can use it multiple times on a map.
Success!
I was able to iterate over all the addresses, doing a DirectionsService request for each addres, from start of street to end of street. Extract the GeoPoints used by DirectionsDisplay, stored it to the database and is now able to draw Polylines on a map for each road.
I could iterate over the addresseseach time the map is shown (in-house use only). But still this would be a performance issue, and also unsure if how many request Google will handle per day. By storing it in DB i only need Google to calculate it once.
It can, but only in certain areas of the world - e.g. US
But you need to prepare your adresses - lets say in div/spans - then on onload document, you calll the API
I did this using Lat/Lng from a Garmin Edge - the difference is that you need to translate your addresses into lat/lng, before you can position these on the map canvas.
Mike
Yes you can convert the Address to a GeoPoint and then plot the GeoPoints on the Map. Start by looking here