giftplus.blogg.se

Maptiler changing zoom level
Maptiler changing zoom level








maptiler changing zoom level

Usage: map.Zoom = CalculateGMapZoom(mapa. Another way of initializing the map is by using setView(). Return (zoom > maxZoomLevel ? (double)maxZoomLevel: (zoom < minZoomLevel ? (double)minZoomLevel: (double)zoom))

maptiler changing zoom level

Int pixels = mapSize.Width >= mapSize.Height ? mapSize.Height : mapSize.Width //get the shortest dimmension of the mapĭouble k = (double)pixels * 156543.03392 * Math.Cos(latitude * Math.PI / 180) Static double CalculateGMapZoom(Size mapSize, int coverage, double latitude, double distance, int minZoomLevel, int maxZoomLevel) / Distance to show from this point in meters / Latitude where the point to draw is located / The size of the control (map size in pixels) / Zoom map to fit the desired distance from point

#Maptiler changing zoom level code

Use this function in order to get the best zoom based on your current location and a distance to the point (C# code tested with on VS2022 but zoom levels and algorithm are the same for Google): /// Meters_per_pixel = 156543.03392 * s(latLng.lat() * Math.PI / 180) / Math.pow(2, zoom)įormula is from Chris Broadfoot's comment. A formula for calculating the correct scale based on latitude is: Google Maps uses a Mercator projection so the scale varies substantially with latitude.

maptiler changing zoom level

It appears that the extra zoom level available for Static Maps is just an upsampled version of the max-resolution image from the Javascript API. Note that these values are for the Google Static Maps API which seems to give one more zoom level than the Javascript API. "Deep zoom" locations: 22-23 (see bkaid's link).Hybrid and satellite maps - the max available zoom levels depend on location.Road maps - seem to go up to zoom level 22 everywhere.A 256x256 tile for zoom level 1 enlarges a 128x128 pixel region from zoom level 0.Īs correctly stated by bkaid, the available zoom range depends on where you are looking and the kind of map you are using: Google Maps was built on a 256x256 pixel tile system where zoom level 0 was a 256x256 pixel image of the whole earth. Zoom level 0 is the most zoomed out zoom level available and each integer step in zoom level halves the X and Y extents of the view and doubles the linear resolution.










Maptiler changing zoom level