【发布时间】:2018-05-01 12:26:26
【问题描述】:
我能够使用 ngx-openlayers 和以下代码加载地图
<aol-map [width]="'100%'" [height]="'100%'">
<aol-view [zoom]="zoom">
<aol-coordinate [x]="5" [y]="45" [srid]="'EPSG:4326'"></aol-coordinate>
</aol-view>
<aol-layer-tile [opacity]="opacity">
<aol-source-osm></aol-source-osm>
</aol-layer-tile>
<aol-layer-vector [opacity]="opacity">
<aol-source-vector>
<aol-feature>
<aol-geometry-point>
<aol-coordinate [x]="5" [y]="45" [srid]="'EPSG:4326'"></aol-coordinate>
</aol-geometry-point>
<aol-style>
<aol-style-circle [radius]="10">
<aol-style-stroke [color]="'black'" [width]="width"></aol-style-stroke>
<aol-style-fill [color]="'green'"></aol-style-fill>
</aol-style-circle>
</aol-style>
</aol-feature>
<aol-feature>
<aol-geometry-point>
<aol-coordinate [x]="5.1" [y]="45.1" [srid]="'EPSG:4326'"></aol-coordinate>
</aol-geometry-point>
<aol-style>
<aol-style-icon [src]="'assets/marker.png'" [anchor]="[0.5, 1]" [anchorXUnits]="'fraction'" [anchorYUnits]="'fraction'" [scale]="0.1"
[anchorOrigin]="'top-left'">
</aol-style-icon>
</aol-style>
</aol-feature>
</aol-source-vector>
</aol-layer-vector>
</aol-map>
我的问题是我想使用 http://localhost:8090/tileserver.php#trails/ol3 URL 上的 MapTile 服务器加载我在本地计算机上提供的自定义地图位置。 现在来自上述服务器的 XYZ URL 是 (http://localhost:8090/tileserver.php?/index.json?/trails/{z}/{x}/{y}.pbf)
如何使用 ngx-openlayers 包加载此地图
我试过用这个但是没用
<aol-map [width]="'500px'" [height]="'300px'">
<aol-interaction-default></aol-interaction-default>
<aol-control-defaults></aol-control-defaults>
<aol-control-fullscreen></aol-control-fullscreen>
<aol-layer-tile>
<aol-source-osm></aol-source-osm>
<aol-source-xyz [url]="'http://localhost:8090/tileserver.php?/index.json?/trails/{z}/{x}/{y}.pbf'">
</aol-source-xyz>
</aol-layer-tile>
<aol-view [zoom]="12">
<aol-coordinate [x]="6.47" [y]="53.44" [srid]="'EPSG:4326'"></aol-coordinate>
</aol-view>
</aol-map>
【问题讨论】:
-
谢谢,我现在明白了,但是如何渲染 PBF 数据呢?是在运行时吗?或者有一个工具可以用来生成 .png 而不会丢失文件夹结构?还是使用mbtiles?
-
Rendering 需要一个 tile server 来动态完成,或者像 Maperitive 或 TileMill 这样的软件提前完成。 mbtiles 也可以。它们包含预渲染的图块。
标签: javascript angular openstreetmap openlayers-3