This project is read-only.

Reprojecting geometries

Dec 8, 2010 at 3:10 PM

I'm trying to determine the most efficient way to reproject an IGeometry.  It looks like the transform code expects double[] xy.  Is there any code already in place to go between Coordinate lists and double[] xy?  If not, would this be something useful to contribute?

Thanks,

Kyle

Dec 8, 2010 at 5:24 PM

Some basic support for this exists in FeatureSet, even for complex geometries, in a way that gives you one continuous array so you can make a single call to reproject for your entire FeatureSet.  Just create a new FeatureSet, create new features using your geometries, (you may need to call InitializeVertices) and then pass the "Vertex" array into your reprojection code or call the Reproject method on the featureset.  At that point the Vertex array is up to date, but I think your features are still the old ones.  To update them I think there is some method on the FeatureSet that will copy the vertex content into the geometries themselves, but I forget what it is at the moment.

However, you raise an interesting point for ease of future use.  The issue is I don't want the Projection library to depend on Topology, so we assume that the reproject method must have no idea of what an ICoordinate is.  But there is no problem with adding a method on IGeometry that would be like ToVertices() which would spit out the interleaved X, Y array as doubles that could be used by Projection.  I'm sure if you wanted to add such a method, it would get some use from people using geometries and projection at the same time.

 

Ted

 

 

Dec 8, 2010 at 6:15 PM

I think if I had a ‘bunch’ of IGeometries, it would make sense to take the FeatureSet route, but in the case of having a single geometry to transform, extending the IGeometry interface to split out the arrays would probably be more efficient. I will add that capability soon. Thanks for the feedback, Ted.

Kyle

From: shade1974 [mailto:notifications@codeplex.com]
Sent: Wednesday, December 08, 2010 11:24 AM
To: kellison@geocue.com
Subject: Re: Reprojecting geometries [DotSpatial:237590]

From: shade1974

Some basic support for this exists in FeatureSet, even for complex geometries, in a way that gives you one continuous array so you can make a single call to reproject for your entire FeatureSet. Just create a new FeatureSet, create new features using your geometries, (you may need to call InitializeVertices) and then pass the "Vertex" array into your reprojection code or call the Reproject method on the featureset. At that point the Vertex array is up to date, but I think your features are still the old ones. To update them I think there is some method on the FeatureSet that will copy the vertex content into the geometries themselves, but I forget what it is at the moment.

However, you raise an interesting point for ease of future use. The issue is I don't want the Projection library to depend on Topology, so we assume that the reproject method must have no idea of what an ICoordinate is. But there is no problem with adding a method on IGeometry that would be like ToVertices() which would spit out the interleaved X, Y array as doubles that could be used by Projection. I'm sure if you wanted to add such a method, it would get some use from people using geometries and projection at the same time.

Ted

Read the full discussion online.

To add a post to this discussion, reply to this email (DotSpatial@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email DotSpatial@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com