将美国 BLM WMS 连接到 Mapbox
Connect US BLM WMS to Mapbox
我正在尝试将 BLM.gov 发布的 PLSS(public 土地测量系统)的 WMS 添加到 Mapbox 地图,以使 Township/Range/Section 网格可见,并且我无法让它显示在地图上。我怀疑 Mapbox JS 请求与 BLM WMS 期望的查询之间存在语法问题。
我一直在使用 mapbox 发布的示例添加 WMS,为 BLM 站点修改,代码如下:
mapboxgl.accessToken = 'MY_KEY';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
zoom: 8,
center: [-95, 38]
});
map.on('load', function() {
map.addSource('wms-test-source', {
'type': 'raster',
'tiles': [
'https://gis.blm.gov/arcgis/services/Cadastral/BLM_Natl_PLSS_CadNSDI/MapServer/WmsServer?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.3.0&request=GetMap&srs=EPSG:3857&width=256&height=256&layers=1'
],
'tileSize': 256
});
map.addLayer(
{
'id': 'wms-test-layer',
'type': 'raster',
'source': 'wms-test-source',
'paint': {}
},
'aeroway-line'
);
});
有谁看到我需要更改什么才能覆盖 PLSS 网格,我将非常感激!
根据下面 Thomas Martin 的评论,我使用了此处描述的 tileLayer 函数:docs.mapbox.com/mapbox.js/example/v1.0.0/wms 来实现我的目标。代码如下:
L.mapbox.accessToken = 'pk.eyJ1IjoicGV0cm9hbmFseXRpY2EiLCJhIjoiY2s2dTlicXQzMDdqbDNnbzhsNGo4ZjY0MCJ9.u5nBRLm8b6RwZKKXGh-L4w';
var map = L.mapbox.map('map')
.setView([37, -99], 8)
.addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11'));
// Add each wms layer using L.tileLayer.wms
var Sections = L.tileLayer.wms('https://gis.blm.gov/arcgis/services/Cadastral/BLM_Natl_PLSS_CadNSDI/MapServer/WmsServer', {
format: 'img/png',
transparent: true,
layers: 2
}).addTo(map);
var Townships = L.tileLayer.wms('https://gis.blm.gov/arcgis/services/Cadastral/BLM_Natl_PLSS_CadNSDI/MapServer/WmsServer', {
format: 'img/png',
transparent: true,
layers: 1
}).addTo(map);
心理急救,
<script>
L.mapbox.accessToken = '<your access token here>';
var map = L.mapbox.map('map')
.setView([37, -99], 3)
.addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11'))
var temperature =
L.tileLayer.wms('http://gis.srh.noaa.gov/arcgis/services/NDFDTemps/MapServer/WMSServer', {
format: 'img/png',
transparent: true,
layers: 16
}).addTo(map);
var precipitation = L.tileLayer.wms('http://nowcoast.noaa.gov/arcgis/services/nowcoast/analysis_meteohydro_sfc_qpe_time/MapServer/WmsServer', {
format: 'image/png',
transparent: true,
layers: '5'
}).addTo(map);
document.getElementById('temperature').onclick = function () {
var enable = this.className !== 'active';
temperature.setOpacity(enable ? 1 : 0);
this.className = enable ? 'active' : '';
return false;
};
document.getElementById('precipitation').onclick = function () {
var enable = this.className !== 'active';
precipitation.setOpacity(enable ? 1 : 0);
this.className = enable ? 'active' : '';
return false;
};
</script>
有关详细信息,请参阅此 link。 https://docs.mapbox.com/mapbox.js/example/v1.0.0/wms/
我正在尝试将 BLM.gov 发布的 PLSS(public 土地测量系统)的 WMS 添加到 Mapbox 地图,以使 Township/Range/Section 网格可见,并且我无法让它显示在地图上。我怀疑 Mapbox JS 请求与 BLM WMS 期望的查询之间存在语法问题。
我一直在使用 mapbox 发布的示例添加 WMS,为 BLM 站点修改,代码如下:
mapboxgl.accessToken = 'MY_KEY';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
zoom: 8,
center: [-95, 38]
});
map.on('load', function() {
map.addSource('wms-test-source', {
'type': 'raster',
'tiles': [
'https://gis.blm.gov/arcgis/services/Cadastral/BLM_Natl_PLSS_CadNSDI/MapServer/WmsServer?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.3.0&request=GetMap&srs=EPSG:3857&width=256&height=256&layers=1'
],
'tileSize': 256
});
map.addLayer(
{
'id': 'wms-test-layer',
'type': 'raster',
'source': 'wms-test-source',
'paint': {}
},
'aeroway-line'
);
});
有谁看到我需要更改什么才能覆盖 PLSS 网格,我将非常感激!
根据下面 Thomas Martin 的评论,我使用了此处描述的 tileLayer 函数:docs.mapbox.com/mapbox.js/example/v1.0.0/wms 来实现我的目标。代码如下:
L.mapbox.accessToken = 'pk.eyJ1IjoicGV0cm9hbmFseXRpY2EiLCJhIjoiY2s2dTlicXQzMDdqbDNnbzhsNGo4ZjY0MCJ9.u5nBRLm8b6RwZKKXGh-L4w';
var map = L.mapbox.map('map')
.setView([37, -99], 8)
.addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11'));
// Add each wms layer using L.tileLayer.wms
var Sections = L.tileLayer.wms('https://gis.blm.gov/arcgis/services/Cadastral/BLM_Natl_PLSS_CadNSDI/MapServer/WmsServer', {
format: 'img/png',
transparent: true,
layers: 2
}).addTo(map);
var Townships = L.tileLayer.wms('https://gis.blm.gov/arcgis/services/Cadastral/BLM_Natl_PLSS_CadNSDI/MapServer/WmsServer', {
format: 'img/png',
transparent: true,
layers: 1
}).addTo(map);
心理急救,
<script>
L.mapbox.accessToken = '<your access token here>';
var map = L.mapbox.map('map')
.setView([37, -99], 3)
.addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11'))
var temperature =
L.tileLayer.wms('http://gis.srh.noaa.gov/arcgis/services/NDFDTemps/MapServer/WMSServer', {
format: 'img/png',
transparent: true,
layers: 16
}).addTo(map);
var precipitation = L.tileLayer.wms('http://nowcoast.noaa.gov/arcgis/services/nowcoast/analysis_meteohydro_sfc_qpe_time/MapServer/WmsServer', {
format: 'image/png',
transparent: true,
layers: '5'
}).addTo(map);
document.getElementById('temperature').onclick = function () {
var enable = this.className !== 'active';
temperature.setOpacity(enable ? 1 : 0);
this.className = enable ? 'active' : '';
return false;
};
document.getElementById('precipitation').onclick = function () {
var enable = this.className !== 'active';
precipitation.setOpacity(enable ? 1 : 0);
this.className = enable ? 'active' : '';
return false;
};
</script>
有关详细信息,请参阅此 link。 https://docs.mapbox.com/mapbox.js/example/v1.0.0/wms/