In a Python script, I want to compare spatial reference systems. For context, I am creating a map image with Python MapScript, the map SRS is UTM, the layer SRS for one of the layers could sometimes be in UTM or sometimes in Lat/Long. The extent of the map will be based on this layer.
<br><br>As I build the layer, I want to check to see what SRS it is in, if it is in Lat/Long, I am planning to grab it's extent in lat/long, create a rectObj, and then project this rectObj to UTM so I can use the coordinates for my map extent.
<br><br>Assuming that this is a reasonable way to approach the problem, I am curious how to use OGR, OSR, or MapScript to compare SRS's. If I create SRS objects, can I just check that they are equal, as below, or do I need to dump them to WKT or proj Defs and do a string comparison?
<br><br>e.g. <br><br> srs_one = osr.SpatialReference()<br> srs_two = osr.SpatialReference()<br><br> srs_one .ImportFromEPSG(4326)<br> srs_two .ImportFromEPSG(26915)<br><br> if srs_one == srs_two:<br> print "they are the same"
<br> else:<br> print "they are different"<br><br><br>Thanks, <br><br>David.<br><br><br>