Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#17672 closed Bug (fixed)

GeoDjango installation via MacPorts doesn't properly build GDAL

Reported by: Andy Chosak Owned by: nobody
Component: Documentation Version: 1.4-alpha-1
Severity: Normal Keywords: geodjango macports geos gdal
Cc: Andy Chosak Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The documentation for installing GeoDjango includes a section on installing via MacPorts (https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#macports). This lists the commands needed to install the various GeoDjango requirements, including GEOS and GDAL.

After installing via this method, several GeoDjango tests report errors with "ERROR 6: GEOS support not enabled" messages:

  • test07b_closepolygons (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
  • test09a_srs (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
  • test10_difference (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
  • test11_intersection (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
  • test12_symdifference (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
  • test13_union (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)

Here's the output from the test runner:

======================================================================
ERROR: test07a_polygons (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
Testing Polygon objects.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/tests/test_geom.py", line 211, in test07a_polygons
    x, y = poly.centroid.tuple
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 668, in centroid
    capi.get_centroid(self.ptr, p.ptr)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/prototypes/errcheck.py", line 107, in check_errcode
    check_err(result)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/error.py", line 40, in check_err
    raise e(msg)
OGRException: OGR failure.

======================================================================
ERROR: test07b_closepolygons (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
Testing closing Polygon objects.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/tests/test_geom.py", line 248, in test07b_closepolygons
    self.assertEqual(OGRGeometry('POINT(2.5 2.5)'), poly.centroid)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 668, in centroid
    capi.get_centroid(self.ptr, p.ptr)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/prototypes/errcheck.py", line 107, in check_errcode
    check_err(result)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/error.py", line 40, in check_err
    raise e(msg)
OGRException: OGR failure.

======================================================================
ERROR: test09a_srs (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
Testing OGR Geometries with Spatial Reference objects.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/tests/test_geom.py", line 288, in test09a_srs
    diff = a.difference(b)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 517, in difference
    return self._geomgen(capi.geom_diff, other)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 495, in _geomgen
    return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/prototypes/errcheck.py", line 77, in check_geom
    raise OGRException('Invalid geometry pointer returned from "%s".' % func.__name__)
OGRException: Invalid geometry pointer returned from "OGR_G_Difference".

======================================================================
ERROR: test10_difference (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
Testing difference().
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/tests/test_geom.py", line 359, in test10_difference
    d2 = a.difference(b)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 517, in difference
    return self._geomgen(capi.geom_diff, other)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 495, in _geomgen
    return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/prototypes/errcheck.py", line 77, in check_geom
    raise OGRException('Invalid geometry pointer returned from "%s".' % func.__name__)
OGRException: Invalid geometry pointer returned from "OGR_G_Difference".

======================================================================
ERROR: test11_intersection (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
Testing intersects() and intersection().
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/tests/test_geom.py", line 372, in test11_intersection
    i2 = a.intersection(b)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 524, in intersection
    return self._geomgen(capi.geom_intersection, other)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 495, in _geomgen
    return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/prototypes/errcheck.py", line 77, in check_geom
    raise OGRException('Invalid geometry pointer returned from "%s".' % func.__name__)
OGRException: Invalid geometry pointer returned from "OGR_G_Intersection".

======================================================================
ERROR: test12_symdifference (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
Testing sym_difference().
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/tests/test_geom.py", line 384, in test12_symdifference
    d2 = a.sym_difference(b)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 531, in sym_difference
    return self._geomgen(capi.geom_sym_diff, other)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 495, in _geomgen
    return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/prototypes/errcheck.py", line 77, in check_geom
    raise OGRException('Invalid geometry pointer returned from "%s".' % func.__name__)
OGRException: Invalid geometry pointer returned from "OGR_G_SymmetricDifference".

======================================================================
ERROR: test13_union (django.contrib.gis.gdal.tests.test_geom.OGRGeomTest)
Testing union().
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/tests/test_geom.py", line 396, in test13_union
    u2 = a.union(b)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 538, in union
    return self._geomgen(capi.geom_union, other)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/geometries.py", line 495, in _geomgen
    return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)
  File "/Users/chosak/Documents/Development/django-bugs/no-gdal/src/django/django/contrib/gis/gdal/prototypes/errcheck.py", line 77, in check_geom
    raise OGRException('Invalid geometry pointer returned from "%s".' % func.__name__)
OGRException: Invalid geometry pointer returned from "OGR_G_Union".

This is because the MacPorts install for GDAL (https://trac.macports.org/browser/trunk/dports/gis/gdal/Portfile) doesn't include GEOS support by default. There is a GEOS variant (see "variant geos" in the previous link), but it must be manually specified when installing. So instead of doing as the documentation suggests:

$ sudo port install gdal

Users should instead use:

$ sudo port install gdal +geos

Manually specifying the GEOS requirement fixes the above test errors.

Attachments (1)

install.txt.patch (319 bytes ) - added by Andy Chosak 13 years ago.
Patch for django/docs/ref/contrib/gis/install.txt

Download all attachments as: .zip

Change History (7)

comment:1 by Andy Chosak, 13 years ago

Cc: Andy Chosak added
Needs documentation: set
Type: UncategorizedBug

by Andy Chosak, 13 years ago

Attachment: install.txt.patch added

Patch for django/docs/ref/contrib/gis/install.txt

comment:2 by Andy Chosak, 13 years ago

Has patch: set

comment:3 by Christopher Medrela, 13 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Claude Paroz, 13 years ago

Needs documentation: unset
Triage Stage: AcceptedReady for checkin

comment:5 by Claude Paroz, 13 years ago

Resolution: fixed
Status: newclosed

In [17883]:

Fixed #17672 -- Precised MacPorts GeoDjango install instructions to install gdal with geos support. Thanks chosak for the report and the patch.

comment:6 by Claude Paroz, 13 years ago

In [17884]:

[1.4.X] Fixed #17672 -- Precised MacPorts GeoDjango install instructions to install gdal with geos support. Thanks chosak for the report and the patch.

Backport of r17883 from trunk.

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