I'm a CS student and I'm developing an Android app that uses Google Maps API. The problem is the map I'm working on is indoor and I'm facing problems when I want to draw a path from user location to specific location he chose, because Directions API doesn't work with indoor map.
And when using a drawPolyLine method it draws a line that passes through walls, bathrooms, and anything on its way. So to solve this problem I made a GeoJSON file with linestring and polygon of each obstacle in that map.
And now I want to use the available drawing methods along with the geoJSON file to read the points/polygon and avoid it while drawing the path on the map.
Could please give an idea or anything that could solve my issue?
Related
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/
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'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
I am working on application in which i have integrated drawing polygon functionality. Drawing polygon functionality is working great but i need to built another functionality where user can save the polygon search. For that to that to work i need to save polygon paths points which i have already saved now i need to know is there function in gmap to which we pass draw polygon points and it draws the polygon automatically or is there any workaround to built this functionality.
Looking forward for your response.
Google Maps newbie (GIS newbie), I'm looking at a solution to map an overlay (number of polygons) on-top of Google maps and wondered if using a KML file was a viable solution?
Basically, I have a number of address (address data) that I will pass to our internal GIS system, the GIS system hands me back a KML file (one file with a number of different locations) and then I draw the polygon using the KML Layering options:
https://developers.google.com/maps/documentation/javascript/layers
Sound like a viable solution?
Cheers
Yes, it is a viable solution. Using KML Layer to display kml will cause the data to be rendered as tiles. You could also import your kml into FusionTables and use a FusionTablesLayer.