用几何形状服务计算WMTS层映射范围
-
26-12-2019 - |
题
我有WMT背景层,WMS层和图形层中的点数组。该点具有WGS84LATLNG坐标,用于计算地图的范围。
不起作用:
当使用几何形状服务器的范围时,WMS层很好地投影在它的顶部上,只有它的位置向上移动并且与图形层中的点数的几何形状的位置相对应的位置...
服务:
<esri:GeometryService id="geometryService"
concurrency="last"
fault="geometryService_faultHandler(event)"
projectComplete="projectCompleteHandler(event)"
showBusyCursor="true"
url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"/>
<esri:GeometryService id="geometryService2"
concurrency="last"
fault="geometryService_faultHandler(event)"
projectComplete="projectCompleteHandler2(event)"
showBusyCursor="true"
url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"/>
.
图层:
<esri:ArcGISTiledMapServiceLayer id="arcgisonlineLayer" load="{trace(arcgisonlineLayer.version)}"
url="http://services.arcgisonline.nl/arcgis/rest/services/Basiskaarten/PDOK_BRT/MapServer"/>
<esri:WMSLayer url="{wmsLayerUrl}">
<esri:visibleLayers>
<s:ArrayList>
<fx:String>0</fx:String><!-- GTG vlakken -->
<fx:String>1</fx:String><!-- GTG lijnen -->
<!--<fx:String>2</fx:String>--><!-- Provinciale wegen-->
<fx:String>3</fx:String><!-- GTG punten -->
<fx:String>4</fx:String><!-- Kilometrering -->
<fx:String>5</fx:String><!-- Kilometrering -->
<fx:String>6</fx:String><!-- Kilometrering -->
<fx:String>7</fx:String><!-- Kilometrering -->
<fx:String>8</fx:String><!-- Beheergebied -->
<!--<fx:String>9</fx:String>--><!-- Eigendomsgebied -->
<!--<fx:String>10</fx:String>--><!-- Onderhoudsgebied -->
</s:ArrayList>
</esri:visibleLayers>
</esri:WMSLayer>
<esri:GraphicsLayer id="lichtpuntLayer" />
.
粉碎程度:
public function set mapItemBounds(value:Object):void
{
_mapItemBounds = value as LatLngBounds;
if(_mapItemBounds)
{
var wmExtent:WebMercatorExtent = new WebMercatorExtent(
_mapItemBounds.getSouthWest().lng(),
_mapItemBounds.getSouthWest().lat(),
_mapItemBounds.getNorthEast().lng(),
_mapItemBounds.getNorthEast().lat());
var outSR:SpatialReference = new SpatialReference(28992);
const projectParameters:ProjectParameters = new ProjectParameters;
projectParameters.geometries = [ wmExtent];
projectParameters.outSpatialReference = outSR;
geometryService.project(projectParameters);
}
}
.
计算地图上的位置点
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(mapItemsProject) {
mapItemsProject = false;
var mapItemGeometryArr:Array = new Array();
for each(var mapItem:IMapItem in mapItems) {
var latlng:LatLng = new LatLng(mapItem.wgs84Lat, mapItem.wgs84Lon);
mapItemGeometryArr.push(latlng.mapPoint())
}
var outSR:SpatialReference = new SpatialReference(28992);
const projectParameters:ProjectParameters = new ProjectParameters;
projectParameters.geometries = mapItemGeometryArr;
projectParameters.outSpatialReference = outSR;
geometryService2.project(projectParameters);
}
.
工作正常:
...使用默认的ArcGisonLine.com WorldSteetMap时比较。
图层:
<esri:ArcGISTiledMapServiceLayer id="serviceLayer"
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
visible="{viewModeButtonBar.selectedIndex == 0}"/>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
visible="{viewModeButtonBar.selectedIndex == 1}"/>
<!--PDOK layer is incompatable with lichtpuntLayer and id="map". If lichtpuntLayer and another map in declarations it will show up-->
<!--<esri:ArcGISTiledMapServiceLayer visible="true"
url="http://services.arcgisonline.nl/arcgis/rest/services/Basiskaarten/PDOK_BRT/MapServer"/>-->
<esri:WMSLayer url="{wmsLayerUrl}">
<esri:visibleLayers>
<s:ArrayList>
<fx:String>0</fx:String><!-- GTG vlakken -->
<fx:String>1</fx:String><!-- GTG lijnen -->
<!--<fx:String>2</fx:String>--><!-- Provinciale wegen -->
<fx:String>3</fx:String><!-- GTG punten -->
<fx:String>4</fx:String><!-- Kilometrering -->
<fx:String>5</fx:String><!-- Kilometrering -->
<fx:String>6</fx:String><!-- Kilometrering -->
<fx:String>7</fx:String><!-- Kilometrering -->
<fx:String>8</fx:String><!-- Beheergebied -->
</s:ArrayList>
</esri:visibleLayers>
</esri:WMSLayer>
<esri:GraphicsLayer id="lichtpuntLayer"/>
.
计算范围:
public function set mapItemBounds(value:Object):void
{
_mapItemBounds = value as LatLngBounds;
if(_mapItemBounds)
{
map.extent = new WebMercatorExtent(
_mapItemBounds.getSouthWest().lng(),
_mapItemBounds.getSouthWest().lat(),
_mapItemBounds.getNorthEast().lng(),
_mapItemBounds.getNorthEast().lat());
}
}
.
任何人都知道为什么这不起作用?
解决方案
因为是一个带有 rd_new结构的平铺映射,您需要让几何图形服务在发送时,在Latlng积分上也可以在Latlng点上进行 datumtransform ;在我的情况下,“Amersfoort_to_wgs_1984_2008_MB”。此外,我必须将wkid设置为108457并转换为false(默认)。
var projectParameters:ProjectParameters = new ProjectParameters();
var datumTransform: DatumTransform = new DatumTransform();
datumTransform.wkid = 108457;
datumTransform.wkt = "Amersfoort_To_WGS_1984_2008_MB";
projectParameters.outSpatialReference = new SpatialReference(28992);
projectParameters.datumTransform = datumTransform;
projectParameters.transformForward = false;
projectParameters.geometries = [ webMercatorExtent ];
geometryService1.project(projectParameters)
. 不隶属于 StackOverflow