1

I tried plotting these two files and a set of points (dropbox folder) in QGIS and MapInfo. They align pretty good (not perfect though).

But in R, only the data from www.naturalearthdata.com can plot along with other things like the points. My 'own' shapefiles plots nicely, but always alone (not adding on top of or "allowing" points on top of) and...

My own shapefiles are rotated (clipped from a larger file where the center has north up) and I can't figure out how to save the applied rotation in MapInfo (I've tried exporting numerous ways). Maybe this is causing my issue?

library(rgdal) library(raster)
#Loading "my" shape files:
shp.WashingtonLand<-readOGR(".","WLmap2_polyline")
plot(shp.WashingtonLand)

#Loading naturalearthdata.com data for only Washington Land
shp.greenland<-readOGR(".","GRL_adm2")
ext.washington.land <- extent(-68, -58, 79.9, 81.2)
shp.clip.WashingtonLand <- crop(shp.greenland, ext.washington.land)
plot(shp.clip.WashingtonLand)

#data points
SamplePoints <- read.csv2("SamplenumberAndCoordinates",header=TRUE)
locs <- subset(SamplePoints, select = c("Latitude", "Longitude"))
coordinates(locs) <- c("Longitude", "Latitude")
plot(locs, col="red", add=T)

Hope it makes sense, it took a while getting all the things together and simplified appropriately.

2
  • 2
    Care to host your data somewhere that doesn't require us to enter an email address? Dropbox maybe? Commented Jun 26, 2014 at 14:37
  • sorry for that, was a little unsure what was the best way of attaching data, and trying the link myself, my first solution was definitely not very smart! Now it is a Dropbox :-) Commented Jun 26, 2014 at 18:21

2 Answers 2

2

For geoprocessing, I suggest to turn on-the-fly-reprojection in QGIS OFF to see whether your shapes align or not. In many cases, geoprocessing does nor work when the shapes are in different CRS. So save your polygon layer as WGS84 EPSG:4326 (do NOT use Set CRS for Layer for that!), to match with the points layer coordinates.

For the NaturalEarth dataset, it does not perfectly align for me too. Using QGIS, you can switch the project CRS to EPSG:3857, and add Google or Openstreetmap imagery from the Openlayers plugin as a reference background:

enter image description here

You see that points and polygons fit to the background, but the green GADM layer does not. I don't know how they digitized that. If you just need the coastline, you can take that from Openstreetmap:

http://openstreetmapdata.com/data/coastlines

It is the same source that is used for the Openstreetmap tiles.

2
  • both answers are correct, but this helped me realize that it is not the R code, but simply the projection of "my" own map that was WGS84 and UTM20 were the others were only WGS84, and therefore R could not plot them together, unlike QGIS and MapInfo that 'forces' different projections together (hope this i correct?) - Thanks :-) Commented Jun 27, 2014 at 8:00
  • No, QGIS does not force it, but enables it for easy visualizing. But you fail with simple tasks like clipping if your layers have different CRS.
    – AndreJ
    Commented Jun 27, 2014 at 8:19
1

The WLmap2_polyline data is using WGS 1984 UTM zone 24N, but the data is actually in zone 20N. Denmark uses a wide-area implementation of transverse Mercator for Greenland. I checked against ArcGIS and our "complex math" version of TM doesn't improve the offset. Or the data was projected into UTM 24N using the a more standard UTM implementation and that's causing the offset.

The administrative boundary data is in WGS84, as is the csv (actually semi-color separated values as the lat/lon values are using commas for the decimal point), so if R doesn't support reprojecting the data automatically, you'll have to do that.

1
  • Thanks, the simple thing about the right UTM zone helped the rotation bit. Regarding the R supporting the csv there is no issue. But it still remains for me to figure out why the points only will plot on the NaturalEarth dataset and not "my" own! Commented Jun 27, 2014 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.