Skip to content

Commit e7a7288

Browse files
committed
fix openlayers mvt4326示例。review by songyumeng.
1 parent ec2c60b commit e7a7288

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/openlayers/mvtVectorLayer4326.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<meta charset="UTF-8">
55
<title data-i18n="resources.title_mvtVectorLayer4326"></title>
66
<script type="text/javascript" src="../js/include-web.js"></script>
7-
<script type="text/javascript" src="../../dist/include-openlayers.js"></script>
7+
<!--<script type="text/javascript" src="../../dist/include-openlayers.js"></script>-->
8+
<script type="text/javascript" src="http://openlayers.org/en/latest/css/ol.css"></script>
9+
<!--当前示例使用 ol-debug 原因:ol.format.MVT 默认坐标系为 3857,最新代码未更新该默认设置,需使用ol-debug,设置 defaultDataProjection 参数,以支持4326底图-->
10+
<script type="text/javascript" src="http://openlayers.org/en/latest/build/ol-debug.js"></script>
11+
<script type="text/javascript" src="../../dist/iclient9-openlayers.js"></script>
812
</head>
913
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%">
1014
<div id="map" style="margin:0 auto;width: 100%;height: 100%;border: 1px solid #dddddd"></div>
@@ -27,6 +31,11 @@
2731
}
2832
var vectorTileStyles = new ol.supermap.VectorTileStyles(stylesOptions);
2933
var vectorTileOptions = ol.source.VectorTileSuperMapRest.optionsFromMapJSON(url, serviceResult.result);
34+
vectorTileOptions.format = new ol.format.MVT({featureClass: ol.Feature});
35+
vectorTileOptions.format.defaultDataProjection = new ol.proj.Projection({
36+
code: 'EPSG:4326',
37+
units: ol.proj.Units.TILE_PIXELS
38+
});
3039
var vectorLayer = new ol.layer.VectorTile({
3140
//设置避让参数
3241
declutter: true,

0 commit comments

Comments
 (0)