Setting Spatial Reference on FeatureProvider FeatureDataTable

Topics: SharpMap Project, SharpMap v2.0
May 30, 2008 at 6:36 PM
Edited May 30, 2008 at 7:15 PM
In the absence of an SDEBinary provider, I grabbed some code which fishes the coordinates out of my sql server shape table. So from that I can just stuff the shapes into a FeatureDataTable. So far so good.

However, in trying to set the spatial reference using the FeatureProvider I'm unclear how I could/would set the spatial reference (which is not WGS 84 or whatever the default is).

Is it doable (do I even need to do it for just doing a point-in-polygon test?? I see things to make CoordinateSystems from wkts, just don't see how to glue together.

thanks

/////////////////////////////////////////////////////////////////////


                // Create Columns for my in memory featuredatatable
                System.Data.DataColumn[] dcs = new DataColumn[2];
                dcs[0] = new DataColumn("ObjectID", System.Type.GetType("System.Int32"));
                dcs[1] = new DataColumn("Facility", System.Type.GetType("System.String"));

                SharpMap.Data.Providers.FeatureProvider.FeatureProvider featureProvider = new SharpMap.Data.Providers.FeatureProvider.FeatureProvider(dcs);

                // Doesn't compile, won't allow me to set the spatial reference. HELP!
//                featureProvider.SpatialReference.Name = @"PROJCS[""NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601"", GEOGCS[""GCS_North_American_1983_HARN"", DATUM[""D_North_American_1983_HARN"", SPHEROID[""GRS_1980"", 6378137, 298.257222101]], PRIMEM[""Greenwich"", 0], UNIT[""Degree"", 0.0174532925199433]], PROJECTION[""Lambert_Conformal_Conic""], PARAMETER[""False_Easting"", 8202099.73753281], PARAMETER[""False_Northing"", 0], PARAMETER[""Central_Meridian"", -120.5], PARAMETER[""Standard_Parallel_1"", 44.3333333333333], PARAMETER[""Standard_Parallel_2"", 46], PARAMETER[""Latitude_Of_Origin"", 43.6666666666667], UNIT[""Foot"", 0.3048]]";

                FeatureDataTable ft = featureProvider.CreateNewTable();
Coordinator
Jun 2, 2008 at 3:25 PM
Edited Jun 2, 2008 at 5:17 PM
Hey ppenn,

I'll look at this today, since this is a hole in the current v2.0 stuff. I haven't wired up a CoordinateSystem factory. You and John Diss just noticed it too soon. ;)