ngageoint / geoq

Django web application to collect geospatial features and manage feature collection among groups of users
MIT License
704 stars 133 forks source link

Creating Shapefile errors #254

Open stephenrjones opened 10 years ago

stephenrjones commented 10 years ago

When trying to create a shapefile from the Job detail page, the system throws a Segmentation fault and exits:

Validating models...

0 errors found September 19, 2014 - 08:21:25 Django version 1.5.4, using settings 'geoq.settings' Development server is running at http://0.0.0.0:8000/ Quit the server with CONTROL-C. /opt/src/pyenv/geoq/nga-geoq/lib/python2.6/site-packages/django/conf/urls/defaults.py:3: DeprecationWarning: django.conf.urls.defaults is deprecated; use django.conf.urls instead DeprecationWarning) Segmentation fault (core dumped)

stephenrjones commented 10 years ago

Just digging into this a little more -- it seems that the GDAL DataStore object isn't getting initialized correctly for some reason. An error gets thrown when trying to use it in other calls (OGR_DS_CREATE, OGR_DS_DESTROY). When this happens the temporary file created is in the incorrect state, and trying to write to it later causes the Seg fault

jaycrossler commented 10 years ago

This might be a way to turn on exceptions: http://trac.osgeo.org/gdal/wiki/PythonGotchas#PythonbindingsdonotraiseexceptionsunlessyouexplicitlycallUseExceptions

jaycrossler commented 10 years ago

Though, this doesn't seem to be working (probably because we're not using the osgeo library - couldn't get that working). I tried:

from django.contrib.gis.gdal.libgdal import lgdal lgdal.UseExceptions()

but that didn't work. Maybe you can see if the osgeo library works on your build?

stephenrjones commented 10 years ago

Sure, I'll give it a shot

jaycrossler commented 10 years ago

This shows the libraries that it checks for: https://github.com/django/django/blob/master/django/contrib/gis/gdal/libgdal.py

But the version I have loaded checks for: lib_names = ['gdal', 'GDAL', 'gdal1.9.0', 'gdal1.8.0', 'gdal1.7.0', 'gdal1.6.0', 'gdal1.5.0']

I'm wondering if the problem is the versions?

stephenrjones commented 10 years ago

That's what I was suspecting. Which version of gdal do you have installed?

stephenrjones commented 10 years ago

updated from 1.7.3 to 1.9.2 and still see the problem

jaycrossler commented 10 years ago

from django.contrib.gis.gdal import libgdal help(libgdal) gives 1.9.2

jaycrossler commented 10 years ago

I see that the newest version of django has 1.11... is there a way to just update django.contrib.gis.gdal ? Maybe 1.11 can help us. I'm also trying to export "Geospatial PDF" (for #256), but don't have that driver loaded with 1.9.2, and I don't think you can write to it with 1.9.2.

But, if you're up to 1.9.2, I'm not sure if that's still the issue.

stephenrjones commented 9 years ago

Finally fixed this issue. Running this code on an x86_64 caused issues as the pointer values being passed from the GDAL calls were getting truncated to 32-bit values, which then were invalid. I setup function definitions within shape_view.py to check if the system is a 64bit system and create function signatures that would accept 64bit values