Subscribe to R-sig-geo feed
This is an archive for R-sig-geo, not a forum. It is not possible to post through Nabble - you may not start a new thread nor follow up an existing thread. If you wish to post, but are not subscribed to the list through the list homepage, subscribe first (through the list homepage, not via Nabble) and post from your subscribed email address. Until 2015-06-20, subscribers could post through Nabble, but policy has been changed as too many non-subscribers misunderstood the interface.
Updated: 2 hours 22 min ago

Video recordings from the OpenGeoHub Summer School IBOT, Prague August 19-25, 2018

Mon, 10/01/2018 - 03:55

The video recordings from the OpenGeoHub Summer School IBOT, Prague
August 19-25, 2018 are now available via our youtube channel:

https://www.youtube.com/channel/UC6HFFFYiV4zEYJlQMIXemWA

I am trying to organize all current and past materials into a structured
course/archive so that everyone should be able to easier find her/his
topics of interest:

https://opengeohub.org/course

*this might take me few weeks because we have collected many materials
over years.

Many many thanks to the lecturers: Edzer Pebesma (IfGI University of
Muenster, Muenster Germany), Roger Bivand (Department of Economics,
Norwegian School of Economics, Bergen, Norway), Markus Neteler
(Mundialis, Bonn, Germany), Tim Appelhans (GfK Geomarketing, Germany),
Robin Lovelace (University of Leeds, UK), Jannes Münchow (Geographic
Information Science, Friedrich Schiller University Jena, Jena, Germany),
Jakub Nowosad (Space Informatics Lab, University of Cincinnati, Ohio
USA), Veronica Andreo (National Institute of Tropical Medicine INMeT,
Argentina) and Hanna Meyer & Chris Reudenbach (Environmental
Informatics, Philipps University Marburg, Germany) for coming to Prague
and for sharing their materials!

And many many thanks to IBOT's department of GIS and remote sensing
Matej Man and Jan Wild for being such excellent hosts!

yours,

Tom Hengl
The OpenGeoHub Foundation
http://www.opengeohub.org/about

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Linear referencing in R

Sat, 09/29/2018 - 20:17
You need to snip out the sections of the railroad file rather than
connecting the endpoints. Maybe this is closer to what you want?

segments = topoESQ_comp %>%
  filter(to_km <= 871) %>%
  purrr::pmap(function(from_km, to_km, ...) {
    st_linestring(do.call(rbind,
Estacas_1m$geometry[((1000*from_km):(1000*to_km))+1]))
}) %>%
  st_sfc

Kent Johnson


> Date: Fri, 28 Sep 2018 19:52:03 -0300
> From: Rubem Dornas <[hidden email]>
> To: [hidden email]
> Subject: [R-sig-Geo] Linear referencing in R
> Hi, people! I hope I'll be not to speculative in my question and that you
> can comprehend my problem.
>
> Well, I have a railroad shapefile and I have two csv files corresponding to
> the topography in each side of the railroad. The csv are organized in this
> way:
>
> ID_topo, from_km, to_km, height
> 1, 0, 1.91, 15
> 2, 1.91, 2.23, -3
>
> I created a point shapefile for each meter of the railroad and then I
> proceeded with a join (not spatial) between the from_km of the topography
> data frame and the km mark (km_calc) from the point railroad.
>
> My goal is to create shapefiles for each of the railroadside topography.
> The issue is that when I try to make a new line shapefile from topography
> based on the points of the railroad, what I get is a line that has doesn't
> follow the curvature of the railroad. Using the example of the csv above,
> what I get are several straight lines linked by the from_km to to_km. (Here
> is a link to a print screen from QGIS:
>
> https://www.dropbox.com/s/erfsst8pasoqj64/Captura%20de%20tela%202018-09-28%2019.49.47.png?dl=0
> <http://Image>)
>
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: spgm

Sat, 09/29/2018 - 07:52
On Sat, 29 Sep 2018, Hulényi Martin wrote:

> Dear all,
>
>
> I would like to ask if there is a possibility to apply something
> similiar to the "impacts" from spdep package for SAR regressions using
> the spgm function from the splm package.
>

A reprex would have helped. Here is mine:

data(Produc, package = "plm")
data(usaww) # dense row-standardised weights matrix
GM <- spgm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp, data=Produc,
   listw = usaww, moments="fullweights", lag=TRUE, spatial.error = FALSE)
