How to get your image URL tiles? (google maps)

2019-02-15 06:42发布

I'm looking on how to generate your own image tiles and put to the server as this example do. The example load tiles from http://mt3.google.com/mapstt?..., but how if I want my image?

var trafficOptions = {
  getTileUrl: function(coord, zoom) {
    return "http://mt3.google.com/mapstt?" +
    "zoom=" + zoom + "&x=" + coord.x + "&y=" + coord.y + "&client=google";
  },
  tileSize: new google.maps.Size(256, 256),
  isPng: true
};

var trafficMapType = new google.maps.ImageMapType(trafficOptions);

var map;
function initialize() {
  map = new google.maps.Map(document.getElementById("map_canvas"));
  map.setCenter(new google.maps.LatLng(37.76, -122.45));
  map.setZoom(12);
  map.setMapTypeId('satellite');
  map.overlayMapTypes.insertAt(0, trafficMapType);
}

I was looking on how to generate tiles form an image and I've just founded that you have to us MapTiler (http://www.maptiler.org/).

There's another way?

I think that I miss some kwnoleadge. Can anyone give an example?

Thanks!!

1条回答
Summer. ? 凉城
2楼-- · 2019-02-15 07:31

I would recommend you use GDAL (a command line interface) to slice up the image. You could also use maptiler, but it places an annoying watermark on every image Might as well use the original GDAL that maptiler is based on. A very useful tutorial can be found here http://alastaira.wordpress.com/2011/07/11/maptiler-gdal2tiles-and-raster-resampling/

查看更多
登录 后发表回答