Federico Calboli | 31 Oct 12:50 2014
Picon

spplot: getting proportional col.regions across different plots

Hi All,

I am doing some kriging (on the heat loss of a floor) and I am producing three plots.

This code

spplot(res.bare$krige_output[,1], col.regions = rev(heat.colors(100)), sp.layout =
c('sp.points', R.bare2, col='black', pch=16))

works flawlessly.  The main problem I have is that

col.regions = rev(heat.colors(100))

gives me the exact color scale across the three plots, while my ranges are quite different:

plot 1 0.4318156 1.8557941
plot 2 2.318537 4.237029
plot 3 9.861249 12.438198

Overall my heat loss goes from 0.4318156 to 12.438198 across the three maps.  I would like to now change the
col.regions = rev(heat.colors(100)) so that the colors reflect this fact: if we assume that 0.4318156 ==
white and 12.438198 == full red I want the colours in each map to take this into account.

I have tried to partition the heat.colors(100) output across the three maps thus:

col.regions = rev(heat.colors(100)[1:15])

but it does not work.  Any ideas on how to achieve what I am describing?  BTW I am happy to expand the palette (say
from blue to red) if that makes it simpler.

(Continue reading)

Monika Wagner | 31 Oct 11:08 2014
Picon

Antarctica map

Hi,

I've a problem mapping the antarctica with data from
http://www.gadm.org/download. I used this code:

library(ggplot2)

load("ATA_adm0.RData")
an<-gadm

antmap<-ggplot()+
  geom_path(data=an,aes(x=long,y=lat,group=group))+
  scale_y_continuous(limits=c(-90,-50)) +
  scale_x_continuous(limits=c(-175,186))

antmap + coord_map("ortho", orientation=c(-90, 0, 0))

Apparently, there is data missing, thus the plot shows some kind of dud
coordinate at the center.  Can I somehow delete it and connect the
"beginning" and "end" of the coast line?

Thanks!
Monika

	[[alternative HTML version deleted]]
Paul hewson | 30 Oct 19:14 2014
Picon

Strange Rgdal compile error (possibly three)

I'm trying to install rgdal on Kubuntu 14.04 and R 3.1.1; I have spent a lot
of time following up various online suggestions for the problems I think I'm
seeing but am currently rather baffled.   I'd be very grateful for a hint.  
I am using R CMD INSTALL ......

