Skip to content
Prev 2386 / 29559 Next

azymuth error, polygons and Lisbon projection

On Thu, 26 Jul 2007, Marta Rufino wrote:

            
gzAzymuth() in the maptools package is for geographical coordinates, as 
its help page says, and yours seem to be projected.
With difficulty, probably using functions in the gpclib package to 
intersect the polygon with a rectangle. There is code inside Rgshhs() in 
maptools that uses this approach - the difficulty is that the polygon 
border may cross the line several times, creating multiple included 
fragments.
t1 <- as.SpatialPolygons.SpatialPixels(x)
df <- slot(x, "data")
rownames(df) <- sapply(slot(t1, "polygons"), function(x) slot(x, "ID"))
t2 <- SpatialPolygonsDataFrame(t1, data=df)
library(maptools)
library(gpclib)
t3 <- unionSpatialPolygons(t2, t2$var1.pred > 5)
spl1 <- list("sp.polygons", t3, lwd=2, col="blue")
spplot(t2, "var1.pred", sp.layout=list(spl1))
Maybe you should cross-check on Grids & Datums:

http://www.asprs.org/resources/GRIDS/

April 2002. It seems to have most of what you need to construct a proj4 
encoding for the Lisboa datum, Hayford-Gauss system maps, but you'll need 
to be careful, and check with other users. It looks very like 
"+init=epsg:20790" without a datum, but the G&D and EPSG reverse the false 
eastings and northings.
Hope this helps,

Roger