Statistical computing language and software environment.

learn more… | top users | synonyms

2
votes
0answers
22 views

Extract the edge between two raster cells with different values

Is there a way in R to create lines (black lines in the figure below) along the edge between two raster cells that have different values ? Update I'm trying the functions clump() and ...
1
vote
0answers
7 views

map.axes control in R

I am learning how to use map functions in R. How can you control the axis labels in R when using map.axes ()? Right now the map displays only the degrees. I would like to have finer control so that ...
2
votes
1answer
27 views

Convert CSV file format to Breakline CSV format file [on hold]

I have a csv file with almost 36000 rows.The format of csv file is x,y,Polygon number, Z I would like to arrange this csv file in the below mentioned format. Let’s say in this example, Polygon ...
0
votes
0answers
27 views

Change raster projection in R

I'm trying to change raster projection using R and its raster library. The input raster projection is Lambert Azimuthal; this one and other params can be seen here: ...
2
votes
0answers
15 views

In QGIS 2.12 processing R scripts fails (plots remain blank) due to a wrong variable name - Is there a workaround?

I am trying to execute r scripts in 2.12. All of them fail. Plots remain blank. It seems that the variable "Layer[[Field]]" returns NULL: E.g: hist(Layer[[Field]],main=paste("Histogram ...
3
votes
1answer
19 views

Plotting netCDF4 data with the right projection

I guess this will sound simple to you but I just cannot get the right plot within R. I have a netcdf4 file and would like to visualize it within R just like I would do in QGIS and ArcGIS. sample data ...
1
vote
2answers
56 views

Rasterizing polygons with the function “gdal_rasterize” in R

I'm using the function gdal_rasterize in R (package gdalUtils) to convert a polygon shapefile into a raster. Here is my code: r.test <- gdal_rasterize(src_datasource="df.shp", ...
0
votes
0answers
19 views

Export image from PL/R on postgres

I'm trying to export an TIFF image from a PL/R Function in my PostgreSQL database. The output of the image appear be corrupted, because when I'll open the image, is showing the message: "Loading ...
1
vote
2answers
40 views

Reclassification of CORINE map using R

I am trying to reclassify the CORINE map for Hungary to 4 classes in R. but after reclassification, when I import the asc file to QGIS it loads it empty. Am I doing something wrong? ...
1
vote
1answer
17 views

Inverse Distance Weighted (IDW) Interpolation with Radial Basis Function (RBF) in R

I want to perform an IDW interpolation with R. I am aware that I can do that with gstat::idw. But I want to change the parameter 'idp' with a radial basis function (RBF): where is the ...
0
votes
1answer
34 views

R: count raster values using another raster as mask

I would like to count the frequency of values in one raster, using another raster (different resolution) as the zonal condition. The premise is that the coarser resolution raster represents the area ...
2
votes
1answer
50 views

Building predictive maps of response variables in R

I am a novice in spatial statistics in R. So, I am looking for some advises. In particular, I would like to create a predictive map of capture success from a generalized linear mixed-effects model ...
0
votes
0answers
32 views

Plotting Raster in R gives error

I know this is not much to go off of, but I can't seem to find the answer anywhere. I was plotting this raster image on Friday and it worked, and now when I try to plot it, I get this error. The image ...
0
votes
1answer
23 views

Tearing of SpatialLinesDataFrame and problem with gClip function

I am trying to use ggmap with geom_map and geom_path commands to add a SpatialPolygonsDataFrame of African countries and a SpatialLinesDataFrame over a raster. When I use the defined function gClip() ...
0
votes
0answers
21 views

Spatial index in R - Performance enhancement on geospatial processing [closed]

In my Geoinformatics studies, I often stumbled over the usage of spatial indices in spatial databases like here. However, I wondered if there is any possibility to use such indices in R in order to ...
1
vote
1answer
51 views

Creating spatial population heat map

I have some data that contains crab males population based on latitude and longitude. I am trying to plot the population distribution on map (not point density). For example I like to show which areas ...
0
votes
0answers
10 views

paste based in the number of elements in the row [migrated]

This is my dataframe s <- data.frame( x = c("a","b","c"), y = c("d","e", NA), z = c(NA,"j",NA) ) And I want to concatenate(paste) the values based a condition, I want to paste with comma ...
0
votes
1answer
40 views

Increase speed of reverse clip (erase) for large shapefiles in R

I would like to do a reverse clip (or erase in ArcMap) from shapefiles (polygons) then to merge the two shapefiles into a single shapefile. From this post How to 'reverse clip' (erase) in R, ...
0
votes
2answers
47 views

Failure of the code calling the function “rasterize” in R: NAs or no slots

I have some problems to convert a shapefile into a raster. I used the function rasterize (package raster) but all raster values are equal to NA. Following the answers to this question rasterize ...
1
vote
1answer
26 views

Correct Projection for calculating centroids of a group of points?

I have a long list of points covering all of North America for which I would like to calculate the centroid (by grouping points based on the "Name" column). My approach is to take the WGS84 ...
1
vote
1answer
39 views

Spearman correlation between two rasters in R

I have two rasters of the same area. The only difference is that they were created using two different methods. I would like to compare them and see how correlated they are pixel by pixel. Any ideas ...
1
vote
1answer
21 views

How to manually assign new names to attributes in a spatial data frame column with NA values

Data can be found here (Admin 1- States and Provinces, first download button): http://www.naturalearthdata.com/downloads/10m-cultural-vectors/ I have a shapefile of the world that I'll be pulling ...
0
votes
0answers
51 views

R raster() function failed to read tif file

I wrote a few lines to load data in TIFF to R. The function I used was: library(raster) test <- raster("file name.tif",package="raster") and it worked perfectly last week. However, now I am ...
2
votes
1answer
50 views

Tearing of polygons using ggmap and readOGR

I'm trying to incorporate a shape file of US states with ggmap and keep getting "tearing" of my polygons. I tried changing group=id to group=group which helped, but didn't seem to resolve the ...
2
votes
1answer
30 views

problem when doing algebra with raster layers in R

I'm trying to combine bioclim raster layers to create the following layer. (Q) = AnnPrec/[(Tmax+Tmin)*(Tmax-Tmin)]*1000 For that, I import a bioclim stack: envirc = ...
0
votes
1answer
37 views

How to create a continuous scale with distinct/custom color and value breaks with ggplot2 map

As stated in the title, I'm trying to create a continuous scale with distinct color and value breaks within the ggplot2 package in R. I'm using some dummy code to illustrate my problem: ...
2
votes
0answers
17 views

Adding a custom color scale for a sp.points layer to levelplot() legend

I'm wondering how I can add a customized color palette that I used to display a sp.points layer in a call to levelplot (lattice plotting) in the rasterVis package in R. I used a function that Dave X ...
2
votes
0answers
29 views

R: Setting pop-ups dependent on zoom level using leaflet

I have data that I would like to group differently, depending on the zoom scale in an interactive map made using leaflet. I have expenditure data and I would like to show expenditure by lake at ...
9
votes
2answers
368 views

Create area buffers that are limited by a coastline

I'm trying to use ArcGIS 10.2 to create a buffer of points based on a pre-defined area (e.g 400 sq km). Further to that, the buffers of some of the points are close to the coastline that requires the ...
1
vote
0answers
33 views

how to extract line features from a raster

I have a raster of land cover types where roads are represented by pixels (1 pixel = 25m x 25m = 625 m²). Is there a way to extract line features (here roads) from a raster ? ## Create raster as an ...
0
votes
0answers
29 views

Trying to run an ANOVA for fields in a dataframe [R] [migrated]

So far my code looks like this: Points = readOGR(dsn = "./Data/filename.shp",layer = "layername",stringsAsFactors = FALSE) Points$LDI = extract(LDI, Points) LDI = ...
1
vote
0answers
31 views

How to do a Kernel Density map from weighted point observations using a Cauchy kernel?

I need to produce a kernel density map, but instead of using a common kernel function such as Gaussian, I need to use the Cauchy kernel function. I have tried the Kernel Density tool in ArcGIS and ...
3
votes
1answer
79 views

Error while comparing two raster layer in R

I have got a geographic point distribution with N prehistoric settlements with a size of x and want to compare the distribution with an economic simulation, which produces M settlements (Usally N > ...
1
vote
0answers
40 views

Spplot SpatialPolygonDataFrame and SpatialGridDataFrame

I have to plot in the same graph something like this: Then, I have elements from SpatialPolygonDataFrame class and others elements from SpatialGridDataFrame class. When I try to plot them in the ...
2
votes
2answers
42 views

Use function spplot

Does anybody know how to plot with "spplot" fuction two elements of diferents classes?. One element from "SpatialPolygonDataFrame" class and other from "raster" class.
0
votes
1answer
27 views

R: raster stack (time series) loop pixelwise and write layer number of value occurence into a single output layer

I have a raster stack of gridded RFE 2.0 rainfall data (time series of one year = 365 layers). Now I wanted to identifiy on which date during the year the first rainfall occurs for each Pixel. The ...
1
vote
1answer
31 views

Error when trying to plot legend for geom_point with ggplot2

Here's some mock code to go along with my problem: #read in libraries library(ggmap) library(sp) library(raster) library(ggplot2) #read in country shapefile, project, fortify for mapping with ...
0
votes
3answers
35 views

How to add two dataframe columns of city and state names to form single city-state column for geocoding in R? [closed]

I tried to search for an answer to this, but I couldn't seem to find the right search terms, so I decided to spell it out quite explicitly. I have a data frame with separate columns for cities, ...
0
votes
2answers
71 views

How can I convert a large csv of irregular lat/lons to regular raster GRID?

I have a large csv containing ~5 million rows containing Lat, Lon, and Depth bathymetry values. I want to generate a raster GRID (for use in Arc) from this, but the trouble is the lat/lons are ...
2
votes
0answers
35 views

R Efficient Way to Resample, Crop, and Mask a Raster Image

Does anyone know an efficient way to resample an image? I am currently trying to crop a large image and clip 2 regions from a shape file. From this clipped image, I would like to increase the pixel ...
2
votes
1answer
45 views

gBuffer(rGEOS) causing R to crash

I have downloaded a US federal lands data layer (fedlanp010g.shp.tar.gz) from http://nationalmap.gov/small_scale/atlasftp.html?openChapters=chpbound#chpbound In R, I am trying to create a buffer ...
1
vote
0answers
31 views

Get distances between boundaries from an SpatialPolygon and raster pixels

I am trying to calculate the distance from several pixels of a raster to a boundary of some polygons in R as it is showed in the image. I have two problems: How to correctly define a boundary from ...
1
vote
2answers
38 views

R calculate raster cell size in map units

I have a RasterLayer and would like to know the cell size. I haven't find any function in the packages :-S . Does someone have an idea ? info about the RasterLayer class : RasterLayer ...
0
votes
1answer
27 views

Defining the correct AEA proj4string for FEWSnet Rainfall Data (Southern Africa) in R [closed]

I have some general questions about how to go about solving this problem: I am trying to incorporate FEWSnet's monthly Rainfall Estimate data from 2014-2015 for Southern Africa into an analysis where ...
2
votes
0answers
26 views

Keys for merging US state/county ANSI's with GADM Unique identifiers?

I've got county-level data from USDA NASS, and I want to merge it with gridded climate data. A preliminary step is the associate the counties with the coordinates of their centroids. If I merge by ...
1
vote
2answers
44 views

R: aggregate raster with 'mode' function - how does it work?

I want to aggregate a very fine resolution raster at various coarser resolutions (that represents many 1000s of categorical polygons). The aggregate{raster} function is what i've traditionally used, ...
0
votes
1answer
24 views

Masking low quality raster with polygons in R gives weird overhang?

I am pretty new to R, and have been attempting to use the mask function on a raster image of 250mx250m resolution. My problem is that for some reason I am getting overhang, as there are pixels which ...
1
vote
1answer
42 views

How to get latitude and longitude data from the borders of a state in R

Here is my problem: I need to get longitude and latitude data from the borders of the Brazilian states. With this data I can plot a map of each Brazilian state and, of course, of the whole country. I ...
7
votes
4answers
167 views

How to compute max and min coordinates for multiple polygons?

I would like to calculate the maximum, median and minimum latidudinal coordinates for a large set of polygons, using QGIS or R. So the highest and lowest points reached by each polygon across a ...
0
votes
1answer
41 views

Map with ggplot2 and bubbles

I've tried to plot a map of magnitude earthquakes in Colombia with ggplot. After many efforts, I got it. But, I need to focus in specially area where the data of magnitudes is (4, 4.1, 4.2, 4.3, ...