Deeper zoom needed in Google Map API

We are developing a GIS application on top of Google Map (using Google Map API v3), however the application requires the user to zoom in close since some of the map objects are small (down to about 1 meter), and will require graphic editing.

What is the best way to extend the zoom-range in Google Map API, down to maybe zoom level 30? Can we implement a tile server that "takes over" when Googles tileserver hits the limit? Or make Google Map API just use graphic enlargement for the zoom levels beyond what it has data for? Any other possible approach?

This problem is especially troublesome when using Hybrit or Satellite map, since they have a more shallow zoom level (seems to be around 18 on our locations).

The picture below shows the deepest zoom and how its not quite enough: 在这里输入图像描述

/Magnus


The way you extend the zoom range is by creating a custom MapType . Then you can specify the minZoom and maxZoom . If your map tiles are ordinary images, you can use the ImageMapType which will do some of the bookkeeping for you. Or you can go for a full-blown custom MapType if necessary.

Here's an example of an ImageMapType that has custom zoom levels and image tiles.


Here is how I finally solved it. Not a perfect solution, but good enough for my purposes:

  • Create and add a custom maptype with nothing but blank tiles, but with a high max-zoom.
  • Hook into mousewheel event before Google gets it (see here: Hooking into mousewheel event in Google Map API )
  • When zooming in with mousewheel, check if at maxZoom and if so switch to blank map (and mark for switching back when zooming out). Since mousewheel hook is before google gets it, the zoom will not be interrupted even though the maptype is changed.
  • The biggest problem was to determine if map is at max zoom (the MaxZoomService only works for satellite images). I ended up with an ultra-ugly solution: checking the position of the zoon-handle in the zoom control :-)


    This might be better than the code you use to look at the scroll bar, because on small screens that might be different.

    If the zoom doesn't change, that means google is at max zoom.

    var wheelEvent = function() {
        console.log('zoom before', map.getZoom());
        setTimeout(function() {
          return console.log('zoom after', map.getZoom());
        }, 0);
      };
    })(this);
    
    $('#map-canvas')[0].addEventListener('mousewheel', wheelEvent, true);
    $('#map-canvas')[0].addEventListener('DOMMouseScroll', wheelEvent, true);
    
    链接地址: http://www.djcxy.com/p/81594.html

    上一篇: Google地图捏缩放事件

    下一篇: Google Map API需要更深的缩放