Jan 13, 2011 at 8:02 PM

Hi All, I am trying to use the demo map example to display a geotiff file so I tried adding the GDALExtension library as a resource but the image doesn't appear.

To add GDAL extensions is adding the dll as a resource and recompiling all that is required or am I missing something?




Jan 13, 2011 at 8:28 PM

You don't want to add a reference to the dll as a resource.  It is loaded dynamically in code, so you just have to make sure that it (along with all the other unmanaged C code) is physically located in the subfolder that I think is called "Data Extensions\GDAL".  If the code is in a different place, you will need to update the AppManager1 component in the DemoMap project with the correct location.  Be sure that the version you are trying to use is correct for your system.  That is, if you are working with a 64 machine, and use the AnyCPU mode to build the project, it won't be able to read the x86 version of GDAL etc.



Jan 14, 2011 at 12:32 PM

Dear Ted,

I follow having problems with ecw large images loading, if its size is up of 100 MB aproximately is not loaded.

When could be available this option? Load large ecw images.

Thanks in advanced.

Francisco J.


Jan 14, 2011 at 2:49 PM

Hi Ted,

Could you provide some instructions on how I should about update the AppManager1 component in the DemoMap project?  I reviewed the properties window but I'm not sure if that is the correct place to update it.

Under the Data Extensions/GDAL folder a Dotspatial.Data.Rasters.GDALExtension.dll exist.

I assumed I needed to add that as a reference.  I've removed it as a reference now but I'm not sure how to update the appmanager to get the app to open a geotiff file and a cadrg file (.lf2 or a.toc).



Jan 14, 2011 at 3:34 PM

If you have the file in that directory, then the way to test if it is working is to press the green add button.  In the lower right of that dialog there should be a drop-down button specifying supported file types.  If that list includes the name GDAL anywhere, then the plug-in is working.  If not then you may have some issues.  I believe to change the path you need change the AppManager1.DataManager.PluginDirectories or something.  This should not be necessary if you are in the correct path however.

Francisco, I am not sure why you are not able to see 100 MB ecw images.  If you don't have the GDAL plugin working, then you can't see ecw at all, but if you have it working, the program should be creating a file-based pyramid image, and it should let you see respectably large ecw images.  I don't know why a 100 mb cuttoff would exists.  Is there a way you can upload the sample dataset or host a link where we can download it for testing?  There is likely some extra bug that is happening.  Sometimes I get errors on large images from out of memory, but not because we are trying to store the whole image in memory, but rather because the GC hasn't successfully freed up a continuous block large enough for the block I am trying to dimension.  It can be challenging picking a size that will work well for everyone, though if it works on my machine it should work for other people.  I have a really bad setup of only having about 3 Gigs of memory on the laptop, but running Windows 7 64, which takes up 2 Gigs, only leaving 1 gig of free memory.  I figured if it worked on my machine it should work for everyone.  Maybe I should make the block size some kind of application setting so that the source code will build the pyramid image with smaller blocks if the user sets it up that way.



Jan 17, 2011 at 3:58 PM

Hi Ted,  


Seems there is some issue.  I don't see GDAL anywhere.  I downloaded compiled and ran the demo app.  I'm not sure what it means to be in the correct path because I haven't changed any env variables, etc...just downloaded compiled and hit run.\

The app manager has the following properties that seem to fit a description for adding directories...


The DataProviderDirectories has a value named "Collections"

When I click on Collections I see no values with an option to add a string.  When I try to add a String I get an error that says "Constructor on type "System.String" not found.


The AppManager also has a property called Directories


Directories has a value of "Collections".  When I click on "Collections" a pop-up appears with two values 0. Plugins, 1.  Apps

I'm not sure if I need to add/change something here?

