Hi Everyone,

I was wondering if anyone can shed any light on what I could be doing wrong 
here. I am trying to convert a wkt from SRID 900913 to a wkt in 28350 (UTM 
50). Everything works fine if I go from 900913 -> 4326 but going from 
900913 -> 28350 throws an OGR Exception. 

I'd be grateful if anyone could shed any light on what I could be doing 
wrong. 

Thanks


Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from osgeo import ogr
>>> srs = ogr.osr.SpatialReference()
>>> srs.ImportFromEPSG(28350)
0
>>> print srs.ExportToPrettyWkt()
PROJCS["GDA94 / MGA zone 50",
    GEOGCS["GDA94",
        DATUM["Geocentric_Datum_of_Australia_1994",
            SPHEROID["GRS 1980",6378137,298.257222101,
                AUTHORITY["EPSG","7019"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6283"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4283"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",117],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",10000000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","28350"]]
>>> 
>>> from django.contrib.gis.geos import GEOSGeometry
>>> wkt = 'GEOMETRYCOLLECTION (POLYGON ((1496942.7617285000160336 
440277.2828613300225697, 146759.0942870005965233 -371789.7055273400037549, 
1086017.2977249994874001 -1291480.0297266000416130, 
2514472.4821190014481544 -9783.9396191388004809, 1496942.7617285000160336 
440277.2828613300225697)))'
>>> wkt_srid = 900913
>>> 
>>> g = GEOSGeometry(wkt, srid=wkt_srid)
>>> 
>>> g.transform(4326)
>>> print g.srid
4326
>>> 
>>> g = GEOSGeometry(wkt, srid=wkt_srid)
>>> g.transform(28350)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File 
"/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/django/contrib/gis/geos/geometry.py",
 
line 513, in transform
    g.transform(ct)
  File 
"/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.py",
 
line 414, in transform
    capi.geom_transform_to(self.ptr, sr.ptr)
  File 
"/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/django/contrib/gis/gdal/prototypes/errcheck.py",
 
line 108, in check_errcode
    check_err(result)
  File 
"/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/django/contrib/gis/gdal/error.py",
 
line 39, in check_err
    raise e(msg)
OGRException: OGR failure.
>>> 
>>> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to