class(GM)
?impacts.stsls # spdep method for stsls objects
head(Produc)
length(unique(Produc$year)) # T
big <- kronecker(diag(length(unique(Produc$year))), usaww)
listw <- mat2listw(big, style="W")
tr <- trW(as(listw, "CsparseMatrix"), m=100)
impacts(GM, listw=listw)
impacts(GM, tr=tr)
summary(impacts(GM, tr=tr, R=1000), zstats=TRUE, short=TRUE)

The splm:::impacts.splm() method cannot dispatch on stsls objects, so they
try to use the spdep:::impacts.stsls() method, but there the data rows are
n x T but listw is only of n rows. Looking inside splm:::impacts.splm(),
you see that a sparse kronecker product matrix is constructed - either do
the same if your n x T is large, or follow the above using a dense
kronecker product and cast back to listw representation to create the
trace vector.

Hope this clarifies,

Roger

>
> Best regards,
>
>
> Martin Hul???nyi ?
>
>
> [eco.jpg]       Pred vytla???en???m tohto mailu zv???te pros???m vplyv na ???ivotn??? prostredie. ???akujeme.
> Please consider the environment before printing this e-mail. Thanks
>
> [[alternative HTML version deleted]]
>
> --
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Re: Consolidated SRS database/list?

Sat, 09/29/2018 - 07:11
This blog:

https://erouault.blogspot.com/2018/09/srs-barn-raising-4th-report.html

gives the status on the proposed generic db to ship with PROJ and be used
by software using PROJ.

Roger

On Sat, 22 Sep 2018, Alex Mandel wrote:

