我正在尝试向Silverlight ArcGIS应用程序添加功能,以允许在地图上上载和显示shapefile。每当我上传一个shapefile时,它都会正确地显示它,但是在错误的地方,例如应该在撒哈拉沙漠中绘制的德克萨斯州的形状。
我很确定问题是我们的地图使用的坐标系与每个shapefile不同,但是我找不到任何可以成功转换shapefile坐标的资源。 WebMercator.FromGeographic适用于某些shapefile,但会导致应用程序崩溃。
我尝试过使用GeometryService并尝试更改形状的SpatialReferences,但都没有任何明显的效果。
与FromGeographic不兼容的文件的PRJ如下所示:
PROJCS [“Basic Albers WGS84”,GEOGCS [“D_WGS_1984”,DATUM [“D_WGS_1984”,SPHEROID [“WGS_1984”,6378137.0,298.257223563]],PRIMEM [“Greenwich”,0.0],UNIT [“Degree”, 0.0174532925199433],投影[ “阿尔伯斯”],PARAMETER [ “False_Easting”,0.0],PARAMETER [ “False_Northing”,0.0],PARAMETER [ “Central_Meridian”, - 96.0],PARAMETER [ “Standard_Parallel_1”,45.5],PARAMETER [ “Standard_Parallel_2”,29.5],PARAMETER [ “Latitude_Of_Origin”,23.0],单位[ “Foot_US” 0.3048006096012192]]
我在哪里可以开始考虑这个问题?
编辑:
以下是如何创建多边形图形的代码:
ESRI.ArcGIS.Client.Geometry.Polygon geo = new ESRI.ArcGIS.Client.Geometry.Polygon();
ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection> paths = new ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection>();
ESRI.ArcGIS.Client.Geometry.PointCollection pcol = new ESRI.ArcGIS.Client.Geometry.PointCollection();
foreach (System.Windows.Point p in this.points)
{
MapPoint mp = new MapPoint();
mp.X = p.X;
mp.Y = p.Y;
pcol.Add(mp);
}
paths.Add(pcol);
geo.Rings = paths;
// Random WKID to test with.
geo.SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(3174);
ESRI.ArcGIS.Client.Graphic gr = new ESRI.ArcGIS.Client.Graphic()
{
Geometry = geo,
Symbol = window.Get(symbolPolygon) as ESRI.ArcGIS.Client.Symbols.Symbol,
};
return gr;
GeometryService的使用方式如下:
GraphicsLayer graphicsLayer = new GraphicsLayer();
foreach (ShapefileRecord r in sh.Records)
{
Graphic g = r.ToGraphic(this);
graphicsLayer.Graphics.Add(g);
}
geoServ.ProjectAsync(graphicsLayer.Graphics.ToList(), new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100));
Map.Layers.Add(graphicsLayer);
答案 0 :(得分:0)
这可能不是一个完整的答案,但是评论的信息太多了。
您的来源SR 3174
不正确。该SR的WKT与您发布的.PRJ文件有很大不同:
PROJCS["NAD83 / Great Lakes Albers",
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.257222101,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4269"]],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
PROJECTION["Albers_Conic_Equal_Area"],
PARAMETER["standard_parallel_1",42.122774],
PARAMETER["standard_parallel_2",49.01518],
PARAMETER["latitude_of_center",45.568977],
PARAMETER["longitude_of_center",-84.455955],
PARAMETER["false_easting",1000000],
PARAMETER["false_northing",1000000],
AUTHORITY["EPSG","3174"],
AXIS["X",EAST],
AXIS["Y",NORTH]]
...最糟糕的问题是.PRJ文件有UNIT["Foot_US",0.3048006096012192]
,而3174有UNIT["metre",1]
!这可能是撒哈拉沙漠中出现事物的原因。 :)
我认为您最好的选择是使用SpatialReference类的this constructor,并将其提供给您从PRJ文件发布的WKT。