Projection library...

Topics: SharpMap v2.0
Oct 2, 2007 at 11:27 PM
As threatened, we have started to switch earnestly to the geometry components of a total SharpMap solution. We are finding Diego's NTS objects to be very powerul, robust, fast. Some operations perform 10 to 12 times faster than those of the commercial solution we are migrating from.

We've been working with Proj.Net. I should post this over there, but I see NO activity on that forum.

In the commercial package we are using, we simply say we want a ProjectedCoordinateSystem based upon EPSG Code 26916 (UTM, NAD83, Zone 16). I don't find any projection factory object in Proj.Net that has definitions for these standard projections. I saw a post on the Proj.Net forum that linked to a site where people can create projections an upload them... but does Proj.Net not have any kind of a database of standard projections available? Or did I miss it?

If there is not one available publicly, I could extract all of the WKT's that I want from our commecrial package, but that feels like theft.

I can easily create a factory object to create the ones for UTM, and will do so if there is no other option. I'll contribute it to the project if anyone wants it.

I have also found a publick domain database of the parametesr related to most of the NAD83 and NAD27 US State Plane coordinate systems. But they are not in WKT. I would have to write code to read the DB and generate the WKT.

So... just looking for direction here. Is this work already done? If not, would it be of any intrerest for us to contribute our effort, because we absolutely have to have support for US State Plane and UTM projections.
Oct 3, 2007 at 3:22 AM
Edited Oct 3, 2007 at 3:23 AM
Hi Magnum -

There currently isn't a mechanism to get a ProjectedCoordinateSystem from an EPSG code in Proj.Net. You can find a good number of projections (exported from the EPSG database) in the UnitTests folder in the SRID.csv file. The projections in this file are all WKT, and the unit test at UnitTests\WKT\WKTCoordSysParserTests.cs reads it and creates coordinate system objects from the data. I just checked, and EPSG 26916 is in there. Using EPSG projection data isn't theft, since they provide it for free on their website.

To save you a step, since I already took it, the WKT for UTM NAD83, Zone 16 is:

PROJCS["NAD83 / UTM zone 16N",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-87],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","26916"]]
Oct 3, 2007 at 4:22 AM
Edited Oct 3, 2007 at 4:23 AM
" I should post this over there, but I see NO activity on that forum."
No, because people keep posting projection related stuff in the wrong forum ;-)

The reason that Proj.NET doesn't have a projection database is to keep any database implementation seperate. All such a database really is a WKT and an ID for each spatial reference.
However it does come with a .CSV with all the codes/WKTs and you can iterate through these. If you take a look at the demowebsite, it actually show you how to do this (And the unit tests parses all the WKTs in the file the same way).
Earlier on, the CSV file was embedded in the assembly, but it made the assembly HUGE and just wasn't practical. In most cases you only need one of two SRID's in your application anyway.
In the end, using a real indexed database for looking up SRID's is the right way to go, but again that would mean requiring Proj.NET to be linked to a database, so we left that the logic out of the assembly. There's not many lines of code required to do that yourself anyway.
Oct 3, 2007 at 5:56 AM
Thanks, Guys -- I had not found the CSV. That's exactly what I was looking for.