| 1 | from django.contrib.gis import geos
|
|---|
| 2 | from django.contrib.gis import gdal
|
|---|
| 3 |
|
|---|
| 4 | a = geos.Point(1, 2, srid=4326)
|
|---|
| 5 | print 'WGS84:', a.coords
|
|---|
| 6 | w2c = 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'))
|
|---|
| 8 | b = a.transform(w2c, clone=True)
|
|---|
| 9 | b.srid = 999999 # crash if correct SRID
|
|---|
| 10 | #b.srid = 4326 # success if bogus SRID
|
|---|
| 11 | print 'custom:', b.coords
|
|---|
| 12 | c2w = 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))
|
|---|
| 14 | c = b.transform(c2w, clone=True)
|
|---|
| 15 | print 'back to WGS84', c.coords
|
|---|