' Project the UTM to Lat/Long. Dim projCoordinateSystem As IProjectedCoordinateSystem = DirectCast(point.SpatialReference, IProjectedCoordinateSystem) point.Project(projCoordinateSystem.GeographicCoordinateSystem) ' Update the DD textboxes. DdLatitudeTextbox.Text = Format(point.Y, "0.000000") DdLongitudeTextbox.Text = Format(point.X, "0.000000")
If the geometry has a projected coordinate system then you should be able to just use the geographic coordinate system it's based on and project it. The following is a code snippet from one of our apps. ' Project the UTM to Lat/Long. Dim projCoordinateSystem As IProjectedCoordinateSystem = DirectCast(point.SpatialReference, IProjectedCoordinateSystem) point.Project(projCoordinateSystem.GeographicCoordinateSystem) ' Update the DD textboxes. DdLatitudeTextbox.Text = Format(point.Y, "0.000000") DdLongitudeTextbox.Text = Format(point.X, "0.000000")
IPolygon pg = MyFeature.Shape as IPolygon; if (pg.SpatialReference is IProjectedCoordinateSystem) { projCoordinateSystem = pg.SpatialReference as IProjectedCoordinateSystem; pg.Project(projCoordinateSystem.GeographicCoordinateSystem); // Update the DD textboxes. IArea area = pg as IArea; obj.set_Value(gpslatitude, string.Format("{0:0.######}", area.Centroid.Y)); obj.set_Value(gpslongitude, string.Format("{0:0.######}", area.Centroid.X)); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.