<div dir="ltr"><br><br>On Thu, Nov 7, 2019 at 8:04 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br>><br>> On jeudi 7 novembre 2019 19:50:33 CET Markus Metz wrote:<br>> > On Thu, Nov 7, 2019 at 6:47 PM Martin Landa <<a href="mailto:landa.martin@gmail.com">landa.martin@gmail.com</a>> wrote:<br>> > > Hi,<br>> > ><br>> > > čt 7. 11. 2019 v 15:17 odesílatel Markus Metz<br>> > ><br>> > > <<a href="mailto:markus.metz.giswork@gmail.com">markus.metz.giswork@gmail.com</a>> napsal:<br>> > > > PROJ 6 support is not yet finished in GRASS. Currently it sort of works<br>> ><br>> > in master and relbr78, but I expect troubles because GRASS is heavily<br>> > relying on deprecated proj strings as CRS definitions. This is becoming<br>> > problematic e.g. when creating locations from GDAL/OGR datasets because<br>> > GRASS goes from OGR spatialreference through proj string to GRASS<br>> > definition.<br>> ><br>> > > OSGeo4W packages are planned to be switched to GDAL3/PROJ6 soon, are<br>> > > you aware of any known bugs?<br>> ><br>> > yes, EPSG:3857 is causing trouble. This is the WGS 84 / Pseudo-Mercator<br>> > projection on a sphere with radius 6378137 that needs special treatment<br>> > which no longer works with GRASS + PROJ 6 + GDAL 3.<br>> ><br>> > g.proj epsg=3857 -p gives me<br>> > -PROJ_INFO-------------------------------------------------<br>> > name       : WGS 84 / Pseudo-Mercator<br>> > datum      : wgs84<br>> > ellps      : wgs84<br>> > proj       : merc<br>> > lat_ts     : 0<br>> > lon_0      : 0<br>> > x_0        : 0<br>> > y_0        : 0<br>> > k          : 1<br>> > wktext     : defined<br>> > no_defs    : defined<br>> > -PROJ_EPSG-------------------------------------------------<br>> > epsg       : 3857<br>> > -PROJ_UNITS------------------------------------------------<br>> > unit       : meter<br>> > units      : meters<br>> > meters     : 1<br>> ><br>> > which is wrong because it should be a Mercator projection on a sphere, not<br>> > an ellipsoid<br>><br>> Well, this is a messy topic. EPSG:3857 uses the WebMercator projection, which<br>> is not the standard Mercator projection since it uses spherical formulas even<br>> if the datum and ellipsoid is WGS84<br><div><br></div><div>Indeed messy. Look at the WKT2 representation of projinfo -o WKT2_2018 EPSG:3857: projection on the ellipsoid "WGS 84", not on a sphere.<br></div><div>></div>> So neither  proj=merc + ellps=wgs84 or proj=merc + ellps=sphere are<br>> technically correct<br>><br>> Nothing new with PROJ 6 for that case<br>><br>> > projinfo -o PROJ EPSG:3857<br>> > gives me<br>> > PROJ.4 string:<br>> > +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1<br>> > +units=m +nadgrids=@null +wktext +no_defs +type=crs<br>><br>> Yes, this is a hack of PROJ.4 still supported by PROJ 6 to more or less get<br>> the correct result of WebMercator using the standard Mercator, by lying on the<br>> ellipsoid definition (using the Sphere) and applying a nadgrids=null, so that<br>> no datum transformation between WGS84 and that Sphere is attempted !<br><div><br></div><div>I don't understand "lying on the ellipsoid definition (using the Sphere)", it should be a sphere with radius 6378137, no?<br></div><div><br></div><div>> ></div>> > that is correct, but unfortunately not returned by GDAL's function<br>> > OSRExportToProj4() which is now deprecated.<br>><br>> Hum, I do ot agree with this. This *is* still what is returned by GDAL<br>> OSRExportToProj4() with GDAL + PROJ master :<br>><br>> $ gdalsrsinfo EPSG:3857<br>><br>> PROJ.4 : +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0<br>> +k=1 +units=m +nadgrids=@null +wktext +no_defs<br><div><br></div><div>OK, I will figure out what goes wrong in GRASS regarding the representation of EPSG:3857.</div><div><br></div><div>Thanks a lot for your very fast response, Even!</div><div><br></div><div>Markus M<br></div><div>></div>> And you also actually use (PROJ 6 required here)<br>><br>> $ gdalsrsinfo "+proj=webmerc +datum=WGS84"<br>> (or $ projinfo "+proj=webmerc +datum=WGS84 +type=crs" -o PROJ )<br>><br>> PROJ.4 : +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0<br>> +k=1 +units=m +nadgrids=@null +wktext +no_defs<br>><br>><br>> > That means GRASS needs to avoid<br>> > OSRExportToProj4() with GDAL 3+:<br>><br>> In the general case, I agree with your conclusion, but not for the above one<br>> :-)<br>><br>> --<br>> Spatialys - Geospatial professional services<br>> <a href="http://www.spatialys.com">http://www.spatialys.com</a></div>