Opened 14 years ago

Closed 3 years ago

#13926 closed Bug (needsinfo)

GeometryCollections are not visible in OSMGeoAdmin

Reported by: anonymous Owned by: nobody
Component: GIS Version: 1.7
Severity: Normal Keywords:
Cc: apasotti@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Geometry collections fail to display in OSMGeoAdmin.

The bug appears in the geodjango_geom.write_wkt function:

geodjango_geom.write_wkt = function(feat){
if (geodjango_geom.is_collection){ geodjango_geom.num_geom = feat.geometry.components.length;}
  else { geodjango_geom.num_geom = 1;}
  document.getElementById('id_geom').value = geodjango_geom.get_ewkt(feat);
} 

If 'feat' is a geometry collection, it does not have a geometry property, but it is an array of type OpenLayers.Feature.Vector.

Attachments (4)

openlayers.patch (4.0 KB ) - added by anonymous 14 years ago.
Patch for real.
osm_ol_admin.diff (6.7 KB ) - added by elpaso66 13 years ago.
New patch for django/contrib/gis/templates/gis/admin/openlayers.js, should apply on trunk.
osm_ol_admin.django-1.5.1.diff (7.1 KB ) - added by Antti Kaihola 11 years ago.
Patch updated for the Django 1.5.1 release
osm_ol_admin.django-20130706.diff (6.2 KB ) - added by Antti Kaihola 11 years ago.
Patch updated for current Django trunk

Download all attachments as: .zip

Change History (14)

comment:1 by anonymous, 14 years ago

Attempted attaching a patch, but it didn't happen. Here it is:

* openlayers-dist.js 2010-07-12 12:19:47.126525645 -0400
--- openlayers.js 2010-07-12 12:22:44.874936920 -0400
*
* 17,23

return {{ module }}.wkt_f.read(wkt);

}
{{ module }}.write_wkt = function(feat){

! if ({{ module }}.is_collection){ {{ module }}.num_geom = feat.geometry.components.length;}

else { {{ module }}.num_geom = 1;}
document.getElementById('{{ id }}').value = {{ module }}.get_ewkt(feat);

}

--- 17,23 ----

return {{ module }}.wkt_f.read(wkt);

}
{{ module }}.write_wkt = function(feat){

! if ({{ module }}.is_collection){ {{ module }}.num_geom = feat.length;}

else { {{ module }}.num_geom = 1;}
document.getElementById('{{ id }}').value = {{ module }}.get_ewkt(feat);

}

comment:2 by anonymous, 14 years ago

The above patch is for django/contrib/gis/templates/gis/admin/openlayers.js

by anonymous, 14 years ago

Attachment: openlayers.patch added

Patch for real.

comment:3 by Russell Keith-Magee, 14 years ago

Has patch: set
Triage Stage: UnreviewedAccepted

comment:4 by Graham King, 14 years ago

Severity: Normal
Type: Bug

comment:5 by patchhammer, 14 years ago

Easy pickings: unset
Patch needs improvement: set

openlayers.patch fails to apply cleanly on to trunk

by elpaso66, 13 years ago

Attachment: osm_ol_admin.diff added

New patch for django/contrib/gis/templates/gis/admin/openlayers.js, should apply on trunk.

comment:6 by elpaso66, 13 years ago

Cc: apasotti@… added
UI/UX: unset

by Antti Kaihola, 11 years ago

Patch updated for the Django 1.5.1 release

by Antti Kaihola, 11 years ago

Patch updated for current Django trunk

comment:7 by Claude Paroz, 11 years ago

Thanks for maintaining the patch up-to-date.
With the recent addition (Django 1.6) of GIS-specialized form fields and widgets (#5472), GeoModelAdmin/OSMGeoAdmin will become mostly obsolete, and the geometry collections issue should be solved.

I would be interested by any experience on using the new fields/widgets with any GIS project using Django 1.6 and normal ModelAdmin objects.

comment:8 by Greg, 10 years ago

Version: 1.21.7

The patch does not appear to be applied in Django 1.7 and geometry collections are not rendered in geomodeladmin

comment:9 by Claude Paroz, 10 years ago

GregUK, what about using a normal ModelAdmin (in lieu of a GeoModelAdmin)?

comment:10 by Mariusz Felisiak, 3 years ago

Resolution: needsinfo
Status: newclosed

GeoModelAdmin and OSMGeoAdmin are deprecated (see 4555aa0a489cb9dcf764edf12339097cdfa5ff84). Please reopen the ticket if you can confirm your issue with admin.ModelAdmin.

Note: See TracTickets for help on using tickets.
Back to Top