[gdal-dev] Proj4 Transformation Error 6

Jay L. jlaura at asu.edu
Fri Jun 12 11:27:25 PDT 2015


Super cool.  Thanks!

On Fri, Jun 12, 2015 at 10:29 AM, Kyle Shannon <kyle at pobox.com> wrote:

> Jay,
>
>
> On Fri, Jun 12, 2015 at 11:21 AM, Kyle Shannon <kyle at pobox.com> wrote:
> > Jay,
> >
> >
> > On Fri, Jun 12, 2015 at 10:59 AM, Jay L. <jlaura at asu.edu> wrote:
> >> Using GDAL 1.11.2 (Anaconda Python osgeo binstar install).
> >>
> >> I have a WKT projection:
> >>
> 'PROJCS["Mercator",GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",180.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]'
> >>
> >> I import this into a srs object and attempt to export to Proj4.  This is
> >> throwing:
> >>
> >> RuntimeError: No translation for Mercator to PROJ.4 format is known.
> >
> > OGRSpatialReference needs a specific Mercator projection such as:
> > Mercator_1SP, Mercator_2SP, etc.  Use Mercator_1SP in your case for
> > the PROJECTION parameter.
> >
> >>
> >> Along the same lines, I am trying to compute pixel to latlon and the
> >> inverse.  So I need a transformation object.  No problem setting that up
> >> until:
> >>
> >> RuntimeError: Failed to initialize PROJ.4 with `+proj=merc +lon_0=0 +k=0
> >> +x_0=0 +y_0=0 +a=3396190 +b=3376200 +units=m +no_defs '.
> >>
> >> Which leads me to try:
> >>
> >> gdalsrsinfo -V '+proj=merc +lon_0=0 +k=0 +x_0=0 +y_0=0 +a=3396190
> +b=3376200
> >> +units=m +no_defs'
> >>
> >> Validate Succeeds
> >>
> >> PROJ.4 : '+proj=merc +lon_0=0 +k=0 +x_0=0 +y_0=0 +a=3396190 +b=3376200
> >> +units=m +no_defs '
> >>
> >> OGC WKT :
> >> PROJCS["unnamed",
> >>     GEOGCS["unnamed ellipse",
> >>         DATUM["unknown",
> >>             SPHEROID["unnamed",3396190,169.894447223611]],
> >>         PRIMEM["Greenwich",0],
> >>         UNIT["degree",0.0174532925199433]],
> >>     PROJECTION["Mercator_1SP"],
> >>     PARAMETER["central_meridian",0],
> >>     PARAMETER["scale_factor",0],
> >>     PARAMETER["false_easting",0],
> >>     PARAMETER["false_northing",0],
> >>     UNIT["Meter",1]]
> >>
> >> So gdalsrsinfo is able to validate the proj4 string.
> >
> > gdalsrsinfo can't validate the WKT though, without the Mercator_1SP
> >
> >>
> >> Any ideas?
> >>
> >>
> >> _______________________________________________
> >> gdal-dev mailing list
> >> gdal-dev at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
> >
> >
> > --
> > Kyle
>
> Mercator is a valid key in the ESRI WKT dialect:
>
> Type "copyright", "credits" or "license()" for more information.
> >>> from osgeo import osr
> >>> wkt =
> 'PROJCS["Mercator",GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",180.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]'
> >>> srs1 = osr.SpatialReference()
> >>> srs1.ImportFromWkt(wkt)
> 0
> >>> srs1.ExportToProj4()
> ''
> >>> srs1.MorphFromESRI()
> 0
> >>> srs1.ExportToProj4()
> '+proj=merc +lon_0=180 +k=1 +x_0=0 +y_0=0 +a=1737400 +b=1737400
> +units=m +no_defs '
>
> The osr.SpatialReference.MorphFromESRI() should do the job too.
>
> --
> Kyle
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150612/4cfd1e55/attachment.html>


More information about the gdal-dev mailing list