The other thing I tried was going to properties for the application and  adding in reference paths that point to the home directory of my dotspatial install as well as the GDAL directory under that install (didn't work though).

I appreciate your help in figuring this one out.







Jan 20, 2011 at 4:43 AM
Edited Jan 20, 2011 at 8:17 AM
DotSpatial used to depend on FWTools for GDAL support until recently so if your using an older DotSpatial (downloaded) version it may still be using the FWTools dependencies. If so it may behave differently to the most current repository versions of DotSpatial version. In particular the FWTools dependent versions may not work on x64 platforms though I'm not sure about this. GDAL support is "built-in" the current DotSpatial solution so if your building from the current repository tip you shouldn't need to do anything programmatically or in the system environment to use the GDALDataExtension. If your platform is selected correctly in the solution configuration It should just work without you having to write any code at all.

So we can try and help you please provide the following information:

  1. Are you using the download or repository DotSpatial?
  2. What repo version or download date is it?
  3. What platform are you developing/running on? (e.g. Windows7, i7, x64, Visual Studio 2010)
  4. Ted asked you to run the DemoApp and after pressing the plus sign button on the tool bar (it has the tooltip "Add Data")  to check whether you can see "GDAL" appearing in any of the supported file types listed (in the drop down to the right of the filename text box) in the file browser dialog.

[Edit] If your using a recent version from the repo it looks like the build paths have been broken and the application is being built into the wrong folder (one level higher than it should be)! This would cause the application to be unable to find any data extensions or plug-ins as they are built to subfolders of the application itself. I've logged an issue to make sure this isn't by design but in the interim you could set your build paths for the demo projects to one level deeper i.e. ..\..\Release\x86\ instead of ..\..\..\Release\x86\ and see if that helps.


Jan 20, 2011 at 3:20 PM


Here's some more information on my setup:

  1. Are you using the download or repository DotSpatial? Download
  2. What repo version or download date is it? I'm using the download 7f321d42d357 version.
  3. What platform are you developing/running on? (e.g. Windows7, i7, x64, Visual Studio 2010).  I'm developing on Windows 7 but I compiled for x86
  4. Ted asked you to run the DemoApp and after pressing the plus sign button on the tool bar (it has the tooltip "Add Data")  to check whether you can see "GDAL" appearing in any of the supported file types listed (in the drop down to the right of the filename text box) in the file browser dialog.   I did that but I didn't see GDAL appearing in any of the supported file types.

Maybe the download version has broken build paths as well. I'll check it out.

Thanks much for your help!


Apr 29, 2011 at 5:42 AM

Alan -- I am having *exactly* the same problem - using C#-VS2010. Have you worked it out yet?  If so, plese post the precise steps that you took. I've tried the suggestions from TEd and tidyup (as well as your steps) but to no avail.

Many thanks



Apr 30, 2011 at 5:56 AM

I got it working at home by doing what the instructions said... adding the DataExtensions/GDAL folder to the Debug folder in the project.  Don't know why it was not succeeding at work... will try again next week.

Apr 30, 2011 at 6:23 PM

Have you got any other GDAL dependent apps or other versions of GDAL installed on your work machine? It shouldn't really matter as the plug-in should configure at run time...

On 30/04/2011 1:56 PM, "shadhow" <> wrote:
> From: shadhow
> I got it working at home by doing what the instructions said... adding the DataExtensions/GDAL folder to the Debug folder in the project. Don't know why it was not succeeding at work... will try again next week.
May 2, 2011 at 2:50 AM

I decided to start from scratch and reset all the DotSpatial Toolbox controls and the References to the latest 22 Apr 2011 download. Now it looks as though it may have something to do with the way in which I am opening/displaying a shapefile.

The app opens and displays on the MapControl two shapefiles from disk and creates and displays a DotSpatial Polygon FeatureSet with a single feature (created from a SqlGeography coordinate string).

Imported shapefiles (x2):
            FeatureSet coastFeatureSet = new FeatureSet();
            MapPolygonLayer coastLayer = (MapPolygonLayer)theMapControl.Layers.Add(coastFeatureSet);

Created FeatureSet:
            FeatureSet fs1 = new FeatureSet(FeatureType.Polygon);  //temp feature set
            fs1.Projection = theMapControl.Projection;             //set projection
            //make dotspatial polygon object from sqlgeography STAsText() 'polystring' and STNumPoints() 'vertices'
            Polygon outlinePoly = PolygonObject (polystring,vertices ); 
            fs1.AddFeature(outlinePoly);                             //add the polygon to the feature set
            MapPolygonLayer surveyLayer = (MapPolygonLayer)theMapControl.Layers.Add(fs1);  //add the featureSet as map layer

With the DataExtensions folder in ../bin/Debug, only the created FeatureSet fs1 shows on the map but the shapefiles do not display (although they appear as layers in the legend)  but I can see the GDAL formats in the Open Dialog dropdown (although when I add a .ecw file and Zoom to Layer I get an unhandled "OverflowException" {"Value was either too large or too small for an Int32."} -- see partial dump below - but this is a separate issue).

If I remove the DataExtensions folder (completely or by renaming to e.g. xDataExtensions), the shapefiles and the created FeatureSet show in their correct relative positions on the Map but I cannot see the GDAL formats.

  Error dump...
  at System.Convert.ToInt32(Double value)
   at DotSpatial.Symbology.ProjExt.ProjToPixel(IProj self, Coordinate location) in C:\dev\DotSpatial\DotSpatial.Data\DotSpatial.Data\ProjExt.cs:line 97
   at DotSpatial.Symbology.ProjExt.ProjToPixel(IProj self, Extent env) in C:\dev\DotSpatial\DotSpatial.Data\DotSpatial.Data\ProjExt.cs:line 115
   at DotSpatial.Controls.MapFrame.Initialize(List`1 regions) in C:\dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapFrame.cs:line 311
   at DotSpatial.Controls.MapFrame.Initialize() in C:\dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapFrame.cs:line 387
   at DotSpatial.Controls.MapFrame.ResetBuffer() in C:\dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapFrame.cs:line 292
   at DotSpatial.Controls.MapFrame.set_ViewExtents(Extent value) in C:\dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapFrame.cs:line 680
   at DotSpatial.Controls.MapFrame.Layers_ZoomToLayer(Object sender, EnvelopeArgs e) in C:\dev\DotSpatial\DotSpatial.Controls\DotSpatial.Controls\MapFrame.cs:line 1105
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at DotSpatial.Symbology.LayerEventList`1.OnZoomToLayer(Object sender, EnvelopeArgs e) in C:\dev\DotSpatial\DotSpatial.Symbology\DotSpatial.Symbology\LayerEventList.cs:line 290
   at DotSpatial.Symbology.LayerEventList`1.Layer_ZoomToLayer(Object sender, EnvelopeArgs e) in C:\dev\DotSpatial\DotSpatial.Symbology\DotSpatial.Symbology\LayerEventList.cs:line 339
   at DotSpatial.Symbology.Layer.OnZoomToLayer() in C:\dev\DotSpatial\DotSpatial.Symbology\DotSpatial.Symbology\Layer.cs:line 401
   at DotSpatial.Symbology.Layer.ZoomToLayerClick(Object sender, EventArgs e) in C:\dev\DotSpatial\DotSpatial.Symbology\DotSpatial.Symbology\Layer.cs:line 501