Skip to content

Latest commit

 

History

History
80 lines (61 loc) · 1.76 KB

2.8README.md

File metadata and controls

80 lines (61 loc) · 1.76 KB

OpenLayers

@(笔记)[OpenLayers]@案例:https://github.com/lhywell/map/tree/master/example/example15


入门教程

简介

可以嵌入OSM、ArcGic等很多种地图源,开源的javascript库

官网:http://openlayers.org/

git:https://github.com/openlayers/openlayers

特征

  1. 高性能
  2. 支持OSM,Bing,MapBox,Stamen等多种瓦片
  3. 渲染GeoJSON, TopoJSON, KML, GML, Mapbox vector tiles,矢量数据
  4. 支持各种插件库
  5. 移动优先

图层

图层是用包含一个源的类型(Image,Tile或Vector)定义的

视图

允许指定地图的中心,分辨率和旋转。

查看API

示例

http://openlayers.org/en/latest/examples/

构建一个地图

<!doctype html>
<html lang="en">

<head>
    <link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">
    <style>
    .map {
        height: 400px;
        width: 100%;
    }
    </style>
    <script src="https://openlayers.org/en/v4.6.4/build/ol.js" type="text/javascript"></script>
    <title>OpenLayers example</title>
</head>

<body>
    <h2>My Map</h2>
    <div id="map" class="map"></div>
    <script type="text/javascript">
    var map = new ol.Map({
        target: 'map',
        layers: [
            new ol.layer.Tile({
                source: new ol.source.OSM()
            })
        ],
        view: new ol.View({
            center: ol.proj.fromLonLat([116.404, 39.915]),
            zoom: 12
        })
    });
    </script>
</body>

</html>

上一页:Leaflet.js

下一页:TURF