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.
Related
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?
I want to draw polygons in google maps and for these to be stored in mysql. I then want to be able to upload polylines and see if they intersect with the polygons. Is this possible?
I am not sure if you can do it with google maps, but you can use leaflet and openstreetmaps to develop it.
Using leaflet you can draw polygon and get that value in a textbox and save it in your database.
http://leafletjs.com/examples/quick-start.html
Try this example
https://github.com/Leaflet/Leaflet.draw
in my web app I am loading a kml file to the map - this works fine
in the same kml file (dynamically generated from php) I have some logic that checks if there are records returned from the DB if not it generates a kml polygon instead of placemarks
what I would like to do is make the polygon click events disabled while still allowing the markers/placemarks to trigger click events.
is this possible or will I have to load the polys to a separate kml layer?
https://maps.google.com/?q=http://biasigns.com/pdo_xmlgen09.php?city_id=5 the kml file
to see the polygon logic happening change the city_id to 8
I can paste all the code but am not sure its necessary to answer. let me know if you need to see more.
If you remove the <name> from the polygon (as well as the <description>), infowindows will be suppressed on Google Maps and on the Google Maps Javascript API v3 KmlLayer (but you might want the name).
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.
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.