首页 > 其他 > 详细

VUE+OPENLAYER系列一:OSM

时间:2020-09-19 13:23:02      阅读:62      评论:0      收藏:0      [点我收藏+]
<template>
    <div>
        <div>OpenStreetMap 有点慢</div>
        <div id="map"></div>
    </div>
</template>

<script>
    import ‘ol/ol.css‘
    import View from ‘ol/View‘
    import Map from ‘ol/Map‘
    import TileLayer from ‘ol/layer/Tile‘
    import {OSM, TileArcGISRest} from ‘ol/source‘;
    export default {
        name: "HomeMap",
        mounted() {
            var layers = [
                new TileLayer({
                    source: new OSM()
                }),
                new TileLayer({
                    extent: [-13884991, 2870341, -7455066, 6338219],
                    source: new TileArcGISRest({
                        url:‘https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer‘
                    })
                })
            ]

            var map = new Map({
                layers: layers,
                target: ‘map‘,
                view: new View({
                    center: [-10997148, 4569099],
                    zoom: 4
                })
            })
        }
    }
</script>

<style scoped>
    #map{height: 600px;width: 100%}
</style>

VUE+OPENLAYER系列一:OSM

原文:https://www.cnblogs.com/paladin1893/p/13695617.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!