> Though it requires Internet what about hitting the epsg.io API described
> on https://github.com/klokantech/epsg.io
>
> Thanks,
> Alex
>
> On 09/22/2018 05:23 AM, Vijay Lulla wrote:
>> Alex,
>> Thanks for QGIS's srs.db!  I wasn't aware of it.
>>
>> I currently use the spatial_ref_sys from PostGIS to create a SRS data frame
>> but plan to use rgdal::make_EPSG more often.  The reason I brought this up
>> is because on the lab computers (cannot install stuff on it) where I teach
>> there is no PostGIS and I didn't know how to lookup EPSG codes for various
>> SRS definitions from within R.  I hadn't thought of Spatialite metadata as
>> a viable alternative.  So, thanks for that.  I will look into it and most
>> likely use it in conjunction with make_EPSG!
>>
>> Finally, I am really looking forward to the consolidated SRS database from
>> the gdal barn-raising effort!  This consolidated database will be
>> invaluable, and of great aid/service, to the geospatial community, IMO.
>> Thanks,
>> Vijay.
>>
>> On Sat, Sep 22, 2018 at 1:22 AM Alex Mandel <[hidden email]>
>> wrote:
>>
>>> QGIS makes one
>>> https://github.com/qgis/QGIS/blob/master/resources/srs.db
>>> There's some script in the build that updates it also, not without issue:
>>> https://issues.qgis.org/issues/17993
>>>
>>> I suppose you could also dump out how PostGIS does it to Sqlite, or use
>>> the Spatialite metadata table.
>>> https://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/metadata.html
>>>
>>> But the thread mentioned that goes back to the MetaCRS mailing list is
>>> probably the right place in the community to revive the discussion.
>>>
>>> Seems like something to encourage, and a good topic for an OSGeo
>>> sponsored sprint.
>>>
>>> Thanks,
>>> Alex
>>>
>>> On 09/21/2018 12:32 AM, Roger Bivand wrote:
>>>> On Thu, 20 Sep 2018, Vijay Lulla wrote:
>>>>
>>>>> Ok, thanks!  While the page provided information about the project and
>>>>> its
>>>>> funding status I couldn't find the SQLite database.  Do you happen to
>>>>> know
>>>>> when this will be available?
>>>>
>>>> No more than is on that page, plus the time needed to re-write plenty of
>>>> sf, lwgeom, rgdal and sp. At that stage, contributions welcome!
>>>>
>>>> Roger
>>>>
>>>>>
>>>>> On Thu, Sep 20, 2018 at 1:02 PM Roger Bivand <[hidden email]>
>>> wrote:
>>>>>
>>>>>> On Thu, 20 Sep 2018, Vijay Lulla wrote:
>>>>>>
>>>>>>> Dear list members,
>>>>>>> A few years ago Roger Bivand posted a discussion (
>>>>>>> https://stat.ethz.ch/pipermail/r-sig-geo/2015-August/023204.html )
>>>>>>> about
>>>>>>> consolidating SRS definitions into a SQLite database and I am
>>> wondering
>>>>>> if
>>>>>>> there has been any development along those lines.
>>>>>>
>>>>>> Rather than trying this just within R, we're hoping that the GDAL
>>>>>> barn-raising effort:
>>>>>>
>>>>>> https://gdalbarn.com/
>>>>>>
>>>>>> will take us there and further, and be much better than having a
>>>>>> non-standard implementation.
>>>>>>
>>>>>> When that effort is done, we'll be open for ideas about interfacing it
>>>>>> through PROJ and GDAL, which now ship with CSV files that we copy into
>>>>>> Windows and MacOS binary packages (rgdal, sf, lwgeom).
>>>>>>
>>>>>> For now, if it helps, rgdal::make_EPSG() reads the EPSG CSV file
>>> shipped
>>>>>> with PROJ into the R workspace as a data.frame.
>>>>>>
>>>>>> Roger
>>>>>>
>>>>>>> Specifically, is there any consolidated collection of SRS
>>>>>>> definitions in
>>>>>>> R (either a data.frame or tibble or SQLite backed) that are being used
>>>>>>> by geospatial packages that users can use too?  If so, can you please
>>>>>>> point me to it?  If not, would it be worthwhile to have this
>>>>>>> consolidated list/dataframe, maybe as part of data for one of the core
>>>>>>> geospatial packages? Thanks in advance, Vijay
>>>>>>>
>>>>>>>       [[alternative HTML version deleted]]
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> R-sig-Geo mailing list
>>>>>>> [hidden email]
>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Roger Bivand
>>>>>> Department of Economics, Norwegian School of Economics,
>>>>>> Helleveien 30, N-5045 Bergen, Norway.
>>>>>> voice: +47 55 95 93 55; e-mail: [hidden email]
>>>>>> http://orcid.org/0000-0003-2392-6140
>>>>>> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Linear referencing in R

Fri, 09/28/2018 - 17:52
Hi, people! I hope I'll be not to speculative in my question and that you
can comprehend my problem.

Well, I have a railroad shapefile and I have two csv files corresponding to
the topography in each side of the railroad. The csv are organized in this
way:

ID_topo, from_km, to_km, height
1, 0, 1.91, 15
2, 1.91, 2.23, -3

I created a point shapefile for each meter of the railroad and then I
proceeded with a join (not spatial) between the from_km of the topography
data frame and the km mark (km_calc) from the point railroad.

My goal is to create shapefiles for each of the railroadside topography.
The issue is that when I try to make a new line shapefile from topography
based on the points of the railroad, what I get is a line that has doesn't
follow the curvature of the railroad. Using the example of the csv above,
what I get are several straight lines linked by the from_km to to_km. (Here
is a link to a print screen from QGIS:
https://www.dropbox.com/s/erfsst8pasoqj64/Captura%20de%20tela%202018-09-28%2019.49.47.png?dl=0
<http://Image>)

Maybe it is a little bit difficult to me to explain exactly the problem,
but any doubts, please ask. The files and the script I'm using are on the
following github: https://github.com/rdornas/raileco

Thank you very much indeed in advance!

*Rubem A. P. Dornas*
Celular: (31) 99642-5102
PPG Análise e Modelagem de Sistemas Ambientais
Instituto de Geociências - Universidade Federal de Minas Gerais
Currículo Lattes: http://lattes.cnpq.br/7197154832267712

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

spgm

Fri, 09/28/2018 - 17:28
Dear all,


I would like to ask if there is a possibility to apply something similiar to the "impacts" from spdep package for SAR regressions using the spgm function from the  splm package.


Best regards,


Martin Hul�nyi ?


[eco.jpg]       Pred vytla�en�m tohto mailu zv�te pros�m vplyv na �ivotn� prostredie. �akujeme.
Please consider the environment before printing this e-mail. Thanks

        [[alternative HTML version deleted]]


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Question about HSAR package

Thu, 09/27/2018 - 15:08
Ok, it's helpful to know that I need to zoom in on those three things.

I created the Random Effects Matrix by hand in Excel, so I read that into R
and put the matrix into the format recommended here:
https://cran.r-project.org/web/packages/HSAR/vignettes/hsar.html

Below, I show how I made W, M, and Delta.mat, before I try to estimate the
model. Hopefully this helps.


constit<- readShapeSpatial("Population
Weighted/Constituencies_2008/20170209_Constit")
constit.nb<- poly2nb(constit, row.names = constit$X20160526_5)
ghana.constit.weights.binary<- nb2listw(constit.nb, style="B", zero.policy
= TRUE)

W.constit<- listw2mat(ghana.constit.weights.binary)
W.constit <- W.constit / rowSums(W.constit)
W.constit <- as(W.constit,"dgCMatrix")


dist2008<- readShapeSpatial("Population Weighted/Districts_2008/Volta
Variable/20170226_Districts")
dist2008.nb<- poly2nb(dist2008, row.names = dist2008$DIST_2008)
ghana.dist2008.weights.binary<- nb2listw(dist2008.nb, style="B",
zero.policy=T)

W.dist<- listw2mat(ghana.dist2008.weights.binary)
W.dist <- W.dist / rowSums(W.dist)
W.dist <- as(W.dist,"dgCMatrix")


Delta<- read.csv("Random Effects Matrix_Ghana.csv",
                 header = T, row.names = 1)
Delta.mat<- as.matrix(Delta)
Delta.mat <- as(Delta.mat,"dgCMatrix")


> HSAR.model1<- hsar(Count_ ~ ndc_pres_3
+                    + volatility + turnout_21
+                    + volatili_1 + X20160526_6
+                    + DENSITY_RD + Count_3
+                    + MEAN + pov_p_2008
+                    + gini_2008 + ferat_2008
+                    + Count_4 + literacy
+                    + grid_perCa, data=constit, W=W.constit,
+                    M=W.dist, Delta = Delta.mat,
+                    burnin = 5000, Nsim = 10000,
+                    thinning = 1, parameters.start = NULL)
Error in hsar(Count_ ~ ndc_pres_3 + volatility + turnout_21 + volatili_1 +
:
  not an S4 object







On Thu, Sep 27, 2018 at 3:57 PM Roger Bivand <[hidden email]> wrote:

> This code tells nothing, the problem is in your construction of W, M
> and/or Delta. Pleaseng show this code too, best as a reproducible example.
> Tip: sometimes running traceback() after an error shows where it happens.
>
> Roger Bivand
> Norwegian School of Economics
> Bergen, Norway
>
> Fra: Justin Schon
> Sendt: torsdag 27. september, 21.36
> Emne: [R-sig-Geo] Question about HSAR package
> Til: [hidden email]
>
>
> Dear all, I am receiving the error "not an S4 object" when I attempt to
> estimate the hierarchal spatial auto-regressive model from the HSAR
> package. I have attempted several ways of creating the lower level matrix
> and higher level matrix. Rather than asking if members of this list can
> help with the code, I am first wondering if anyone can explain why this
> error would appear. I am including the code that estimates the model, as
> well as the error, below: > HSAR.model1
>

--
Justin Schon
Post-Doctoral Researcher on Environmental Change and Migration
MURI Migration Research Team: http://murimigration.org/
University of Florida
Fellow, Initiative for Sustainable Energy Policy (ISEP)

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Question about HSAR package

Thu, 09/27/2018 - 14:57
This code tells nothing, the problem is in your construction of W, M and/or Delta. Pleaseng show this code too, best as a reproducible example. Tip: sometimes running traceback() after an error shows where it happens.

Roger Bivand
Norwegian School of Economics
Bergen, Norway

Fra: Justin Schon
Sendt: torsdag 27. september, 21.36
Emne: [R-sig-Geo] Question about HSAR package
Til: [hidden email]


Dear all, I am receiving the error "not an S4 object" when I attempt to estimate the hierarchal spatial auto-regressive model from the HSAR package. I have attempted several ways of creating the lower level matrix and higher level matrix. Rather than asking if members of this list can help with the code, I am first wondering if anyone can explain why this error would appear. I am including the code that estimates the model, as well as the error, below: > HSAR.model1

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Question about HSAR package

Thu, 09/27/2018 - 14:35
Dear all,

I am receiving the error "not an S4 object" when I attempt to estimate the
hierarchal spatial auto-regressive model from the HSAR package. I have
attempted several ways of creating the lower level matrix and higher level
matrix. Rather than asking if members of this list can help with the code,
I am first wondering if anyone can explain why this error would appear.

I am including the code that estimates the model, as well as the error,
below:

> HSAR.model1<- hsar(Count_ ~ ndc_pres_3
+                    + volatility + turnout_21
+                    + volatili_1 + X20160526_6
+                    + DENSITY_RD + Count_3
+                    + MEAN + pov_p_2008
+                    + gini_2008 + ferat_2008
+                    + Count_4 + literacy
+                    + grid_perCa, data=constit, W=W.constit,
+                    M=W.dist, Delta = Delta.mat,
+                    burnin = 5000, Nsim = 10000,
+                    thinning = 1, parameters.start = NULL)
Error in hsar(Count_ ~ ndc_pres_3 + volatility + turnout_21 + volatili_1 +
:
  not an S4 object


Again, I am not looking for advice with the code right now. I am wondering
what kinds of problems could cause this error message.

As a note, I receive the same error message when I try to estimate an sar
model and when I simplify the model down to one independent variable.

I greatly appreciate any ideas that members of this list might have.

Thank you,

Justin





--
Justin Schon
Post-Doctoral Researcher on Environmental Change and Migration
MURI Migration Research Team: http://murimigration.org/
University of Florida
Fellow, Initiative for Sustainable Energy Policy (ISEP)

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Subsample (and or aggregation) of spatio temporal data (by using spatio temporal grid)

Thu, 09/27/2018 - 13:09
Hi,
I would like to know of it exists some function or method to subsumple (by
which I mean define a spatio temporal or a general 3D grid and substitute
all data which fall in one grid cell (in this case one grid cube, with
defined dimensions), with a reference data from the ones which fall in the
cube itself or with their mean,...)
Is it be possible to do such process?
If yes, it could be useful use a spatio temporal or a general 3D grid or
also other methods can be used?

Kind regards.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Create Kernel image results in *tif format

Thu, 09/27/2018 - 07:22
Thank you very much Florian,

Solve my problem!!

Best wishes,

Alexandre

--
======================================================================
Alexandre dos Santos
Proteção Florestal
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial
Cáceres - MT                      CEP: 78.200-000
Fone: (+55) 65 99686-6970 (VIVO) (+55) 65 3221-2674 (FIXO)

         [hidden email]
Lattes: http://lattes.cnpq.br/1360403201088680
OrcID: orcid.org/0000-0001-8232-6722
Researchgate: www.researchgate.net/profile/Alexandre_Santos10
LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635
Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/
======================================================================

Em 27/09/2018 04:01, Florian Betz escreveu:
> Dear Alexandre,
>
> instead of converting the image to a SpatialPixelDataFrame converting
> to a raster object might be an alternative.
>
> r_pines<-raster(d_pines)
> writeRaster(r_pines, "Pines.tif")
>
> Regards,
> Florian
>
> Am 26.09.2018 um 22:25 schrieb ASANTOS via R-sig-Geo:
>> Dear R-sig-geo Members,
>>
>>       I've like to create Kernel image results as *tif using an
>> object of
>> density() function output in spatstat package. But in my example,
>> doesn't work when I try:
>>
>> #Packages
>> library(spatstat)
>> library(raster)
>> library(rgdal)
>>
>>
>> #Swedishpines's data set in spatstat package
>> data(swedishpines)
>> plot(swedishpines)
>>
>> #CSR with K-Ripley test
>> csr_pines <- envelope(swedishpines, Kest, nsim=99)
>> plot(csr_pines)
>> # r=0.75 is outside CSR
>>
>> #Kernel representation using 0.75 as bandwidth
>> d_pines<-density(swedishpines, bw=0.75)
>> plot(d_pines)
>>
>> #Create TIFF image
>> r_pines <- as(d_pines, "SpatialPixelsDataFrame")
>> writeGDAL(r_pines, "Pines.tif")
>> #
>>
>>> r_pines <- as(d_pines, "SpatialPixelsDataFrame") Error in as(d_pines,
>> "SpatialPixelsDataFrame") : no method or default for coercing “im” to
>> “SpatialPixelsDataFrame”
>>
>> Please any ideas for corrected this?
>>
>> Thanks in advanced,
>>
>> Alexandre
>>
>
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Create Kernel image results in *tif format

Thu, 09/27/2018 - 03:51
Dear Alexandre,

Indeed the solution by Florian below is very nice. If you really want to
go the other direction you can use `as.SpatialGridDataFrame.im()` from
the `maptools` package.

By the way, based on what you write, I think you mean to use the value
7.5 (=0.75m) rather than 0.75 (=0.075 m) for your kernel bandwidth.
Furthermore, the argument to set the standard deviation of the
(isotropic Gaussian) smoothing kernel in `density.ppp()` is `sigma`, so
you probably want:
     d_pines <- density(swedishpines, sigma = 7.5)

If you like to work in meters rather than decimeters you can rescale the
point pattern:
     pines <- rescale(swedishpines, s = 10, unitname = "m")
     d_pines <- density(pines, sigma = 0.75)

Regards,
Ege


On 09/27/2018 10:01 AM, Florian Betz wrote:
> Dear Alexandre,
>
> instead of converting the image to a SpatialPixelDataFrame converting to
> a raster object might be an alternative.
>
> r_pines<-raster(d_pines)
> writeRaster(r_pines, "Pines.tif")
>
> Regards,
> Florian
>
> Am 26.09.2018 um 22:25 schrieb ASANTOS via R-sig-Geo:
>> Dear R-sig-geo Members,
>>
>>       I've like to create Kernel image results as *tif using an object of
>> density() function output in spatstat package. But in my example,
>> doesn't work when I try:
>>
>> #Packages
>> library(spatstat)
>> library(raster)
>> library(rgdal)
>>
>>
>> #Swedishpines's data set in spatstat package
>> data(swedishpines)
>> plot(swedishpines)
>>
>> #CSR with K-Ripley test
>> csr_pines <- envelope(swedishpines, Kest, nsim=99)
>> plot(csr_pines)
>> # r=0.75 is outside CSR
>>
>> #Kernel representation using 0.75 as bandwidth
>> d_pines<-density(swedishpines, bw=0.75)
>> plot(d_pines)
>>
>> #Create TIFF image
>> r_pines <- as(d_pines, "SpatialPixelsDataFrame")
>> writeGDAL(r_pines, "Pines.tif")
>> #
>>
>>> r_pines <- as(d_pines, "SpatialPixelsDataFrame") Error in as(d_pines,
>> "SpatialPixelsDataFrame") : no method or default for coercing “im” to
>> “SpatialPixelsDataFrame”
>>
>> Please any ideas for corrected this?
>>
>> Thanks in advanced,
>>
>> Alexandre
>>
>
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Create Kernel image results in *tif format

Thu, 09/27/2018 - 03:01
Dear Alexandre,

instead of converting the image to a SpatialPixelDataFrame converting to
a raster object might be an alternative.

r_pines<-raster(d_pines)
writeRaster(r_pines, "Pines.tif")

Regards,
Florian

Am 26.09.2018 um 22:25 schrieb ASANTOS via R-sig-Geo:
> Dear R-sig-geo Members,
>
>       I've like to create Kernel image results as *tif using an object of
> density() function output in spatstat package. But in my example,
> doesn't work when I try:
>
> #Packages
> library(spatstat)
> library(raster)
> library(rgdal)
>
>
> #Swedishpines's data set in spatstat package
> data(swedishpines)
> plot(swedishpines)
>
> #CSR with K-Ripley test
> csr_pines <- envelope(swedishpines, Kest, nsim=99)
> plot(csr_pines)
> # r=0.75 is outside CSR
>
> #Kernel representation using 0.75 as bandwidth
> d_pines<-density(swedishpines, bw=0.75)
> plot(d_pines)
>
> #Create TIFF image
> r_pines <- as(d_pines, "SpatialPixelsDataFrame")
> writeGDAL(r_pines, "Pines.tif")
> #
>
>> r_pines <- as(d_pines, "SpatialPixelsDataFrame") Error in as(d_pines,
> "SpatialPixelsDataFrame") : no method or default for coercing “im” to
> “SpatialPixelsDataFrame”
>
> Please any ideas for corrected this?
>
> Thanks in advanced,
>
> Alexandre
>
--
Florian Betz
Gartenstraße 13
86152 Augsburg, Deutschland

Tel.: 0176 20344096
Mail: [hidden email]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Create Kernel image results in *tif format

Wed, 09/26/2018 - 15:25
Dear R-sig-geo Members,

     I've like to create Kernel image results as *tif using an object of
density() function output in spatstat package. But in my example,
doesn't work when I try:

#Packages
library(spatstat)
library(raster)
library(rgdal)


#Swedishpines's data set in spatstat package
data(swedishpines)
plot(swedishpines)

#CSR with K-Ripley test
csr_pines <- envelope(swedishpines, Kest, nsim=99)
plot(csr_pines)
# r=0.75 is outside CSR

#Kernel representation using 0.75 as bandwidth
d_pines<-density(swedishpines, bw=0.75)
plot(d_pines)

#Create TIFF image
r_pines <- as(d_pines, "SpatialPixelsDataFrame")
writeGDAL(r_pines, "Pines.tif")
#

> r_pines <- as(d_pines, "SpatialPixelsDataFrame") Error in as(d_pines,
"SpatialPixelsDataFrame") : no method or default for coercing “im” to
“SpatialPixelsDataFrame”

Please any ideas for corrected this?

Thanks in advanced,

Alexandre

--
======================================================================
Alexandre dos Santos
Proteção Florestal
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial
Cáceres - MT                      CEP: 78.200-000
Fone: (+55) 65 99686-6970 (VIVO) (+55) 65 3221-2674 (FIXO)

         [hidden email]
Lattes: http://lattes.cnpq.br/1360403201088680
OrcID: orcid.org/0000-0001-8232-6722
Researchgate: www.researchgate.net/profile/Alexandre_Santos10
LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635
Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/
======================================================================


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: SPDE book for Bayesian spatio-temporal modeling

Wed, 09/26/2018 - 11:39
On Wed, 26 Sep 2018, Virgilio Gomez Rubio wrote:

> I am happy to announce the forthcoming book “Advanced Spatial Modeling
> with Stochastic Partial Differential Equations Using R and INLA”. We have
> a web page at  http://www.r-inla.org/spde-book with more information, R
> code and datasets, and a online (free) Gitbook version. We hope that this
> will be a useful resource to those of you interested in Bayesian spatial
> and spatio-temporal modeling. We’d like to thank CRC for agreeing to have
> a free version of the book on-line.

Virgilio,

   Looks interesting. Perhaps I can afford the dead tree edition when it
comes out. :-)

Best regards,

Rich

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

SPDE book for Bayesian spatio-temporal modeling

Wed, 09/26/2018 - 11:30
Dear all,

I am happy to announce the forthcoming book “Advanced Spatial Modeling with Stochastic Partial Differential Equations Using R and INLA”. We have a web page at  http://www.r-inla.org/spde-book with more information, R code and datasets, and a online (free) Gitbook version. We hope that this will be a useful resource to those of you interested in Bayesian spatial and spatio-temporal modeling. We’d like to thank CRC for agreeing to have a free version of the book on-line.

Best,

Virgilio

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: spatial temporal data

Wed, 09/26/2018 - 01:35
Hi!

I’m testing out a faster Kriging function that I developed.

Location doesn’t matter.  I need it to be “regular”, in the sense of having
n locations with m observations and a total size of n*m.

Thanks,
Erin

On Tue, Sep 25, 2018 at 11:26 PM Thomas Adams <[hidden email]> wrote:

> Hi Erin,
>
> Are you interested in point or gridded data and does location or variable
> type matter? What are you doing?
>
> Tom
>
> On Tue, Sep 25, 2018 at 11:03 PM Erin Hodgess <[hidden email]>
> wrote:
>
>> Hello everyone:
>>
>> Could someone recommend a good source for spatial temporal data from the
>> "real world", please?
>>
>> I have been using the Irish wind data for something that I'm working on,
>> and would like to have a nice data set for extra practice.
>>
>> Thanks,
>> Erin
>>
>>
>> Erin Hodgess, PhD
>> mailto: [hidden email]
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
>
> -- Erin Hodgess, PhD
mailto: [hidden email]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: spatial temporal data

Wed, 09/26/2018 - 00:25
Hi Erin,

Are you interested in point or gridded data and does location or variable
type matter? What are you doing?

Tom

On Tue, Sep 25, 2018 at 11:03 PM Erin Hodgess <[hidden email]>
wrote:

> Hello everyone:
>
> Could someone recommend a good source for spatial temporal data from the
> "real world", please?
>
> I have been using the Irish wind data for something that I'm working on,
> and would like to have a nice data set for extra practice.
>
> Thanks,
> Erin
>
>
> Erin Hodgess, PhD
> mailto: [hidden email]
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

spatial temporal data

Tue, 09/25/2018 - 22:02
Hello everyone:

Could someone recommend a good source for spatial temporal data from the
"real world", please?

I have been using the Irish wind data for something that I'm working on,
and would like to have a nice data set for extra practice.

Thanks,
Erin


Erin Hodgess, PhD
mailto: [hidden email]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Identify hotspots (centroid/geometric center when CSR distance is not satisfied) using K-Ripley approach

Tue, 09/25/2018 - 20:49
Dear R-sig-geo Members,

         I've like to identify hotspots points (centroid/geometric
center of distances(r) when CSR is not satisfied), in my study case,
centroids with points around 0.75 radius. This thinking in the map
representation, for this objective I make:

#Package
library(spatstat)
library(sp)
library(cluster)
library(lattice)

#Swedishpines's data set in spatstat package
data(swedishpines)
plot(swedishpines)

#CSR with K-Ripley test
csr_pines <- envelope(swedishpines, Kest, nsim=99)
plot(csr_pines)
# r=0.75 is outside CSR assumption, than:

##Create matrix distance of all points
coords<-cbind(swedishpines$x,swedishpines$y)
res<-spDists(coords)
res <- data.frame(res)

# Cluster 0.75m distances
clusters <- as.hclust(agnes(res, diss = T))
coords$group <- cutree(clusters, h=0.75) ## Radius 0.75
#

#Visualization of centroids with points around 0.75 radius
xyplot(x~y, group = group, data = coords)
points(swedishpines$x,swedishpines$y, pch=16)
#

Doesn't work, please any ideas or new approaches?

Thanks in advanced,

Alexandre

--
======================================================================
Alexandre dos Santos
Proteção Florestal
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial
Cáceres - MT                      CEP: 78.200-000
Fone: (+55) 65 99686-6970 (VIVO) (+55) 65 3221-2674 (FIXO)

         [hidden email]
Lattes: http://lattes.cnpq.br/1360403201088680
OrcID: orcid.org/0000-0001-8232-6722
Researchgate: www.researchgate.net/profile/Alexandre_Santos10
LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635
Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Pages