Code

Ticket #19171: djangofail.py

File djangofail.py, 733 bytes (added by reidpr@…, 21 months ago)

script to demonstrate bug

Line 
1from django.contrib.gis import geos
2from django.contrib.gis import gdal
3
4a = geos.Point(1, 2, srid=4326)
5print 'WGS84:', a.coords
6w2c = gdal.CoordTransform(gdal.SpatialReference(4326),
7                          gdal.SpatialReference('+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs'))
8b = a.transform(w2c, clone=True)
9b.srid = 999999 # crash if correct SRID
10#b.srid = 4326   # success if bogus SRID
11print 'custom:', b.coords
12c2w = gdal.CoordTransform(gdal.SpatialReference('+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs'),
13                          gdal.SpatialReference(4326))
14c = b.transform(c2w, clone=True)
15print 'back to WGS84', c.coords