将纬度/经度转换为 PointClass
IPoint pPoint = new ESRI.ArcGIS.Geometry.PointClass();
pPoint.PutCoords(-92.96000, 44.9227); //This should be near Minneapolis
mapControl.CenterAt(pPoint); //mapControl is a AxMapControl
当我运行此代码时,该点总是在堪萨斯附近结束。谁能帮我将纬度/经度转换为可以正常工作的 PointClass?
我正在使用 VS2010 ArcEngine 10 C#
IPoint pPoint = new ESRI.ArcGIS.Geometry.PointClass();
pPoint.PutCoords(-92.96000, 44.9227); //This should be near Minneapolis
mapControl.CenterAt(pPoint); //mapControl is a AxMapControl
When I run this code the point always ends up near Kansas. Can anyone help me convert lat / longs to an PointClass that will work properly?
I'm using VS2010 ArcEngine 10 C#
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这比你目前给出的要多得多。纬度/经度点和您的地图都有特定的空间参考。如果它们不匹配,你的观点很可能会以意想不到的方式表达。
您显示的点是标准纬度/经度点。可能是 Nad83(北美)或 WGS84(世界)。这些是具有地理坐标系的空间参考。您可能试图在投影坐标系。
您需要使 MapControl 的空间参考与您尝试绘制的点类型相匹配。
由于我不知道您的地图的空间参考,因此我只能给您一个将纬度/经度转换为 MapControl 当前空间参考的示例。
这将获取您的点并将其投影到 MapControls 当前空间参考,然后绘制该点。
祝你好运。
There is a lot more to this than you have currently given. Both a lat/long point and your map have a specific spatial reference. If they do not match, it is likely your point will plot in an unexpected way.
The point you are showing is a standard Latitude/Longitude point. Which is likely Nad83 (North American), or WGS84 (World). These are Spatial References with a Geographical Coordinate System. You are likely trying to plot the point on a Projected Coordinate System.
You need to make your MapControl's Spatial Reference match the types of points you are trying to plot.
Since I do not know the Spatial Reference of your Map, I can only give you an example of translating a Lat/Lon into what the MapControl's current spatial reference is.
This takes your point and projects it to the MapControls current spatial reference, then plots the point.
Good Luck.
这是缩放并以纬度/经度为中心的代码,上面的海报很有帮助,但他的解决方案对我不起作用。
Here is the code to zoom and center on a lat / long, the above poster was helpful but his solution did not work for me.