Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#4133 closed defect (worksforme)

OSRIsSame needs some touching up

Reported by: hobu Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc: hobu, antonio

Description

WKT that originates from OSR might not be equivalent in OSRIsSame's eyes

OSRSpatialReference ref;
ref.setFromUserInput("+proj=utm +zone=15 +datum=WGS84 +units=m +no_defs "); 
const char* wkt = ref.exportToWkt(); 
OSRSpatialReference ref2;
ref2.setFromUserInput(wkt);


// Returns FALSE
int equal = OSRIsSame(ref1, ref2);

}}}

Change History (4)

comment:1 by Even Rouault, 13 years ago

Weird ! Works for me with trunk. See :

>>> from osgeo import osr
>>> sr1 = osr.SpatialReference()
>>> sr1.SetFromUserInput("""+proj=utm +zone=15 +datum=WGS84 +units=m +no_defs"""
)
0
>>> print sr1
PROJCS["UTM Zone 15, Northern Hemisphere",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9108"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-93],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["Meter",1]]
>>> sr2 = osr.SpatialReference()
>>> sr2.SetFromUserInput(sr1.ExportToWkt())
0
>>> print sr2
PROJCS["UTM Zone 15, Northern Hemisphere",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9108"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-93],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["Meter",1]]
>>> sr1.IsSame(sr2)
1
>>>

What's the output of the above for you ?

comment:2 by Even Rouault, 13 years ago

Cc: hobu added

Howard, any update ?

comment:3 by Even Rouault, 13 years ago

Milestone: 1.9.0
Resolution: worksforme
Status: newclosed

comment:4 by antonio, 13 years ago

Cc: antonio added
Note: See TracTickets for help on using tickets.