Default Map Projection

Dec 29, 2010 at 6:54 PM

How do I change the default map projection to NAD_1983_HARN_Transverse_Mercator which isn't a known projection?



// I added backslashes added before " in the defaultProj below.

private void setMapDefaultProjection()

            string defaultProj = "PROJCS[\"NAD_1983_HARN_Transverse_Mercator\",GEOGCS[\"GCS_North_American_1983_HARN\",DATUM[\"D_North_American_1983_HARN\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",520000.0],PARAMETER[\"False_Northing\",-4480000.0],PARAMETER[\"Central_Meridian\",-90.0],PARAMETER[\"Scale_Factor\",0.9996],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]";


Dec 29, 2010 at 8:26 PM

You are really close on this one.  The string format is not a Proj4 string, but rather an ESRI string.  try map1.Projection.ReadEsriString(...);

If that doesn't work there may be some funkyness that wants you to use the property setter, but I think just changing the code to use the ESRI string instead of the proj4 string will work for your case.



Jan 14, 2011 at 8:43 PM


I'm still having problems setting the default map projection to "NAD83(HARN) / Wisconsin Transverse Mercator" SRID=3071.  This projection is the "spatial_ref_sys" table but it does not show up in the list of projections when I'm prompted to change the projection of a layer (3071) when it doesn't match the map projection GCS_WGS_1984.


Nothing seems to works.

map1.Projection.EpsgCode = 3071;

map1.Projection.ReadProj4String( <string above> )

map1.Projection.ReadProj4String("+proj=tmerc +lat_0=0 +lon_0=-90 +k=0.9996 +x_0=520000 +y_0=-4480000 +ellps=GRS80 +units=m +no_defs");

Only the property I set changes (if I just set the EpsgCode the Proj4 strings don't change).  If I do all three and output the map properties I get echoed back what I set but when I try to add a layer with 3071 it says the map is GCS_WGS_1984. 


No matter what I do the map1.Projection stays GCS_WGS_1984. Are there more properties I have to set to change the map projection?  There must be an easier way.


Jan 14, 2011 at 8:53 PM

Hmm.  I'm wondering if you have triggered a use case where your chosen projection is not updating the maps projection.  I'm not sure why that would be. 

However, if your data is all in that projection, you can use a property on the map to turn off the projection warnings and you can choose to never reproject as the alternative and it will stop giving you grief. 

I'm not sure why it's not setting the projection properly in your case, but it may not be related to the projection specifically you are using.  Mathew is currently working on fixing some remaining issues with projection comparison, and I think his efforts will end up fixing your bug eventually.



Jan 14, 2011 at 9:11 PM

You might try creating a ProjectionInfo and then set the map1.Projection property with it rather than modifying in situ.


Jan 15, 2011 at 12:56 PM

Kyle - I tried that early on but the results are the same.

If I set the EpsgCode, ReadEsriString, and ReadProj4String to match my layers info (NAD_1983_HARN_Transverse_Mercator) the map is srid=3071 and the projection string is GCS_North_American_1983_HARN, but it doesn't match the incoming layer completely and I still get the prompt to re-project each layer.  It seems like I'd have to set every single property before it would match the layer projection.  It seems to me that setting any ONE of the properties that I've set should set all of the rest of the properties.

Although the srid of 3071 is in the spatial_ref_sys table it is not on any drop down list I can select from the prompt dialog box.  Why is that?

My other question is why can't I change the default map projection property on the map control?  It defaults to GCS_WGS_1984 and is read only.  I ought to be able to select from there.

Thanks - Joe

Jan 15, 2011 at 1:34 PM
Edited Jan 15, 2011 at 1:35 PM

The layers I'm trying to load were loaded into my spatialite database using the spatialite_gui as srid 3071 - the original projection was "NAD_1983_UTM_Zone_16N".

When I run my app and I'm prompted to reproject the layers the dialog box says that the layer projection is "Nothing" even though the correct data seems to be in the "geom_cols_ref_sys" view.

What is missing?

Jan 18, 2011 at 10:48 PM

Are you using a recent source build? We made improvements to the way projections are compared within the last week or so.

Jan 19, 2011 at 3:09 PM

The latest version I see on < > is DotSpatial 12-15-2010 and that's what I'm using.

It seems the projection I need is in the spatialite's spatial_ref_sys table but not in the DotSpatial's projections.

3071 - NAD83(HARN) / Wisconsin Transverse Mercator

Jan 19, 2011 at 3:29 PM

We need to post a new release with the latest changes.  I will plan for one on Sunday.