Hexagon Geospatial
MENU

WebGIS

Need a push in the right direction when configuring WebMap, Portal or SDI services? Looking for hints and tips, or just looking for Ideas and information? The WebGIS discussion board is where you start those discussions, connect and share information.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Regular Contributor
Posts: 185
Registered: ‎08-10-2016

Error on Downloading WFS Layer as Shapefile using Gdal

[ Edited ]

I am trying to download a WFS as shapefile but i keep getting followingerror:

 

Item has already been added. Key in dictionary: 'GDAL_DATA'  Key being added: 'GDAL_DATA'

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Item has already been added. Key in dictionary: 'GDAL_DATA'  Key being added: 'GDAL_DATA'

Stack Trace: 

[ArgumentException: Item has already been added. Key in dictionary: 'GDAL_DATA'  Key being added: 'GDAL_DATA']
   System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +14820240
   FormatConverter.GdalJsonToShapefileConverter.InvokeConvert(String[] options) in C:\Dev\Work\xxxxxxxx\src\FormatConverter\GdalJsonToShapefileConverter.cs:55
   FormatConverter.FormatConverter.ConvertGeoJson2Shapefile(HttpContext context, String jobDirectoryPath) in C:\Dev\Work\xxxxxx\src\FormatConverter\FormatConverter.cs:67
   FormatConverter.FormatConverter.ProcessRequest(HttpContext context) in C:\Dev\Work\xxxxxxx\src\FormatConverter\FormatConverter.cs:45 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +798 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +91
Technical Evangelist
Posts: 1,063
Registered: ‎09-11-2015

Re: Error on Downloading WFS Layer as Shapefile using Gdal

You might already have this environment variable set by GDAL installer and our software tries to register it again. Try to delete the GDAL_DATA env. variable

https://trac.osgeo.org/gdal/wiki/FAQInstallationAndBuilding#HowtosetGDAL_DATAvariable

and use only the one defined in web.config:

<gdalConfiguration 
ogr2ogrPath="C:\Program Files\GDAL\ogr2ogr.exe"
gdalDataPath="C:\Program Files\GDAL\gdal-data"
timeout="60000">
</gdalConfiguration>
Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Regular Contributor
Posts: 185
Registered: ‎08-10-2016

Re: Error on Downloading WFS Layer as Shapefile using Gdal

Removed it, still getting the same error.

Technical Evangelist
Posts: 1,063
Registered: ‎09-11-2015

Re: Error on Downloading WFS Layer as Shapefile using Gdal

Is this Portal SDK then? You can try the other way around and comment out this section in FormatConverter project (then rebuild the solution):

gdal.png

 

I'd also try to restart WWW service to make sure the environment variable was not cached.

 

Following topic also hit this problem and it helped to reinstall GDAL + restart the server.

https://community.hexagongeospatial.com/t5/Developer-Discussions/How-to-download-as-Shapefile-in-Geo...

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.