How are markers added to a map (Google JS api, Leaflet, or Mapbox)? - google-maps

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.

Related

Google Maps API Employee Tracking History

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/

What does Xamarin.Forms.Map display?

I used this Xamarin.Forms Map tutorial to create a simple app that displays a map and plots several points (from our database). The app works as it should, and that would normally be enough.
But I wanted to make my app different, and I wanted to use another type of map. For example, Waze and Google Maps both show me how to get to my nearest Walmart, but I like Waze's map more.
So my question is: what exactly does Xamarin.Forms.Maps display? It's a control that shows a map, but why does it show a Google Map instead of, say, a MapBox?
And since Google Maps and Waze are owned by the same company, why wouldn't I be able to display the Waze map instead of the Google Map?
Finally, what other map control options do I have? My app simply takes several coordinates from a sql table and plot the points in the map.

Google Maps API v3 pathing with location service

I'm using Google Maps for my campus map and I already have all the overlays for the buildings done along with javascript to open windows when clicked on the overlay, etc. The next problem I'm trying to tackle is how to get directions from point A to point B (using point A as geolocation). On my campus there is about 2.5 miles+ of sidewalks but they aren't defined paths in google maps, so i cannot use the built in directions which Google maps offers.
Is there any way i can make it so it displays directions from point A to point B while making it so it displays a path along a sidewalk?
Thanks in advance.
EDIT: I already have the geolocation working also.
If Google doesn't know about the sidewalks, you will have to do the drawing yourself. You will need to store information about the sidewalks in a database, then come up with a routing algorithm, then draw a line (using the Polyline class).
For routing algorithms, you might be able to get away with using Dijkstra's algorithm
http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
or you could try A*
http://en.wikipedia.org/wiki/A*_search_algorithm
or one of the other algorithms you can find in the Wikipedia sidebar on the Dijkstra and A* pages.
Polyline documentation:
https://developers.google.com/maps/documentation/javascript/overlays#Polylines

Real-Time update of markers in google maps?

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.

Topographical or relief data in Map APIs

I was wondering if anyone knew of any map APIs that offer topographical or relief data? I've had a quick look at Google and Bing APIs, but could find nothing there.
Google allow you to view a map as TERRAIN, which means you can see the topography of a map, but I want to be able to get at that data - i.e. if I were to draw a line between 2 points on Google Maps, I want to know how high above see level points along that line are.
Is this possible with any map APIs out there?
Thanks for your time!
Here's a simple example of height along a route.
I use USGS to obtain the elevation data, Google Maps API to plot the route and Google Charts to draw the elevation profile.
Full details in the associated tutorial.
Here are a few web services that provide elevation data:
USGS Elevation Query Web Service
EarthTools
GeoNames
Also, this site can search each of them