Questions tagged [rgdal]

R Bindings for the Geospatial Data Abstraction Library

Filter by
Sorted by
Tagged with
1
vote
0answers
12 views

Read Postgis geom available as string variable with R

I have a Postgis Database from which I query data. I know that I can use the rgdal::readOGR() function with the PG driver to get geoms from the database into R. However, I am also querying lots of ...
0
votes
1answer
30 views

How to get WMTS tile coordinates?

What can I do with the given information: I don't know where I am in the World having some particular tile. It's only an ocean (or sea). "https://services.arcgisonline.com/ArcGIS/rest/services/...
0
votes
1answer
34 views

Identify polygon grid in which the point belongs to?

I have a dataframe with 3 columns , which has my custom lat / long with a failure rate associated with each Lat / long head(df) Latitude Longitude Failure.rate 51.3 ...
1
vote
1answer
20 views

Trying to make calculation with gdal_calc.py?

I have a tif image that I'm trying to run gdal_calc.py. In the source file the values are between 1,118-9,704 and I want to divide all the values by 10,000 to get results between 0-1. This is the ...
0
votes
0answers
34 views

Convert DXF file to RasterLayer

I am an R user and have a .dwg file of city buildings that I wish to transform into a RasterLayer using the heights as elevation data. The metadata for the DXF file states: DXF File Metadata: ...
0
votes
0answers
34 views

GeoTools and PostGIS coordinate transformation gets different result [duplicate]

I've got a problem transforming coordinates. The result differs in PostGIS and GeoTools. I want to transform from EPSG:4326 to EPSG:3398. PostGIS: indicia=> select ST_AsText(ST_Transform(...
3
votes
1answer
57 views

gIntersection error: linearRing not created

I am trying to do something relatively simple but with large shapefiles. I have a shapefile of protected areas in the USA: and watershed boundaries: I want to calculate the percentage and ...
0
votes
1answer
30 views

Unable to plot in R some locations over a shapefile

I have a shapefile of polygons that I got from here, and a CSV file with longitude, latitude data (i.e. lon= -71.4; lat=42.5). The shapefile has the following CRS information: "+proj=lcc +lat_1=41....
1
vote
1answer
46 views

How to access GDAL utilities from command line using Rgdal installation? [closed]

