Projection Polyconic is not supported

Topics: Algorithms, SharpMap v0.9 / v1.x
Aug 14, 2010 at 4:21 PM

Hi,

I have a bunch of Shape Files in Co-ordinate System Everest_Bangladesh_Polyconic. Secondly, I have polygons stored as Geometry in SQL Server 2008. I would like to overlay the Polygons from database over the polygons from these Shape Files. Below is the code I used to transform the Co-ordinates:

string path = @"D:\SHP Files\luse.shp";

ShapeFile shpProvider = new ShapeFile(path, true);

VectorLayer shpLayer = new VectorLayer("ShapeFileLayer");
shpLayer.DataSource = shpProvider;

FeatureDataTable features = dbFactory.GetFeatures();

VectorLayer polyLayer = new VectorLayer("PolyLayer");
polyLayer.DataSource = new GeometryFeatureProvider(features);

CoordinateSystemFactory cFac = new CoordinateSystemFactory();
ICoordinateSystem wgs84CS = cFac.CreateFromWkt(@"PROJCS[""WGS 84 / UTM zone 13N"",GEOGCS[""WGS 84"",DATUM[""WGS_1984"",SPHEROID[""WGS 84"",6378137,298.257223563,AUTHORITY[""EPSG"",""7030""]],AUTHORITY[""EPSG"",""6326""]],PRIMEM[""Greenwich"",0,AUTHORITY[""EPSG"",""8901""]],UNIT[""degree"",0.01745329251994328,AUTHORITY[""EPSG"",""9122""]],AUTHORITY[""EPSG"",""4326""]],PROJECTION[""Transverse_Mercator""],PARAMETER[""latitude_of_origin"",0],PARAMETER[""central_meridian"",-105],PARAMETER[""scale_factor"",0.9996],PARAMETER[""false_easting"",500000],PARAMETER[""false_northing"",0],UNIT[""metre"",1,AUTHORITY[""EPSG"",""9001""]],AUTHORITY[""EPSG"",""32613""]]");

CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();

polyLayer.CoordinateTransformation = ctFac.CreateFromCoordinateSystems(shpProvider.CoordinateSystem, wgs84CS);

mapBox.Layers.Add(shpLayer);
mapBox.Layers.Add(polyLayer);

mapBox.Map.ZoomToExtents();
mapBox.Refresh();

 

However, this code throws an exception saying Projection Polyconic is not supported.

Thanks,
Raghu

Coordinator
Aug 17, 2010 at 8:18 AM

Hello Raghu,

Proj.Net does not support all projections there are (see: http://projnet.codeplex.com/)

You can either

  • Write your own Polyconic projection class, for math see:
    http://svn.osgeo.org/geotools/tags/2.6.2/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/Polyconic.java
    http://dotspatial.codeplex.com/SourceControl/changeset/view/9f6a6afdf22c#Framework%203.5%2fDotSpatial.Projections%2fTransforms%2fPolyconic.cs
  • convert all your Shapefiles to the SRS of your SqlServer2008 data using ogr2ogr from fwtools package.

I'd go for the second, since you avoid projection calculation on rendering your data.

Hth FObermaier

 

Aug 22, 2010 at 3:14 PM

Hello FObermaier,

For now I have converted the Shape files using ogr2ogr as per your suggestion, for performance reasons.

However, I would also like to write the Polyconic projection class and submit it to Proj.Net. Will get to it when I find the time to do it.

Thanks

Raghu

Coordinator
Aug 23, 2010 at 7:02 AM
kraghavk wrote:
However, I would also like to write the Polyconic projection class and submit it to Proj.Net. Will get to it when I find the time to do it.

That would be really apreciated.

Cheers FObermaier