Opened 5 years ago

Last modified 6 months ago

#13926 new Bug

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 5 years ago.
Patch for real.
osm_ol_admin.diff (6.7 KB) - added by elpaso66 4 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 akaihola 2 years ago.
Patch updated for the Django 1.5.1 release
osm_ol_admin.django-20130706.diff (6.2 KB) - added by akaihola 2 years ago.
Patch updated for current Django trunk

Download all attachments as: .zip

Change History (13)

comment:1 Changed 5 years ago by anonymous

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

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 Changed 5 years ago by anonymous

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

Changed 5 years ago by anonymous

Patch for real.

comment:3 Changed 5 years ago by russellm

  • Has patch set
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 4 years ago by graham_king

  • Severity set to Normal
  • Type set to Bug

comment:5 Changed 4 years ago by patchhammer

  • Easy pickings unset
  • Patch needs improvement set

openlayers.patch fails to apply cleanly on to trunk

Changed 4 years ago by elpaso66

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

comment:6 Changed 4 years ago by elpaso66

  • Cc apasotti@… added
  • UI/UX unset

Changed 2 years ago by akaihola

Patch updated for the Django 1.5.1 release

Changed 2 years ago by akaihola

Patch updated for current Django trunk

comment:7 Changed 2 years ago by claudep

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 Changed 6 months ago by GregUK

  • Version changed from 1.2 to 1.7

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

comment:9 Changed 6 months ago by claudep

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

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