WCS - Distance between 2 points

Topics: General Topics
Oct 5, 2006 at 12:33 AM
Hi,

In the help it mentions that Zoom is in WCS (World Coordinate System?) and that the functions like MapToWorld are in WCS.

What is WCS? It looks like numbers similar to standard Longitude and Latitude values I'm used to seeing on my GPS but I don't the the real name and looking at a site like this doesn't list WCS: http://www.colorado.edu/geography/gcraft/notes/coordsys/coordsys.html

Are there any conversion functions in SharpMap? E.g. how would I find the distance between 2 points on a map in feet?

Thank you,

Dave
Developer
Oct 5, 2006 at 1:26 AM
You are correct that WCS is World Coordinate System. What this refers to is the coordinate system of your mapdata. That could be longitude/latitude, meters, feet, etc. But thats not all... you will also need to know the projection of your data to convert it to a distance.
Ex:
The euclidean distance between the two points: (-90,89.999) and (90,89.999) is 180. But if these two values are longitude/latitude, they are both very close to the north pole, and thus the shortest trip is over the pole, and therefore much shorter. Hence the simple euclidean distance cannot be used for spherical coordinates.

Other projections have other things to consider like scale and direction distortion. Most formulas do first convert to long/lat coordinates and then calculate using the spherical formulas to determine the distance between two points. In other cases like for small distances in UTM projections, the euclidean distance is often accurate enough, and the scale-distortion is well-known.
To make everything even harder, the earth is not round, it's not even ellipsoidal, so the spherical approximation isn't exact.

You will find an approximate method for calculating long/lat distances here:
http://www.sharpgis.net/CalculateTheDistanceBetweenTwoPointsOnTheEarth.aspx
You can use the coordinate transformation classes to transform your values to long/lat if they aren't already.
Oct 5, 2006 at 2:49 AM
Thank you for that detailed answer.

What if multiple layers (e.g. shapefiles) contain different coordinate systems? Will the SharpMap convert them into a consistent system or do you have to somehow transform the coordinate system as data is loaded?

Developer
Oct 5, 2006 at 3:55 AM
It can, but you will have to tell it to do it on each layer.