Opened 11 months ago

Last modified 4 months ago

#22357 new Bug

Sometimes the OSMWidget highlights the outer area of a Polygon / MultiPolygon

Reported by: babu Owned by: nobody
Component: GIS Version: master
Severity: Normal Keywords: osm
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I've seen this behaviour in Chrome (33.0.1750.152) and Firefox (28.0) on Linux.
I'll attach the images, the geojson file and the coordinates to reproduce this issue.

Attachments (4)

widget-chrome-1.png (171.8 KB) - added by babu 11 months ago.
widget in chrome - right behaviour
widget-chrome-2.png (84.5 KB) - added by babu 11 months ago.
widget in Chrome - wrong behaviour
widget-firefox.png (86.6 KB) - added by babu 11 months ago.
widget in Firefox - wrong behaviour
shape.geojson.tar.gz (114.7 KB) - added by babu 11 months ago.
compressed geojson

Download all attachments as: .zip

Change History (8)

Changed 11 months ago by babu

widget in chrome - right behaviour

Changed 11 months ago by babu

widget in Chrome - wrong behaviour

Changed 11 months ago by babu

widget in Firefox - wrong behaviour

Changed 11 months ago by babu

compressed geojson

comment:1 Changed 11 months ago by babu

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

The coordinates are around 39.21512,9.09424 http://www.openstreetmap.org/search?query=39.2142%2C9.0999#map=16/39.2142/9.0999

The field is a MultiPolygon.

comment:2 Changed 11 months ago by babu

models.py

from django.contrib.gis.db import models as gis_models
from django.db import models

class County(models.Model):
    name = models.CharField(max_length=255, blank=True)
    code = models.CharField(max_length=30)
    shape = gis_models.MultiPolygonField(blank=True, null=True, geography=True, srid=4326)

admin.py

from django.contrib.gis import admin
admin.site.register(County, admin.OSMGeoAdmin)
Last edited 11 months ago by babu (previous) (diff)

comment:3 Changed 9 months ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted
  • UI/UX unset

comment:4 Changed 4 months ago by reinout

Your screenshots aren't totally clear as they don't show the full picture. Probably, in the "right" case the polygon's contents are highlighted and in the two "wrong" cases the area *around* the polygon is highlighted instead?

My first thought is about the order in which the polygon's points are placed. Clockwise or counter-clockwise. In one of the two, the polygon should be treated as a hole instead of an area.

But... you're using exactly the same database content. So the order of points cannot have changed. Django's database layer will return the same result, independent of the browser used.

The problem thus must be in the javascript that renders the map: openlayers. Django uses openlayers.

Openlayers is loaded with a url: https://docs.djangoproject.com/en/dev/ref/contrib/gis/admin/#django.contrib.gis.admin.GeoModelAdmin.openlayers_url , currently http://openlayers.org/api/2.11/OpenLayers.js

I'd say: check if a newer openlayers version still has the problem or if it is fixed.

To me, this almost cannot be a django problem. I'd suggest closing the ticket.

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