ThinkGeo.com    |     Documentation    |     Premium Support

Projection Issue

I have the following code which seems to work fine with shape files projected to NAD_1983_StatePlane_North_Dakota_South_FIPS_3302_Feet but I am having problems with a shape file projected in NAD_1983_UTM_Zone_15N.   The EPSG SRID's that I am using are 26915 & 4326.


public void renderToMap(ThinkGeo.MapSuite.DesktopEdition.LayerOverlay overlay) { string world = Proj4Projection.GetEpsgParametersString(4326); string extProj = null; if(this.projection.ProjectionType.Equals("ESRI")) { extProj = Proj4Projection.GetEsriParametersString(this.projection.SRID); } else if(this.projection.ProjectionType.Equals("EPSG")) { extProj = Proj4Projection.GetEpsgParametersString(this.projection.SRID); } Proj4Projection proj4Projection = new Proj4Projection(extProj, world); proj4Projection.Open(); ShapeFileFeatureLayer layer = new ShapeFileFeatureLayer(this.fileName, ShapeFileReadWriteMode.ReadOnly); layer.FeatureSource.Projection = proj4Projection; layer.Name = this.description; layer.ZoomLevelSet.ZoomLevel01.IsActive = true; layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; if(this.shapeFileType.Equals("line")) { layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Highway3; } else if(this.shapeFileType.Equals("point")) { layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.City7; } layer.RequireIndex = false; overlay.Layers.Add(this.description.Replace(" ", "").ToLower(), layer); //proj4Projection.Close(); } 


 I am getting the following exception/stack trace:


System.ArgumentOutOfRangeException was unhandled

  Message="The input double value is out of range.\r\nParameter name: maxX"

  Source="DesktopEdition"

  ParamName="maxX"

  StackTrace:

       at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)

       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x5021a7a45adbb9ee(Object x3faa3e674cef60b0)

       at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)

       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

  InnerException: 

 


Anybody have any ideas what I have done wrong with the projection stuff?


Thanks.


Curtis



Curtis, 
  
 Thanks for your post and question. 
  
 If I am not misunderstanding anything, your data should be in 26915 projections, and what you are trying to do is to project it into Decimal Degrees (4326) and show it on Decimal Degrees? 
  
 If possible, could you send me the 26915 projected data to me? You could send it to our support (support@thinkgeo.com) and ask him to forward to Yale. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Curtis,


I tried your data, following code should work perfectly.

winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
 
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\Support\DesktopEdition\Posts\Post6807\Mahnomen\Mahnomen_Roads.shp");
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Canal1;
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
worldLayer.FeatureSource.Projection = new Proj4Projection(26915, 4326);
 
ShapeFileFeatureLayer worldLayer1 = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
worldLayer1.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
worldLayer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
 
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add("WorldLayer", worldLayer);
staticOverlay.Layers.Add("WorldLayer1", worldLayer1);
winformsMap1.Overlays.Add("WorldOverlay", staticOverlay);
            
worldLayer.Open();
winformsMap1.CurrentExtent = worldLayer.GetBoundingBox();
//worldLayer.Close();
 
winformsMap1.Refresh();


 
 
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale