1

I'm trying to plot points on these maps in R, with points from "Coordinates" in the same folder.

The WL.shp plots fine with the data, but the NG.shp (which should only be larger and of the same area + surroundings) won't show the dots?

I tried different UTM zones and GIS programs (MapInfo and QGIS). Can anyone help to what the issue is, what am I missing to make this work?

## appropriate library. 
library(StatDA)
library(rgdal)
## load data
setwd("C:\\...")
SS_data <- read.csv2("Coordinates.csv",header=TRUE)
#WL.shp file
shp.greenland<-readOGR("C:\\Users\\Andreas\\SkyDrive\\Speciale\\02. Data\\02. Statistik","WL")
## NG.shp file
shp.greenland<-readOGR("C:\\Users\\Andreas\\SkyDrive\\Speciale\\02. Data\\02. Statistik","NG")
## cordinates
Y=SS_data[,"Latitude"]
X=SS_data[,"Longitude"]

el=SS_data[,"Xx"]
## Create pdf
pdf("Au dot plot.pdf",width=50,height=20,onefile=F)
## plot map with x,y coordinates
plot(X,Y,frame.plot=FALSE,xaxt="n",yaxt="n",xlab="",ylab="",type="n")
plot(shp.greenland)#, col="grey")

# take symbols continuously growing
q=c(min(el),min(el)+(max(el)-min(el))/2,max(el))

# symbols and size
symb=c(16,16,16)
ssize=c(5,10,20)

# plot symbols:
el01=(el-min(el))/(max(el)-min(el))
el01ssize=el01*(ssize[3]-ssize[1])+ssize[1]
points(X, Y, pch=symb[3], cex=el01ssize, col="red")

#Legend
legn=round(q,2)
leg=rep(NA,length(q))
for (i in 1:length(q)){
  leg[i]=roundpretty(legn[i],2)
}
legend("topright",pch=rev(symb),pt.cex=rev(ssize), legend=rev(leg), title=paste("La ppm"),
       cex=8, col="red")
dev.off()
  • 2
    One is UTM and one is long/lat. The plotting does not automatically transform one to another (alas). – mdsumner Jul 30 '14 at 14:08
  • Great. Apparently MapInfo needs more precise instructions to make it Lat/Lon than I gave it! Thanks :-) – user3178323 Jul 30 '14 at 17:47
  • Your link appears to be dead. – Aaron Mar 9 '15 at 11:17
3

The difference in your shapefiles is that the first shapefile is in UTM coordinates and the second is in lat/lon coordinates.

  • Copy of a comment given 5 months ago. – user32309 Mar 10 '15 at 5:29
  • And in all those months, the commenter never wrote it up as an answer. If dimitris' answer gets this off the unanswered list, he deserves the credit. – JoshC May 15 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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