[gdal-dev] Unable to create OGRSpatialReference

jcurru jcurru at yahoo.es
Fri Oct 19 14:00:17 PDT 2012


Frank,

First of all let me tell you thanks for your work. Thanks is not enough but
my poor english would put me in troubles if I tried to say something more
complicated. And thank you very much for your answer. Getting help from you
from the other side of the ocean (I live in Madrid, Spain) is a honor.

I am not an expert in GIS, but despite of it I am writting a big GIS
application. My colleages are supposed to be, but they have been unable to
give me a solution to this subject, so, please, be so kind to tell me if
this is ok:

Ignoring the towgs84 parameters has proved to give bad results when
transforming coordinate systems using proj4, even working with standard
systems like ETRS89 (used in Spain) or ED50. Giving the correct towgs84
parameter the errors dissapeared completely.

Therefore, I decided to write a descendant from OGRSpatialReference whose
constructors throw exceptions if the towgs84 parameter cannot be found. For
example, there's a constructor that receives an OGRSpatialReference pointer
as argument (obtained, for example, from a shapefile, a tif, a LAS file, etc
using GDAL). My class builds the underlying OGRSpatialReference with that
pointer and then tries to obtain the towgs84 parameter. Somethimes it is
present in the OGRSpatialReference object, most doesn't. Then I try to use
the "epsg." file if I can figure out the EPSG number. If everything fails
then the constructor throws and the program asks for an EPSG to the user.
And this is a pity because "almost all" the information I need is supplied
by GDAL. The program is worst because it's not able to find out the famous
parameter.

You say: "If you want to handle a datum shift properly and you don't know
how the datum of your coordinate system relates to WGS84 then you are
essentially out of luck." The problem is that my application should work
with any projection. I cannot make assumptions or make a list of "supported
projections". My aim is to be able to get the towgs84 parameter whatever
coordinate system the input files are projected into.

I often use other programs to display geospatial information, for example
Global Mapper. It realizes coordinate systems from (for example) shapefiles
without EPSG, and applies transformations correctly. What am I missing?

Sorry for my long message, but I've been overwhelmed with this problem for
two years, and having you across the line gives me a hope. I'm sure there's
a solution because many systems work fine.

So thank you again.
Sincerely yours, 
Jose Antonio.



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Unable-to-create-OGRSpatialReference-tp5009903p5009971.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list