sp

rDGAL, Tiff Files, and WorldFile

元气小坏坏 提交于 2019-12-11 04:45:16
问题 I have a set of tiff files that display convective weather across the continental US (NAD83 projection) in pixel locations from Iowa State University. My goal is the transformation of the pixel locations to lat/lon data. I read in the tiff file data as a SpatialGridDataFrame with... imageData = readGDAL( fileNameDir, silent = TRUE ) I read somewhere that readGDAL will seek a World File if no projection data exist in the tiff file, so I created such a file (nad83WorldFile.wld) with the

Remove PNG plot margins

二次信任 提交于 2019-12-11 03:37:41
问题 I am trying to get rid of the top and bottom margins of a SpatialPolygons plot. I have tried setting the margins to c(0,0,0,0) but this only changes the left and right margins. When plotting in RStudio, the top and bottom margins are 0 but the left and right are not. library(sp) coords <- cbind(c(631145, 631757, 631928, 631664, 631579, 631281), c(6967640, 6967566, 6968027, 6967985, 6968141, 6968009)) poly <- Polygons(list(Polygon(coords)),"coords") poly.sp <- SpatialPolygons(list(poly)) par

R - SpatialPolygonsDataFrame from a list of SpatialPolygons

 ̄綄美尐妖づ 提交于 2019-12-11 02:08:22
问题 I´m looking for a way to create a SpatialPolygonsDataFrame from a list of SpatialPolygons? In the following there´s an example of a list of Polygons from which a SpatialPolygonsDataFrame, containing all Polygons of the list, should be created. EDIT: The SpatialPolygonsDataFrame must be created from the list of SpatialPolygons! As my original data doesn´t contains SpatialPolygons as separate values but the list of SpatialPolygons. The way I received this list is different form the one in the

line connecting label text and point in tmap plot

大兔子大兔子 提交于 2019-12-10 23:05:35
问题 i'm doing a tmap plot with a shape file, and i want to be plotting several points for which i have long-lat coordinates onto the shape file. i've got the plot working just fine, however there are too many points on the map, meaning that the label text for different points is overlapping, and is just not particularly legible in general. here's what the plot currently looks like. i would really like for the text in the plot to be outside of the actual map, and to be connected to the points in

R - nested loop for list of SpatialLinesDataFrame intersected with SpatialPolygonsDataFrame objects

馋奶兔 提交于 2019-12-10 22:39:53
问题 I have a series of steps I need to complete on a list of SpatialLinesDataFrame ('lines' herein) objects based on their relationships with individual features within a multi-feature SpatialPolygonsDataFrame ('polygons') object. In short, each line list element originates inside a single polygon feature, and may or may not pass through one or more other polygon features. I want to update each line element to connect origin polygons to the first point of contact for each individual polygon

How do I fix a color scale bar in several spplots?

梦想的初衷 提交于 2019-12-10 22:12:44
问题 I am doing a idw interpolation between several air quality stations. For the final visualization I want to collapse all the images I made into a GIF. Everything works, the only problem is that the scales of values change in every image, and the scale changes with the values (min - max). How do I set the scale of the colors to a fixed value? Here's some sample data: data(meuse.grid) coords <- SpatialPixels(SpatialPoints(meuse.grid[,c('x',"y")])) meuseg1 <- SpatialPixelsDataFrame(coords,meuse

“Globe”-shaped map of Russia

大兔子大兔子 提交于 2019-12-10 13:27:31
问题 I draw a map of regions of Russia using GADM data: setwd("~/Desktop/Master thesis/") library(sp) library(RColorBrewer) library(raster) data <- getData('GADM', country='RUS', level=1) #exclude columns I don't need data <- data[,-c(2,3,4,5,7,8,9,10,11,12,13)] data$region <- as.factor(iconv(as.character(data$NAME_1))) png(file = "~/Desktop/myplot2.png", width = 1300, height = 700, units = "px") spplot(data, "region", xlim=c(15,190), ylim=c(40,83), col.regions = colorRampPalette(brewer.pal(12,

readOGR (rgdal) fails to fetch polygon names from XML

戏子无情 提交于 2019-12-10 10:44:52
问题 I am trying to import an KML map of CCG boundaries in England (Available here, 200Kb) into R using readOGR function from package rgdal . My end-goal is to create a heat-map by colouring CCGs according to some associated value. I have a list with those values next to CCG names in one data frame. I need to match CCG names in that data frame with CCG names in the imported map object, and assign colours based on the value. However, I cannot see any CCG names imported in the map object, although

Custom placement of spplot legend in the map

孤街浪徒 提交于 2019-12-10 03:11:12
问题 Is it possible to place the spplot (spplot polygons) legend within the map, in lower left corner, like this? The closest I've been able to get is this (I am not posting my data, I just use the example data instead, so in this case, try to place the legend in top left part of the map): data(meuse.grid) gridded(meuse.grid)=~x+y spplot(meuse.grid[,'dist'], colorkey = list(space = "left", height = 0.5) ) But the legend is in the middle of the page and is outside of the map. Unfortunatelly,

How to join Spatial data with Dataframe so it can be displayed with Tmap?

∥☆過路亽.° 提交于 2019-12-08 11:46:30
问题 Short version: when executing the following command qtm(World, "amount") I get the following error message: Error in $<-.data.frame ( *tmp* , "SHAPE_AREAS", value = c(653989.801201595, : replacement has 177 rows, data has 175 Disclaimer: this is the same problem I used to have in this question, but if I'm not wrong, in that one the problem was that I had one variable on the left dataframe that matched to several variables on the right one, and hence, I needed to group variables on right