我用gdal对图像栅格进行了地理配准,并使用EPSG创建了一个新的geotiff:3857 . 现在我想在我的网站上显示它,我有两个问题,可能是因为我不太了解gdal,特别是gdal2tiles的工作原理 . 我使用gdal2tiles.py -p mearcator z 1-8 source.tif Directory_tile,我试图通过openlayers 3.15.1显示这个图块....我怎么能这样做?这是我的代码:

var mapMinZoom = 1;
      var mapMaxZoom = 8;
      var mapExtent = [32.93099653057996,5.51726084641600,47.57860125775348,19.97855309050547];
      var valEnd='EPSG:900913';
      var map = new ol.Map({
        target: 'map2',
        layers: [
          new ol.layer.Tile({
            source: new ol.source.OSM()
          }),
          new ol.layer.Tile({

            extent: mapExtent,
            source: new ol.source.XYZ({
                url:'./assets/Directory_Tiles/{z}/{x}/{y}.png',
                tilePixelRatio: 2,             
              type: 'png',
              minZoom: mapMinZoom,
              maxZoom: mapMaxZoom
            })
          })
        ],
        view: new ol.View({
          projection: valEnd,
          center: [4720563.24719968624413,
                   614178.66799669514876],
          zoom: 5
        }),
        maxResolution: 7520.000000,
        rendering: 'canvas'
      });

这是描述geotiff生成的tile的xml:

<?xml version="1.0" encoding="utf-8"?>
    <TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
      <Title>source.tif</Title>
      <Abstract></Abstract>
      <SRS>EPSG:900913</SRS>
      <BoundingBox minx="32.93099653057996" miny="5.51726084641600" maxx="47.57860125775348" maxy="19.97855309050547"/>
      <Origin x="32.93099653057996" y="5.51726084641600"/>
      <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>
      <TileSets profile="mercator">
        <TileSet href="1" units-per-pixel="78271.51695000000473" order="1"/>
        <TileSet href="2" units-per-pixel="39135.75847500000236" order="2"/>
        <TileSet href="3" units-per-pixel="19567.87923750000118" order="3"/>
        <TileSet href="4" units-per-pixel="9783.93961875000059" order="4"/>
        <TileSet href="5" units-per-pixel="4891.96980937500030" order="5"/>
        <TileSet href="6" units-per-pixel="2445.98490468750015" order="6"/>
        <TileSet href="7" units-per-pixel="1222.99245234375007" order="7"/>
        <TileSet href="8" units-per-pixel="611.49622617187504" order="8"/>
      </TileSets>
    </TileMap>