2010年9月13日周一_WorkingWithSpatialReferences_6.2
Posted on 2010-09-16 15:42 星尘的天空 阅读(303) 评论(0) 编辑 收藏 举报/*****************************************************************************************/
//Developing mobile applications using the Mobile SDK
//Understanding spatial reference
//
/********************************************************************************/
In ArcMap, you can create your own spatial reference and define its geographic coordinate system and projected coordinate system. The spatail reference information is then stored inside the map document. when the map is published with mobile capability, this information will be a part of mobile service cache and it will get transferred(.迁(移);调动,转学;换乘;转让) to the mobile devices when you synchronize your data the first time. Mobile maps support data projected to one common projection (a projection of the data frame in ArcMap) and you cannot re-project it on the fly in your mobile application. Most projections(设计;发射;放映) such as Cylindrical, Conformal, Mercator and Stereographic are supported, e.g. lambert conformal conic, transverse mercator, albers mercator, double stereographic, hotine oblique mercator. Note that Grid based projection is not supported.
在ArcMap中,你可以创建你自己的空间参考坐标系统、定义地理坐标系统、和工程坐标系统。空间参考信息然后就存储在地图文档中。当发布的地图具有ArcGIS Mobile功能,这些信息就会是mobile 服务缓存的一部分,当你第一次同步读取你的数据的时候,这些信息就会被转移到移动设备中去。Mobile地图支持数据工程到一个通用工程(ArcMap中的一个数据框架工程),并请你不能在你的mobile应用中re-project it on the fly。很多的设计,比如:Cylindrical, Conformal, Mercator and Stereographic都支持,
The most likely situation where you will need to work with projection(. 投影, 投射,) is when publish your map that is in one geographic coordinate system and is projected, you want to plot out(描绘, 提出 ... 纲要) GPS position. In this case, you will need to use SpatialReference class to transform your coordinate back and forth(来回的、反复的). For example, in most cases, GPS position comes in WGS84 format, if you want to integrate that into your custom map that is in NAD83, you will need to use spatial reference class to convert the GPS position to your map's coordinate system. For more information about how this impacts(影响,作用) the way that you work with geometry, please read Working With Geometry. A class that allows you to perform the conversion is the SpatialReference class. When working with the SpatialReference you interact with one of three CoordinateSystem classes: UnknownCoordinateSystem, ProjectedCoordinateSystem, or GeographicCoordinateSystem. Note that(请注意) you cannot create a SpatialReference or define a datum(资料, 数据, 材料). Unlike ArcObjects, the CoordinateSystem classes provided by the framework are read only. This is a direct result of the fact that the framework consumes maps created in desktop ArcGIS and published via ArcGIS Server.
最有可能需要你使用投影的地方是,当你发布一个地图,他是一个地理坐标系统以及投影,并且你想在上面描绘GPS的位置。 在这种情况下,你将会需要使控件参考类来反复对你的坐标系统进行反复转换。 比如:在很多情况下,GPS位置来自于WGS84格式,如果你想将它集成到你采用NAD83坐标系统的自定义地图中,你需要使用控件参考类来将GPS位置转换为你的地图的坐标系统。更过关于空间参考如何影响你使用Geometry的方式,请阅读:Working With Geometry。 允许你执行转换操作的类是spatialRefrence class 类,当你使用spatialReference,你就和下面三个坐标系统类中的中的任何一个进行交互,他们是:UnknownCoordinateSystem(位置坐标系统),ProjectedCoordinateSystem(投影坐标系统),GeographicCoordinateSystem(地理坐标系统)。请注意,你不能创建一个空间参考系或者定义一个数据(/资料)。 和ArcObject不一样,由框架提供的坐标系统类是只读的,这是这个一个事实的直接结果:框架消耗着由ArcGIS Desktop创建并通过ArcGIS Server发布的地图服务。
Examples:
How to transform coordinate between WGS84 and the map's projected coordinate system.
如何在WGS84和地图的工程坐标系统之间进行转换
[C#]
// Create a spatial reference object from mobile service
SpatialReference spatialReference = mobileService1.SpatialReference;
// specify input latitude and longitude
double lat = 40.115054;
double lon = -82.927062;
// Transform coordinate from WGS84 to coordinate based on this spatial reference
Coordinate coordinate = spatialReference.FromWgs84(lon, lat);
How to transform coordinate based on this spatial reference to WGS84.
// 将基于地图作保系统的坐标转换为WGS84
[C#]
// Create a spatial reference object from mobile service
SpatialReference spatialReference = mobileService.SpatialReference;
// specify input X and Y coordinates
double x = 6220900;
double y = 2300141;
// Transform coordinate from map's coordinate system to WGS84.
Coordinate coordinate = spatialReference.ToWgs84(x, y);