ArcGIS Server 客户端开发中怎么使用自定义坐标系

发布网友 发布时间:2022-04-21 23:00

我来回答

2个回答

热心网友 时间:2022-04-11 23:13

首先使用Xian80坐标系创建一个行政区划要素类,然后添加几个区划要素,并赋予区县名称属性。

然后使用地方坐标系创建一个影像数据集,本文用矩形框模拟影像范围,绘制几个影像footprint要素。

5 关键代码

接下来就可以进行程序开发了,首先看一下进行坐标转换的代码(本文示例代码使用Silverlight):

[csharp] view plain copy
SpatialReference outSR = new SpatialReference("PROJCS[\"xx_li\",GEOGCS[\"GCS_Krasovsky_1940\",DATUM[\"D_Krasovsky_1940\",SPHEROID[\"Krasovsky_1940\",6378245.0,298.3]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",50000.0],PARAMETER[\"False_Northing\",-3202855.272],PARAMETER[\"Central_Meridian\",106.4192638],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]");
DatumTransform trans = new DatumTransform("GEOGTRAN[\"GCS_Xian_1980_To_Krasovsky_1940\",GEOGCS[\"GCS_Xian_1980\",DATUM[\"D_Xian_1980\",SPHEROID[\"Xian_1980\",6378140.0,298.257]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433],METADATA[\"China - onshore\",73.66,18.04,134.85,53.59,0.0,0.0174532925199433,0.0,3228]],GEOGCS[\"GCS_Krasovsky_1940\",DATUM[\"D_Krasovsky_1940\",SPHEROID[\"Krasovsky_1940\",6378245.0,298.3]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433],METADATA[\"Not specified\",-180.0,-90.0,180.0,90.0,0.0,0.0174532925199433,0.0,1263]],METHOD[\"Geocentric_Translation\"],PARAMETER[\"X_Axis_Translation\",0.0],PARAMETER[\"Y_Axis_Translation\",0.0],PARAMETER[\"Z_Axis_Translation\",0.0]]");

GeometryService projectTask = new GeometryService(geometryUrl);
projectTask.ProjectCompleted += new EventHandler<GraphicsEventArgs>(projectTask_ProjectCompleted);
projectTask.Failed += new EventHandler<TaskFailedEventArgs>(projectTask_Failed);
projectTask.ProjectAsync(e.FeatureSet, outSR, trans, true, null);

请注意在上最新的10.1中,ProjectAsync方法新增了DatumTransform参数,可以在投影中指定大地基准转换。

接下来是利用返回的结果(投影到地方坐标系的行政区划要素),再进行空间查询:

[csharp] view plain copy
QueryTask spatialQuery = new QueryTask(cqliUrl);
spatialQuery.Failed += new EventHandler<TaskFailedEventArgs>(spatialQuery_Failed);
spatialQuery.ExecuteCompleted += new EventHandler<QueryEventArgs>(spatialQuery_ExecuteCompleted);

Query query = new Query();
query.ReturnGeometry = true;
query.OutFields.Add("OBJECTID");
query.Geometry = e.Results[0].Geometry;
query.OutSpatialReference = new SpatialReference(4610);

spatialQuery.ExecuteAsync(query);

热心网友 时间:2022-04-12 00:31

当在ArcGIS Server中发布任何使用了自定义坐标转换的模型时,自定义的地理坐标转化文件必须被拷贝到ArcGIS Server主机上特定的位置。这个位置是ArcGIS Server SOC帐号的配置目录,否则,这个GP服务将返回错误:“Invalid custom transformation”。
内容:地理坐标转化文件由ArcGIS Desktop中的“Create Custom Geographic Transformation”工具生成,这个文件保存在当前登录用户的配置目录,后缀名为.gtf。这个文件的路径一般如下:??ArcGIS version 10:
C:\Users\<user name>\AppData\Roaming\ESRI\Desktop10.0\ArcToolbox\CustomTransformations\MyCustomTransformation.gtf??ArcGIS version 9.3.1:
C:\Users\<user name>\AppData\Roaming\ESRI\ArcToolbox\CustomTransformations\MyCustomTransformation.gtf当这个文件创建完之后,当前用户就可以在ArcGIS Desktop模型中的“Project”和“Project Raster”工具中使用自定义的坐标转化了。如果这个模型将要被发布到ArcGIS Server,自定义的转化文件需要被拷贝到ArcGIS Server主机上特定的位置:Windows上??ArcGIS version 10:
C:\Users\ArcGISSOC\AppData\Roaming\ESRI\Server10.0\ArcToolbox\CustomTransformations\MyCustomTransformation.gtf
(假定ArcGIS Server的SOC帐号是ArcGISSOC)??ArcGIS version 9.3.1:
C:\Users\ArcGISSOC\AppData\Roaming\ESRI\ArcToolbox\CustomTransformations\MyCustomTransformation.gtf Linux上??ArcGIS version 10:
/sslrh51/arcsvr10/.arcgis10.0/Application Data/ESRI/Server10.0/ArcToolbox/CustomTransformations/MyCustomTransformation.gtf
(假定GIS用户帐号是arcsvr10)??ArcGIS version 9.3.1:

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com