captaingriz Posted January 24, 2017 Share Posted January 24, 2017 #Package FLightR version 0.4.6 I have been using FlightR to analyze geolocator data for Grasshopper Sparrows, and I have been really pleased. I am wondering, however, if there is a way to export the kernel density results from the plot_util_distr command into ArcGIS. Exporting the median (w/ 95% CRI) lat/long values for use in ArcGIS (via "add XY data") is easy enough: write.csv(run.particle.filter.Results$Results$Quantiles,"GIS_import.csv") But what about exporting the utilization distributions to ArcGIS for replotting and further manipulation? plot_util_distr(particle.filter.results, dates=data.frame(as.POSIXct('2015-12-01'), as.POSIXct('2016-02-01')), percentiles=c(0.5,0.9), save.options = list(filename="winter.pdf")) I've tried saving or converting the plot object to a SpatialPolygonsDataFrame but I don't know of a way to coerce a 'list' into a SpatialPolygonsDataFrame. I suppose that I could draw the winter.pdf file with a blank background (then geo-reference the winter.pdf file) and bring that file into ArcGIS with the georeference toolbar. That would not be a parsimonious option for my 30+ birds and I still couldn't manipulate the results in ArcGIS (I could only view them). Thanks for your help and suggestions everyone, Jason Link to comment Share on other sites More sharing options...
Eldar Posted January 25, 2017 Share Posted January 25, 2017 Hi Jason, I have changed the function and it produces spatialpoygonsdataframe now. So update the package to github version and try library(rgdal) tmp<-plot_util_distr(Result) writeOGR(tmp$res_buffers, ".", "result", driver="ESRI Shapefile") Hope this helps, Cheers, Eldar Link to comment Share on other sites More sharing options...
captaingriz Posted January 25, 2017 Author Share Posted January 25, 2017 Outstanding! That makes my computational life so much easier. Thanks Eldar,Jason Link to comment Share on other sites More sharing options...
captaingriz Posted February 6, 2017 Author Share Posted February 6, 2017 I'm getting a new-to-me error message now with the plot_util_distr and map.FLightR.ggmap commands using the newly-updated version of FLightR: devtools::install_github('eldarrak/FLightR') plot_util_distr(Result) or map.FLightR.ggmap(Result) produce the same error Error in get("f", environment(CoordMap$train)) : object 'f' not found Tried installing newest version of ggplot and ggmap devtools::install_github("dkahle/ggmap",force=T) devtools::install_github("hadley/ggplot2",force=T) Tried installing development version of those packages using library(devtools) dev_mode(on=T) No difference. This appears to be a known issue with ggmap https://github.com/dkahle/ggmap/issues/144 Solution: reinstall version 2.6.1, don't know why this fixes it. library(versions) available.versions('ggmap') installed.versions('ggmap') install.versions('ggmap', '2.6.1') Link to comment Share on other sites More sharing options...
Eldar Posted February 6, 2017 Share Posted February 6, 2017 I cannot reproduce it. Will have a look if you send me the result object that causes the error. Eldar Link to comment Share on other sites More sharing options...
captaingriz Posted February 6, 2017 Author Share Posted February 6, 2017 Eldar, Definitely not a fault with FLightR but thank you very much for the offer of help. I think this is a Grid x ggmap x ggplot2 problem that I have worked around somehow. I have found that manually loading the grid graphics engine (library(grid)), before running the ggmap command, often makes these errors go away. I have no idea why. Problem solved for now. Link to comment Share on other sites More sharing options...
Eldar Posted February 6, 2017 Share Posted February 6, 2017 Good, I have submitted suggestion for correction of this issue to ggmap. Will see when they will reply. For now one should either type library('grid') before using ggmap related functions or install my ggmap version devtools::install_github('eldarrak/ggmap') Thanks for solving the issue. Link to comment Share on other sites More sharing options...
Hendrik Posted February 20, 2017 Share Posted February 20, 2017 Dear Eldar, I have a possibly related error message when running the plotting function: map.FLightR.ggmap(Result)Error: longitude of center must be between -180 and 180 degrees. note ggmap uses lon/lat, not lat/lon.In addition: Warning message:In min(Result$Results$Quantiles$Medianlon[twilights.index][Result$Results$Quantiles$Medianlon[twilights.index] > : no non-missing arguments to min; returning Inf Interestingly this only happens when using certain grid boundaries for the spatial extent. So far I could trigger the error as soon as I extended the right boundary above lon -160 e.g., Grid<-make.grid(left=160, bottom=-80, right=-140, top=-10, distance.from.land.allowed.to.use=c(-Inf, Inf), distance.from.land.allowed.to.stay=c(-Inf, Inf)) will trigger it while Grid<-make.grid(left=160, bottom=-80, right=-160, top=-10, distance.from.land.allowed.to.use=c(-Inf, Inf), distance.from.land.allowed.to.stay=c(-Inf, Inf)) does not produce an error. UPDATE: It actually seems only to occur when a position with longitude >-160 (e.g., -140) is plotted! My feel is that this is also a ggmap related issue. I don't think it is related as it is a sp error, but I get an error message when running plot_util_distr: plot_util_distr(Result,+ dates=data.frame(as.POSIXct('2016-03-03'), as.POSIXct('2016-08-07')),+ add.scale.bar=TRUE, percentiles=0.5)function will plot 308 twilightsError in sp::CRS(aeqd) : major axis or radius = 0 or not given I am very thankful about your comments on this. All the best and keep up the great work Eldar!, Hendrik Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.