Code

Opened 5 years ago

Closed 5 years ago

#10040 closed (invalid)

GeoDjango: 'Save As' on spatial record (OSMGeoAdmin) creates broken copy *AND* corrupts the original record

Reported by: john@… Owned by: nobody
Component: GIS Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by jbronn)

Traceback for original record in Admin after SaveAs failed and created a dud copy:

Environment:

Request Method: GET
Request URL: http://url/admin/geo/borders/136/
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.flatpages',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.gis',
 'vovo.geo']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')


Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
  86.                 response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in root
  157.                 return self.model_page(request, *url.split('/', 2))
File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in model_page
  176.         return admin_obj(request, rest_of_url)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in __call__
  197.             return self.change_view(request, unquote(url))
File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in _commit_on_success
  238.                 res = func(*args, **kw)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in change_view
  590.             form = ModelForm(instance=obj)
File "/usr/lib/python2.5/site-packages/django/forms/models.py" in __init__
  216.             object_data = model_to_dict(instance, opts.fields, opts.exclude)
File "/usr/lib/python2.5/site-packages/django/forms/models.py" in model_to_dict
  138.             data[f.name] = f.value_from_object(instance)
File "/usr/lib/python2.5/site-packages/django/db/models/fields/__init__.py" in value_from_object
  332.         return getattr(obj, self.attname)
File "/usr/lib/python2.5/site-packages/django/contrib/gis/db/models/proxy.py" in __get__
  36.             geom = self._klass(geom_value)
File "/usr/lib/python2.5/site-packages/django/contrib/gis/geos/base.py" in __init__
  66.                 g = from_hex(geo_input, len(geo_input))
File "/usr/lib/python2.5/site-packages/django/contrib/gis/geos/prototypes/errcheck.py" in check_geom
  32.         raise GEOSException('Error encountered checking Geometry returned from GEOS C function "%s".' % func.__name__)

Exception Type: GEOSException at /admin/geo/borders/136/
Exception Value: Error encountered checking Geometry returned from GEOS C function "GEOSGeomFromHEX_buf".

The copy suffered much the same problem.

If I've not missed anything substantial (which is quite an If, honestly) I'd call something that causes data loss to be Critical.

Attachments (0)

Change History (4)

comment:1 follow-up: Changed 5 years ago by springmeyer

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

John,

This is most likely an installation problem with proj4. Please make sure you have installed proj4 correctly (from source), including the datum files. For more information see http://geodjango.org/docs/install.html#proj-4

Also see ticket #9295 for work on provided a better error message.

Another solution is to not use the OSMGeoAdmin and rather switch to using the GeoAdmin.

comment:2 Changed 5 years ago by jbronn

  • Description modified (diff)

comment:3 in reply to: ↑ 1 Changed 5 years ago by handelaar

Replying to springmeyer:

John,

This is most likely an installation problem with proj4. Please make sure you have installed proj4 correctly (from source), including the datum files. For more information see http://geodjango.org/docs/install.html#proj-4

Also see ticket #9295 for work on provided a better error message.

Well, yes and no.

proj is indeed the cause of the stuffed data, but my real point is that admin is modifying the original record despite being explicitly told not to. Admin, in this case, has no business changing the record I'm *not* trying to modify.

comment:4 Changed 5 years ago by anonymous

  • Resolution set to invalid
  • Status changed from new to closed

I broke my PROJ.4 (sudo mv /usr/local/share/proj/null /usr/local/share/proj/foonull), added save_as = True to my OSMGeoAdmin class for the WorldBorders model (from the GeoDjango tutorial). While the original record was intact after modifying and clicking "Save As" in the admin, the new copy was broken. This was to be expected if the admin was working correctly and the PROJ.4 missing the data files. I did this in trunk and 1.0.X from SVN.

If a reproducible test case is provided that demonstrates the problem, I'll gladly reopen. But I'm with Dane & Josh this is a PROJ.4 installation problem that's being addressed in #9295.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.