libgdal1-dev is installed, mariadb is installed, and armadillo/poppler etc
are installed (although ld can't find them).

To date, I have followed
- Old postings about GDALAllRegister not found
http://stackoverflow.com/questions/15569720/install-rgdal-library-in-rstudio-gdalallregister-not-found-in-libgdal
- not relevant here (I have compiliers)
- GDAL stuff on the amadillo / poppler missing (they are not - there might
be some ubuntu packaging issue here if I'm reading launchpad right)
https://bugs.launchpad.net/ubuntu/+source/gdal/+bug/1194082
- There is some stuff on MySQL / mariadb compatibility.
https://github.com/Homebrew/homebrew/issues/32973

If anyone has any hints about what I should do next I'd be really grateful.  
For example, I don't know whether to knock out mariadb to see whether/how
that helps, but there seem to be orthogonal warnings.

checking gdal: linking with --libs only... no
checking gdal: linking with --libs and --dep-libs... no

/usr/lib/libgdal.so: undefined reference to `mysql_error <at> libmysqlclient_18'
/usr/lib/libgdal.so: undefined reference to
`mysql_options <at> libmysqlclient_18'
/usr/lib/libgdal.so: undefined reference to
`mysql_fetch_lengths <at> libmysqlclient_18'
(Continue reading)

Marc Marí Dell'Olmo | 28 Oct 15:12 2014
Picon

gUnion error -> TopologyException: side location conflict at...

Dear all,

I would like to join the polygons of two maps (with
SpatialPolygonsDataFrame format). I was trying to use gUnion funcition
(rgeos library) but I obtained the following error:

> setwd("R:/CARTOGRAFIA/Barcelona")
>
> BCN.SC<-readShapeSpatial("barcelona_SC2001.shp")
> proj4string(BCN.SC) <- CRS("+proj=merc +datum=WGS84 +units=m")
> BCN.SC<- spTransform(BCN.SC, CRS("+init=epsg:23031")) #ED50
> BCN.CP<-readShapeSpatial("Dist_postals_BCN.shp") #ED50
> proj4string(BCN.CP) <- CRS("+init=epsg:23031")
>
> gIsValid(BCN.CP)
[1] TRUE
> gIsValid(BCN.SC)
[1] TRUE
>
>
> aux <- gUnion(BCN.SC,BCN.CP)
Error in RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_lower_td,
"rgeos_union") :
  TopologyException: side location conflict at 425106.60792063997
4583876.4374835696

I can't understand what's happening, glsValid is true for both shp
files. Moreover, I've made a zoom to this point and I can see anything
wrong.

(Continue reading)

Barry Rowlingson | 28 Oct 10:47 2014
Picon

Re: Calculate the length of hail paths

I downloaded the hail and tornado shapefile It looks like hailstorms in the
original data files don't really move, except maybe one 10m grid square.
This first one from 2013 goes nowhere:

Slot "coords":
         [,1]      [,2]
[1,] 185758.3 -246307.6
[2,] 185758.3 -246307.6

I reckon theyve tried to use the same format as the tornado data, which can
have quite large differences between start and end point, but hailstorms
are such a short intense event that the motion isn't important relative to
the size.

So I don't think there's essentially any "track" information in the data,
and it should be considered point events.

Barry

On Mon, Oct 27, 2014 at 2:49 PM, St John Brown <st_john_brown <at> yahoo.com>
wrote:

> Hello,
>
> I am trying to calculate the the length of the trajectory of historic hail
> storms in the United States. I have written the R code to do this but my
> results do not seem valid. The majority of my results are around 14 meters
> which does not seem correct.
>
> My data comes from the NOAA in the form of a shape file (hail.zip) [1].
(Continue reading)

Barry Rowlingson | 28 Oct 10:24 2014
Picon

Re: Calculate the length of hail paths

On this small scale, you can almost use pythagoras to see that the answer
is about 14 metres:

myLines1 = Lines(list(Line(matrix(c(-
519049.1, -519039.1, -736427.4, -736417.4), nrow=2, ncol=2))), ID="1")

the change in X is 10, the change in Y is 10, hence the distance is
sqrt(10^2 + 10^2) which is 10*sqrt(2) = 14.1. You say your original units
are in metres, so the answer is in metres.

Is your problem that you were expecting tracks to be kilometres long? In
which case either your units are wrong or this is just a segment of a track
and you need to piece together a whole bunch of them. I've not looked at
the shapefile yet...

Barry

On Tue, Oct 28, 2014 at 7:08 AM, Frede Aakmann Tøgersen <frtog <at> vestas.com>
wrote:

> Hi
>
> Why not check your results with calculators for great-circle distance like
> http://www.movable-type.co.uk/scripts/latlong.html. There the haversine
> formula is used. Using
>
> > res[[1]]
> [[1]]
>           [,1]    [,2]
> [1,] -101.5000 32.2000
(Continue reading)

Steven Ranney | 28 Oct 01:43 2014
Picon

Generate a vector of names of intersecting polgons

All -

As a disclaimer, I admit that I am relatively new to spatial data
manipulation with R.  I am familiar with some of the more basic functions
and packages but need some guidance.

What I want to do:

I have two .shp files, shpA and shpB, both of which contain many polygons.
I would like to overlay shpA on shpB and get a vector of the polygon names
in shpB that intersect with polygons in shpA.  In a perfect world, I would
then be able to join the vector of names to each polygon in shpA as a new
attribute.

I tried using over() but over() didn't like the fact that both of my .shp
files were SpatialPolygonsDataFrames.

Is there a simple way to do this?  Can anyone offer some advice?

Thanks -

SR
Steven H. Ranney

	[[alternative HTML version deleted]]
Schmid Sarah | 27 Oct 16:30 2014
Picon
Picon

Package Ncf and p-value

Dear list, 

I’m new in spatial analysis and I’m currently working on a project to test spatial autocorrelation. To
do that, I tested different packages. I’m now working with the package NCF and I used the functions «
correlog » and « plot correlog » to create a spatial correlogram. The « correlog » function gives an
output like this:

$n
 1  2  3  4  5  6  7  8  9 10 11 12 13 
10 30 34 34 37 16 12 12 16  4  1  2  2 

$mean.of.class
        1         2         3         4         5         6         7         8         9 
 1549.835  3943.671  6244.956  8892.066 11016.439 13612.315 16021.493 18720.450 21273.439 
       10        11        12        13 
23958.896 25387.395 28385.142 31038.719 

$correlation
          1           2           3           4           5           6           7 
 0.33199900 -0.27605309 -0.11705592  0.08689537  0.08344518 -0.37666967 -0.08440457 
          8           9          10          11          12          13 
-0.18318189  0.12377523 -0.35018005 -0.24026463  0.86372582 -0.21476426 

$x.intercept
(Intercept) 
   2636.626 

$p
 [1] 0.09490509 0.08591409 0.31968032 0.17882118 0.18781219 0.08591409 0.47352647 0.29570430
 [9] 0.17582418 0.25474525 0.40159840 0.07192807 0.34465534
(Continue reading)

St John Brown | 27 Oct 15:49 2014
Picon

Calculate the length of hail paths

Hello,

I am trying to calculate the the length of the trajectory of historic hail storms in the United States. I have
written the R code to do this but my results do not seem valid. The majority of my results are around 14 meters
which does not seem correct.

My data comes from the NOAA in the form of a shape file (hail.zip) [1]. When I read the shape file I have an
object of class SpatialLinesDataframe. The individual lines represent the paths of the historic hail storms.

Below I have created an example SpatialLines object with lines from the original data and my method for
calculating the path length. As you can see the results are around 14 meters. Am I calculating the
distances correctly?

I appreciate any help!

[1] http://www.spc.noaa.gov/gis/svrgis/

library(sp)
library(geosphere)

#create example SpatialLines obj
myLines1 = Lines(list(Line(matrix(c(-519049.1, -519039.1, -736427.4, -736417.4), nrow=2,
ncol=2))), ID="1")
myLines2 = Lines(list(Line(matrix(c(527165, 527175, 261338.5, 261348.5), nrow=2, ncol=2))), ID="2")
proj_str_lcc = CRS("+proj=lcc +lat_1=33 +lat_2=45 +lat_0=39 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83
+units=m +no_defs +ellps=GRS80 +towgs84=0,0,0")
mySpLines = SpatialLines(list(myLines1,myLines2), proj4string=proj_str_lcc)

#calculate distance of line paths
proj.str.alb = CRS("+proj=longlat +datum=WGS84")
(Continue reading)

Navinder Singh | 27 Oct 13:50 2014
Picon
Picon

Space-time movement Trajectory on a hovmoller plot

Dear List,
Is there a way to plot spatio-temporal x,y/long-lat co-ordinates over a hovmoller diagram available in
the rasterVis package.
I have some animal movement data which has x,y and time (as.Date) object attached to it and is from the same
time period as snow.
Now i have created a hovmoller plot from the rasterVis with interpolated snow data for an entire year with
daily resolution and would like to overlay the animal locations during that period with respect to snow.
Is there a straightforward way to do it by using sp/raster/rasterVis/.
Thanks,
Navinder

Navinder J Singh
Associate Professor
Department of Wildlife, Fish, and Environmental Studies
Faculty of Forest Sciences
Swedish University of Agricultural Sciences
SE-901 83 Umea, Sweden
O: +46 (0)90 786 8538;
M: +46 (0)70 676 0103
email: navinder.singh <at> slu.se<mailto:navinder.singh <at> slu.se>
Web: navinderjsingh.weebly.com<http://navinderjsingh.weebly.com/>

www.slu.se/viltfiskmiljo/navinder_singh<http://www.slu.se/viltfiskmiljo/navinder_singh>
http://slu-se.academia.edu/NSingh

	[[alternative HTML version deleted]]

_______________________________________________
(Continue reading)

Angel Ferrero | 24 Oct 17:12 2014
Picon

Error: identicalCRS(x, y) is not TRUE after using the over() command


Hi everyone, 

I am new to doing this kind of thing in R, but I have been trying to perform co-kriging for a set of datapoints in
relation to climate from the worldclim project based on a previous example I found using the meuse shp.

This is my code, and at the end of it, you can see the error I get: identicalCRS(x, y) is not TRUE after using the
over() command.

I would appreciate if anybody could help me out this this.

Best

Ángel

#Let's first create a prediction grid for the interpolation, starting from the shape file

setwd(“*")
data<-read.table(“/*",header=T) 

coordinates(data)=~long+lat

proj4string(data)=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")

border0<-readOGR("country.shp","country")
border <- spTransform(border0, CRS("+proj=longlat +ellps=WGS84 +datum=WGS84"))
proj4string(border)=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")

bio <- getData("worldclim", var="bio", res=10)   # this will download global data on minimum temperature
at 10 min resolution
(Continue reading)


Gmane