Add Point Feature to Layer, point in wrong location

679
3
Jump to solution
06-24-2021 04:07 AM
TimothyReed1
New Contributor II

Good morning,

我已经在这工作了,无法看到m to figure out what's going on. I have a latitude/longitude in decimal degrees that I am trying to add to a feature service from a plugin that I am writing in the Pro SDK. The resultant point that is created is dropped in the incorrect location (see attachments). In the Java Runtime, I would just use CoordinateFormatter.fromLatitudeLongitude.

What did I miss?

ResultResultCodeCode

Thanks,

Tim

0Kudos
1 Solution

Accepted Solutions
Wolf
by 亚博搜索yabovip28点com
亚博搜索yabovip28点com

Gary is correct, you have to change your shape's projection to match the projection of your layer:

var mapPointProjected = GeometryEngine.Instance.Project(newMapPoint, testLayer.GetSpatialReference());

then use mapPointProjected as the shape value in your attr dictionary.

View solution in original post

3 Replies
by Anonymous User
Not applicable

I would suggest anytime that a feature is put in the wrong location, to check the coordinate system. I have seen many times when working with X, Y data initially the data being rendered in odd locations. Just about every time the issue is the coordinate system is not correct.

0Kudos
Wolf
by 亚博搜索yabovip28点com
亚博搜索yabovip28点com

Gary is correct, you have to change your shape's projection to match the projection of your layer:

var mapPointProjected = GeometryEngine.Instance.Project(newMapPoint, testLayer.GetSpatialReference());

then use mapPointProjected as the shape value in your attr dictionary.

TimothyReed1
New Contributor II

谢谢!解决我的问题,我认为specifying the SpatialReference in the CreateMapPoint was good enough.