OpenLayers3-9-Canvas Tiles

本文介绍如何使用HTML5 canvas模块在客户端生成Openlayers的黑色格子线切片坐标,以及如何将显示的坐标转换为标准的xyz坐标。详细解释了坐标计算方法,并提供了相关API文档和代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址:http://openlayers.org/en/v3.13.0/examples/canvas-tiles.html

The black grid tiles are generated on the client with an HTML5 canvas. The displayed tile coordinates are OpenLayers tile coordinates. These increase from bottom to top, but standard XYZ tiling scheme coordinates increase from top to bottom. To calculate the y for a standard XYZ tile coordinate, use -y - 1.

Related API documentation:
ol.Map,ol.View,ol.control,ol.layer.Tile,ol.proj,ol.source.OSM,ol.source.TileDebug

翻译:
黑色的格子线是使用HTML5的canvas模块生成的。显示的切片坐标是Openlayers的切片坐标。是从下往上递增的。但是标准的xyz坐标拼接方案是从上往下递增的。为了计算从标准xyz切片坐标计算y,使用-y-1

相关的api文档包括:
ol.Map,ol.View,ol.control,ol.layer.Tile,ol.proj,ol.source.OSM,ol.source.TileDebug

<!DOCTYPE html>
<html>
  <head>
    <title>Canvas Tiles</title>
    <link rel="stylesheet" href="http://openlayers.org/en/v3.13.0/css/ol.css" type="text/css">
    <script src="http://openlayers.org/en/v3.13.0/build/ol.js"></script>
  </head>
  <body>
    <div id="map" class="map"></div>
    <script>
      var osmSource = new ol.source.OSM();
      var map = new ol.Map({
        layers: [
          new ol.layer.Tile({
            source: osmSource
          }),
          new ol.layer.Tile({
            source: new ol.source.TileDebug({
              projection: 'EPSG:3857',
              tileGrid: osmSource.getTileGrid()
            })
          })
        ],
        target: 'map',
        controls: ol.control.defaults({
          attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
            collapsible: false
          })
        }),
        view: new ol.View({
          center: ol.proj.transform(
              [-0.1275, 51.507222], 'EPSG:4326', 'EPSG:3857'),
          zoom: 10
        })
      });
    </script>
  </body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值