google maps - Convert lat/lon to pixels and back -
I am using Google Maps in my application, and I have a database that is filled with latitude / LAN values. has gone. I want to mark them on the map, but I want to cluster them together if they are within every pixel-distance.
I think if I remove all points from the database, then I should be able to do something like this (pseudocode):
clusters [] ; While (count (points)) {cluster []; Point = points.pop (); Boundingbox = PixelOTBB (Point, Pixelestance, ZoomLawl); Query = "From the database where the ElT> Boundingbox. Mineral and Late and Left. Boundingbox.Maxlat and LNG> Boundingbox; mining and LNG & lt; Boundingbox.maxlaunch; (Results in execution) {cluster [] + = results; Points.remove (results); } Cluster [] + = cluster; } PixelsToBB (point, distance, zoomlaywall) {center = convertXY (point, zoomleval); Maxlng = convertToLng (center.X, distance, zoomleval); Minlng = ConvertTelling (center.X, -distance, zoomlevel); Minlat = convertToLat (center y, -distance, zoomlevel); Maxlat = convertToLat (center, y, distance, zoomleval); Returning boundingbox (moreamlang, MaxLat, Minnang, minalat); }
What should I do with my PixelTobb function with ZoomLowl? Or what do I need to convert, convert and convert to my convert? Am I thinking about this right or is there any better way to do this? I do not even know what to look for, so if I have been asked before going for forgiveness.
Using Google Maps API v3 ...
var LatLng = // your position object here var projection = map.getProjection (); Var border = map.getBounds (); Var topright = Projection .fromLatLngToPoint (bounds.getNorthEast ()); Var bottomlift = projection .fromLatLngToPoint (bounds.getSouthWest ()); Var scale = Math.pow (2, map.getZoom ()); Var worldpoint = projection From Late LongTong (latLng); Return [Math.flur ((worldpoint.x - bottomlieft.x) * scale), Math. Floor ((worldpoint.y - topright.y) * scale)];
Comments
Post a Comment