Because the recent project needs to use a CAD-made map, but has been using the Google Offline tile map, how to map the CAD image with the same zoom, mobile functions put on the page display as a problem,
The original Google map of the code can not be used? How long does it take to re-write a set of code, and how much time and effort?
So began to try N methods, the last to find may be the best way to follow the existing code, the method is: the first to use ArcGIS software, the CAD diagram into an mxd file (of course, the difficulties are not mentioned, and the effect of the conversion may not be the same as the CAD),
Finally asked is the study of geographic information System Professional friends just to fix. Second, publish the MXD as a GIS service, need to generate tile files, if the publication successfully access http://localhost/ArcGIS/rest/services/service name/mapserver will display the corresponding map information,
Finally, use the following Google Map script file to call the corresponding URL
//Set Center location varMycenter =NewGoogle.maps.LatLng (34.573380321227, 115.42915725708); functionCoordmaptype () {} CoordMapType.prototype.tileSize=NewGoogle.maps.Size (256, 256); CoordMapType.prototype.maxZoom= 15; CoordMapType.prototype.minZoom= 11; CoordMapType.prototype.getTile=function(coord, Zoom, ownerdocument) {varimg = ownerdocument.createelement ("img"); Img.style.width= This. Tilesize.width + "px"; Img.style.height= This. Tilesize.height + "px"; varstrURL = "http://localhost/ArcGIS/rest/services/Service name/mapserver/tile/" + zoom + "/" + Coord.y + "/" +coord.x; IMG.SRC=strURL; returnimg; }; CoordMapType.prototype.name= "Tile #s"; CoordMapType.prototype.alt= "Tile coordinate Map Type"; functionGetcoordinatemaptype () {return NewCoordmaptype (); } //Initialize Map functionInitialize () {varMapoptions ={zoom:11, Center:mycenter, Maptypeid:"Coordinate" }; Variable.map=NewGoogle.maps.Map (document.getElementById ("Map_canvas"), mapoptions); Variable.map.mapTypes.set (' Coordinate ', Getcoordinatemaptype ()); }
HTML code
<div id= "Map_canvas" ></div>
Google map API V3 calls the ArcGIS published tile map Service