[josm-dev] projection Mercator, set EPSG 3785 instead of EPSG 3857

Josh Doe josh at joshdoe.com
Tue Mar 8 15:07:44 GMT 2011


I know it's difficult to work across language barriers!

Okay, first of all the proj.4 parameters you gave aren't entirely
correct. If you look in the epsg file from proj.4 that I linked to in
my earlier message, you'll see that the parameters you claim for
EPSG:3785 (sphere) are in fact what proj.4 uses for both EPSG:3785 and
EPSG:3857. That's not entirely correct either. If you look at the EPSG
definition for 3785 that Martin linked to earlier, you'll see that the
_datum_ is spherical. The proj.4 parameter "+nadgrids=@null" (as I
linked to earlier) forces proj.4 to NOT convert between the WGS84
(ellipsoidal) and spherical datums. This is all moot since EPSG:3785
is invalid and should never be spoken of again. :)

Also, when you talk about using the inverse transform, you're
incorrectly using a different set of coordinate systems to transform
between. An application must ensure it is using the correct pair of
transforms to ensure no errors are introduced. You're trying to
transform with [1], then back with [3], while you should be going back
with [4]. Transform [3] should be paired with [2].

Remember, the coordinates in OSM use WGS84, which is ellipsoidal. If
you really wanted to transform to the (invalid)  EPSG:3785, you would
_first_ need to transform from the ellipsoidal datum of WGS84 to the
spherical datum used by EPSG:3785, then project those coordinates
using the Mercator projection.

Hopefully this clarifies the matter, though it is certainly difficult
to understand, and I don't claim 100% understanding.

Regards,
-Josh

[1] cs2cs +proj=latlong +datum=WGS84 +to +proj=merc +a=6378137 \
+b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m \
+nadgrids=@null +no_defs

[2] cs2cs +proj=latlong +datum=WGS84 +to +proj=merc +datum=WGS84 \
+units=m +nadgrids=@null +no_defs

[3]
cs2cs +proj=merc +datum=WGS84 +units=m +nadgrids=@null +no_defs \
+to +proj=latlong +datum=WGS84 -f %.6f

[4]: cs2cs +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 \
+y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +to +proj=latlong +datum=WGS84

On Tue, Mar 8, 2011 at 9:51 AM, Tobias Wendorff
<tobias.wendorff at tu-dortmund.de> wrote:
> Am 08.03.2011 14:53, schrieb Josh Doe:
>>
>> And as far as OSM putting "both datums on the same level", I have to
>> disagree. OSM itself explicitly says all coordinates are in WGS84.
>> There may be certain applications which mix things up, but that's not
>> the fault of OSM.
>
> Let me explain it in numbers, perhaps my English is too bad:
>
> WGS84 coordinates (LAT,LON): 51.0, 7.0
> [1] projection to EPSG:3785 (x,y): 5677294.03, 781182.21 (sphere)
> [2] projection to EPSG:3857 (x,y): 5677294.03, 775978.50 (ellipsoid)
>
> When a software uses the spherical formular of mercator, the
> coordinates will be drawn at "5677294.03, 781182.21".
>
> If the inverse mercator formular is also the spherical one,
> more errors will be added... x/y-coords to geographical ones:
> [3] 5677294.03, 781182.21 => 51.000000, 7.046703
>
> Used parameters on cs2cs:
> [1] cs2cs +proj=latlong +datum=WGS84 +to +proj=merc +a=6378137 \
> +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m \
> +nadgrids=@null +no_defs
>
> [2] cs2cs +proj=latlong +datum=WGS84 +to +proj=merc +datum=WGS84 \
> +units=m +nadgrids=@null +no_defs
>
> [3]
> cs2cs +proj=merc +datum=WGS84 +units=m +nadgrids=@null +no_defs \
> +to +proj=latlong +datum=WGS84 -f %.6f
>



More information about the josm-dev mailing list