[R-sig-Geo] Projection issue with Zoogeographic Realms maps

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Jul 17 00:09:54 CEST 2014


The bounding box of your data is:

> bbox(newRealms)
         min      max
x -180.00000 180.0000
y  -55.90223  83.6236

and since -180 is the same longitude as +180, its a coin toss as to
what side of the world the projection will end up putting it on (well,
not really a coin toss but subject to the approximations of floating
point arithmetic and rounding).

So any feature that has any point near + or - 180 has a chance of
those points being mapped to the other side of the world on the
Mollweide projection. This doesn't happen with the lat-long projection
because +180 and -180 are stored separately and treated as those
numbers without any transformation. Only once you start computing on
those numbers (taking sines and cosines, for example) will you get
into trouble.

This may be the same problem as here:

http://r-sig-geo.2731867.n2.nabble.com/Strange-lines-when-projecting-a-world-map-td7585274.html

the solution might be to clip the original at -179 and +179 - that
should keep points far enough away from the limb of the Mollweide
projection.

On Wed, Jul 16, 2014 at 8:45 PM, Daniel Varajão de Latorre
<danielvdelatorre at gmail.com> wrote:
> Dear list,
>
> I am trying to change the projection of a SpatialPolygonsDataFrame but
> there is something wrong going on that I can't figure. The projected map
> show some lines that shouldn't be there.
>
> The shape file was downloaded from here:
> http://macroecology.ku.dk/resources/wallace/#Gis
>
> Here is the very simple code I'm using:
>
> setwd(PATH)
> newrealms<-readShapePoly("newRealms.shp")
> proj4string(newrealms) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84
> +no_defs")
> moll_crs<-CRS("+proj=moll +ellps=WGS84")
> newrealms_moll <- spTransform(newrealms, moll_crs)
> plot(newrealms)
> plot(newrealms_moll) #unexpected lines
>
> Can anyone help me with this?
>
> Thanks in advance!
>
> Daniel
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list