on the fly transformation

Jan 29, 2008 at 2:45 PM
Hi all,

I'm just starting to use sharpmap, and it works great.
However I ran into something I don't quite get.
I have some shapefiles which are in wgs84 and some other input which is in radians.
I want to transform 1 of the layers, so the map on each other.

Who can help me with this?
Developer
Jan 29, 2008 at 5:08 PM
You could define a CoordinateTransformation in your layer to dynamically define how to project your data
Jan 30, 2008 at 9:39 AM
I just found out that both sources are in wgs84, but 1 is in degrees and the other is in radians.
How can I transform this with an on the fly transformation?
Coordinator
Jan 30, 2008 at 10:16 AM
360 degrees = 2 * PI radians

so 1 degree = (2 * PI)/360 ≈ 0.0174532925 radians

or 1 radian = 360/(2*PI) ≈ 57.2957795 degrees
Jan 30, 2008 at 10:20 AM


JohnDiss wrote:
360 degrees = 2 * PI radians

so 1 degree = (2 * PI)/360 ≈ 0.0174532925 radians

or 1 radian = 360/(2*PI) ≈ 57.2957795 degrees


I know how to convert from degrees to radians and back, but how can I put this in a CoordinateTransformation of a VectorLayer?
Jan 31, 2008 at 3:01 AM
Your data is in radians??!? There is no "normal" well-known spatial reference that uses radians. I think instead you should fix your data.

Anyway if you insist, you could create a geographic coordinate system whose angular unit is radians (just create a WGS84 CS and change the angular unit). The projection engine should take care of the rest for you. However, since this is soooo rare, you might get yourself into some untested territory here (but be sure to file a bug in the Proj.NET project if it doesn't work).
Jan 31, 2008 at 10:36 AM
I cannot change my data, since I cannot control that.

What I want is to plot points on a map.
For the map I have shapefiles in WGS84, and the points I want to plot are in radians.
The shapefiles are put in several vector layers.
The point are plotted in there own vector layer with a list<Geometry> as datasource. This list is provided by another piece of software, so I cannot change the coordinates from radians to degrees.

Isn't there an easier way to do this tang to create my own geographic coordinate system?
Feb 1, 2008 at 3:14 AM
Edited Feb 1, 2008 at 3:15 AM
What do you mean easier? It doesn't get much easier than that.
You want to perform a transformation on your data, so you apply a transformation to your data, and this type of transformation is already there ready to use. That's all there is to it. I mean we are talking 4-5 lines of code here !
Look at the WIKI showing how to apply transformation to a layer (~4 lines of code), and just tweak the geographic coordinate systems angular units to radians (one line of code).

At least this goes for v0.9. I'm not sure how this work on the v2.0 code though. Personally that version seems to me to be overengineered and made far too complex to work with.
Developer
Feb 1, 2008 at 8:49 AM

Odegaard wrote:
What do you mean easier? It doesn't get much easier than that.

Remember that for the new 'Rails' developers, anything could be easier, especially if someone else made the work for you...


Odegaard wrote:
Personally that version seems to me to be overengineered and made far too complex to work with.

I think that at this stage we're far for a beta1 or a beta2 version, so (maybe due to requests) we have released a 2.0 beta version too earlier. BTW I've a lot of confidence in codekaizen work, but it's true that the changes from 0.9 to 2.0 are a lot, so I suspect that move to a new SharpMap version from 0.9v could be hard at the initial stages.