I have just installed rgdal from within R install.packages("rgdal"). I can now successfully do library(rgdal) with the following message: Loading required package: sp rgdal: version: 1.3-9, (SVN ...
3
votes
1answer
224 views

Reading shapefile in R with shapefile function?

I want to read a shapefile(polyline) into R, using rgdal and raster packages. The code looks like: d<-file("/Volumes/Environment_layers/original/WaterRoad/Road.shp") o<-shapefile(d) but I got ...
1
vote
0answers
43 views

Warning message in raster::rotate(): “this does not look like an appropriate object for this function”

I'm attempting to rotate a stacked raster using the raster package in R. The raw stacked raster looks like this: When I attempt to rotate the raster to change the longitudinal scale from 0-360 to -...
0
votes
0answers
513 views

Get Google Maps driving directions between points in a KML file?

I'm trying to improve a workflow that currently involves manually composing a multi-destination driving route in Google Maps. I have the ability to export a KML file containing the points we want via ...
1
vote
0answers
21 views

Resolving topology errors after merging polygons

I have two SpatialPolygonDataFrames, and I have two merge them. SPDF1 contains watershed are falling within the country, SPDF2 has watershed are falling outside the country, so the both should match ...
0
votes
0answers
236 views

Extract raster cell values by polygon field

I have a raster as a RasterLayer (raster) and a polygon layer (bound) with 38 individual polygons as a SpatialPolygonsDataFrame. I used the polygon to mask from a larger raster. Each polygon contains ...
1
vote
0answers
103 views

Possible to drop NA geomType in readOGR?

I have a gdb file which is giving me trouble. f = '/path/to/folder.gdb' layers = ogrListLayers(f) geom_list = lapply(layers, readOGR, dsn = f) Gives an error on one of the layers: Source: "f", ...
0
votes
1answer
94 views

batch merge error: Error in match.arg(method) : 'arg' must be of length 1

I am attempting to read in a series of polygon shapefiles from a directory and batch merge them into a single shapefile. They all have the exact same field names. I am using this code: all_data <-...
2
votes
1answer
106 views

Binding multiple polygons in R

I have a directory that contains around 700 .shp files. I want to create a map in R that displays all of them. The easiest way i could think to do this was to bind them all together and then use ...
0
votes
2answers
222 views

Extracting non-spatial data from imported KML file using R?

I have a KML file which was created using Google's My Maps. The original file can be downloaded here: Google My Maps Using R, I can import this using the "readOGR" function of the rgdal library ...
1
vote
1answer
94 views

Parallel rasterizing with GetCover option? [closed]

I'm trying to rasterize a shapefile in parallel using the solution from this post: Processing vector to raster faster with R However, this fails to give the correct answer when the GetCover = T in ...
0
votes
1answer
39 views

manipulate ASCII grid

I have an ASCII grid (Data information in this box link https://app.box.com/s/jpdalfjnyfhqbvrghd8csu3pz5b2fl2j) with the following projection information Projection POLAR Units METERS ...
2
votes
0answers
63 views

Points and bioclim layers plot correctly in R, but not in Maxent.jar

I am trying to use Maxent.jar. This program uses a CSV file of points and ascii bioclim layers (basically, a map of the Americas with climate data) and overlays them on top of one another. I find ...
0
votes
1answer
84 views

Pattern matching with grepl on SpatialPolygonsDataFrame object in R

I am trying to use grepl as part of an if control statement in R. I want to subset a SpatialPolygonsDataFrame object in my list (i.e. googleProjectedGroundTruth or googleProjectedFallow) only if its ...
0
votes
2answers
551 views

Convert shapefile into lat long points and export it as CSV in R?

I have a shapefile that I extracted form a compilation of species distributions taken from IUCN. > foo Simple feature collection with 1 feature and 27 fields geometry type: MULTIPOLYGON dimension:...
0
votes
1answer
363 views

ReadOGR/read_sf: Can't open shapefile

I am trying to open a shapefile (or the directory of the shapefile) in the same directory as my R file. I open it the following way: x<-c(farm,field,"ec",2017) #farm and field are variables that ...
0
votes
1answer
96 views

writeOGR KML attributes blank [closed]

Using the below I output a KML file from a Large SpatialPolygonsDataFrame polygonWGS <- spTransform(Polygon, CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")) writeOGR(polygonWGS, dsn="...
0
votes
1answer
211 views

geom_line() does not plot points from a shapefile in its correct order

I have been trying to load and plot a few shapefile in R using ggplot() and am facing an issue with a line vector shapefile. It seems that the readOGR() command is importing the line vectors ordering ...
0
votes
1answer
164 views

Conditional plotting a geopackage

I have a geopackage for India taken from GADM. I can plot all the districts of India by using layer 1, all states using layer 3, and the whole country using layer 4. Here is the code: > library(...
2
votes
1answer
554 views

Accessing certain column of attribute table of shapefile and renaming it using GeoPandas?

Currently, I am working on converting some R code into python for someone. This person is taking the shapefile and removing all columns except for a select few and renaming them: ec <- readOGR(".",...
0
votes
2answers
151 views

Error with Intersecting Rasters and Lines in R

I'm trying to ''cut'' a spatial lines data frame object by a raster grid using R, raster::intersect(SLDF, grid) However, when I run this code I get, Error in as.vector(x) : no method for coercing ...
0
votes
1answer
70 views

spTransform produces unexpected results

I am struggling to plot points using WGS84 co-ordinates on a map of the UK using the OSGB 1936 / British National Grid CRS. I'm using the rgdal package in R. Here is my reproducible example, using ...
0
votes
1answer
493 views

Use lapply and writeOGR to write multiple shapefiles within a list

I have a nested list with multiple shapefiles and I want to use lapply with writeOGR ('rgdal') in order to export all the shapefiles. Sorry for not giving a reproducible example. # My list shp....
0
votes
2answers
2k views

R cannot read *.shp shapefile with rgdal

I'm trying to open ne_10m_urban_areas.shp with rgdal::readOGR, but it gives me the bellow error library(rgdal) a <- readOGR(dsn = path.expand("C:/.../Desktop/"), layer = "ne_10m_urban_areas.shp") ...
2
votes
1answer
601 views

Any way to extract NUTS-3 shapefile of Germany from Eurostat' shapefile in R (updated)?

I have downloaded shapefile from Eurostat website (download site for downloading Eurostat shapefile and direct download link of Eurostat shapefile that I am interested in). To be short, I need ...
0
votes
1answer
71 views

R does not load coordinate reference when importing a multiband tif raster from Triplesat satellite

I'm trying to read Triplesat imagery into R. However there seems to be a problem with the coordinate reference in the .tif file as the crs, extent and resolution are not loaded. I tried two ways of ...
1
vote
0answers
561 views

rgdal::readOGR - no features found [closed]

Working in R Studio I'm executing the lines: setwd("D:/Perfil_IBGE/4. IBGE") pasta = "1. Shapefiles Brasil" shapefile_brasil = "BRUFE250GC_SIR" shp <- rgdal::readOGR(dsn = pasta, layer = ...
0
votes
1answer
291 views

Fix export to include character strings with accents (French text) in shapefile when using writeOGR in R

I have a SpatialPolygonsDataFrame in R that I want to export to shapefile. I used writeOGR to export but the cells with that contain text values with accents (é, è, à, ê, etc) are blank. When I ...
0
votes
0answers
209 views

Rgdal: writeOGR to SQLServer

I am trying to write geodata to a Microsoft SQLServer 2017 using rgdal. dsn = 'MSSQL:server=XXX;database=XXX;trusted_connection=yes' data=data.frame(lat=c(52.52437), lon=c(13.41053), value=c("v")) ...
1
vote
2answers
822 views

Creating polygon grid from SpatialPoints in R?

I read several similar question but I yet have open questions. I am fairly new to GIS and I think that another question on this topic will help others as well. I hope we can find a nice answer, that ...
6
votes
1answer
3k views

Unable to install ‘sf’ R package on Ubuntu 16.04 LTS

I'm not able to install sf R package on Ubuntu 16.04 LTS. I tried install.packages("sf") as well as devtools::install_github("r-spatial/sf") after running sudo add-apt-repository ppa:ubuntugis/...
2
votes
1answer
649 views

Raster IO error (R)

I have a raster I'm trying to extract, the projections of my shapefile and raster are the same: ext <- raster::extract(ras.tiftest2, single, na.rm=TRUE, fun=sum) I get this error: Error in rgdal:...
1
vote
2answers
636 views

Converting a shapefile from easting/northing to lat/long

I am working with an open data shapefile that uses easting/northing coordinates. My geocoded data set uses lat/long, so I am trying to reproject/transform the shapefile to use lat/long. ```{r} ...
6
votes
1answer
495 views

How to read a feature class in an Esri Personal GeoDatabase using R?

I have feature classes in a personal geodatabase on a Win 8.1 machine (r 3.4.2, rgdal 1.2-15) and, as mentioned here, there is a requirement for Access users to also interact with them. I have ...
0
votes
1answer
484 views

readOGR feature mismatch with KML

I'm trying to read a kml from this kmz I unzipped however, when I try to read a layer from it (as I've done it with previous kmzs) it says: library(rgdal) unzip("EstacionesClimatologicas.kmz") ogr &...
0
votes
1answer
231 views

Identify countries within a bounding box using R

Using R and relevant GIS packages, I would like to determine which countries are within an arbitrary bounding box and extract the corresponding ISO codes. For example... require(maps) require(rgdal) ...
1
vote
1answer
88 views

Kernel Density Map points rejected as outside window

I am trying to make a kernel density plot of a points shapefile like so: library(rgdal) library(spatstat) library(maptools) points <- readOGR(dsn = "C:\\Documents", layer = "...
3
votes
2answers
4k views

How to plot gridded map from lat-lon and fill values in R?

I want to plot a spatial map in which each pixel is of 0.25 degree spatial resolution in R. For this I have fill values at 0.25 degree grid spacing. Below is the data ----------------------- ...
1
vote
1answer
415 views

Using R, why am I unable to select a column from an sp Spatial Lines Dataframe?

With utm_RDS being the spatial lines in question, derived from the following shapefile: library(rgdal) library(sp) RDSYS <- readOGR(dsn = "C:/************") utm_RDS <- ...
1
vote
2answers
1k views

Extract mean for values in a raster above certain threshold in R

How to extract mean from a raster using extract function in R while considering raster cell values above 0? I have multiple rasters with some negative cell values and no-data. I am able to ignore no ...
1
vote
0answers
631 views

readOGR: all features NULL

Getting an error when trying to load a shapefile via readOGR. readOGR works fine on my personal computer (mac) but I am running into issues on my work computer (windows). When loading a shapefile ...
1
vote
1answer
266 views

Write time stamp for .gpx in R

I am in the process of editing gpx files and need to write the files back to .gpx in order to put them in a GPS unit. Basically, I am cleaning up some data and removing some track points. However, ...