Questions tagged [rgdal]

R Bindings for the Geospatial Data Abstraction Library

Filter by
Sorted by
Tagged with
0
votes
1answer
26 views

Converting a CSV to a shapefile in R : “Creating Name field failed”

I was trying to convert a CSV to a shapefile (process that I've already managed to do several times with R without particular problem) but today I'm facing a troublesome issue I haven't been able to ...
1
vote
0answers
37 views

R can't work with ecw while gdal/qgis does. Ubuntu 20.04 config

I'm an Ubuntu 20.04 user with all configured to use .ecw raster format. I can read these files in QGIS (3.10) and work with them without a problem. This is what I get in console: $ gdalinfo --...
1
vote
0answers
34 views

Updating PROJ GEOS and GDAL in R

I have been having trouble linking to GEOS 3.8.1, GDAL 3.0.4, PROJ 6.3.0. I have tried reinstalling sf, rgdal, raster, and rgeos packages. I still couldn't link to GEOS 3.8.1, GDAL 3.0.4, PROJ 6.3.0. ...
0
votes
0answers
31 views

GDAL conflicts between GDAL and PostGIS versions in R

I'm trying to learn postgis and I'm using R as an interface to make queries under Linux. I'm using GEOS 3.8.0, GDAL 3.0.4 and PROJ 7.0.0. When everything is up-to-date my R ecosytem (sp, sf, rgdal) is ...
1
vote
1answer
75 views

Install latest GDAL on docker image of CentOS

I am trying to install gdal latest version on a docker image of CentOS. Below is the minimal code. # Start and connect . docker run --rm -it centos:latest bash yum -y upgrade yum -y install wget yum ...
0
votes
0answers
17 views

Get Nearest Grid Data Using Leaflet and R

I am trying to write a piece of code in R using the Leaflet, sf and rgdal libraries which will identify the closest grid cell to the user's click and retrieve the data associated with that grid cell. ...
0
votes
1answer
36 views

Erreur gdal_polygonize.py package ARfun with R

I'm a french student, in advance I'm sorry for my english. I'm installed the package APfun on R to transform Raster to Polygons with Appolygonize function. But I have a error : crownsPoly <- ...
0
votes
2answers
44 views

Using writeOGR on a list of SpatialPolygons

This question has been asked before, but I find the answer confusing since there are no reproducible examples that link the question and the answer, and the answer doesn't actually use the writeOGR ...
2
votes
1answer
44 views

R spatial: st_overlaps to subset also fully covered polygons?

I want to subset all polygons in fc1 completely or partially overlapping with fc2. But, the st_overlaps subsets only polygons that overlaps with the border of fc2, but skips the fully covered polygons....
0
votes
1answer
54 views

Mass conversion of .JP2 images to .TIF format in R

I need to convert a list of .jp2 files to .tif. I cannot do it manually since it is a large number of files. So I can't use: gdal_translate(path_vhr_imag_1, "splt1.tif") gdal_translate(...
7
votes
1answer
101 views

R spatial: Erase one polygon from another: correct use of `st_difference`?

I am trying to erase one shapefile from the other, similar to ArcGIS Erase tool: This worked pretty well with rgeos::gDifference(spdf1, spdf2), which needs as input geometry of ...
1
vote
1answer
23 views

Use geometry binary predicate list to subset simple feature object?

I am trying to create a new simple feature from two overlapping features. I want to subset all polygons that are fully or partially located within my buffer (red border). However, the st_overlaps ...
1
vote
1answer
26 views

Keep getting NAs when I run sp's over function on LatLon points on shapefile polygons

I am not sure why i am keep getting NA whenever I run the Over function with Latitude and Longitude point on the polygon from shapefile. Please note that this is first time for me doing the spatial ...
2
votes
1answer
30 views

Check if points overlap with polygon

I have data that maps lat lon of a storm for every day as follows (I have removed the day ID so it has only year and month) lat_lonDat <- structure(list(Latitude = c(9.1, 9.15755, 9.2, 9.21496, ...
7
votes
3answers
193 views

Find maximum extent out of list of shapefiles (in projected coordinate system) in R

I have a script where I crop a list of rasters by the extent of one of many shapefiles. So far all of by shapefiles have been such that I could manually select the one with the largest extent (i.e. ...
2
votes
2answers
101 views

Loading shapefiles for reprojection using sf

I'm trying to automate my workflow, but having trouble with one step. My data come as processed shapefiles saved in .RDA files; I load them to a PostGIS system, cleaning up little issues (spTransform()...
1
vote
0answers
90 views

Attributes encoding problem with rgdal::writeOGR

I performed an intersection of two SpatialPolygonsDataFrame on R (3.5.1) using raster::intersect. Here's the structure of the resulting SPDF attributes table > str(shp@data) 'data.frame': 944 ...
1
vote
1answer
226 views

Keep spatial lines intersecting spatial polygons using R?

I am trying to keep spatial Lines objects intersecting a spatial polygon in R. The intersect function from raster package is doing actually a crop. But what I need is to keep the lines intersecting a ...
0
votes
1answer
1k views

GDAL 2.4.2 from UbuntuGIS unstable broken because of missing libogdi.so.3.2? [closed]

After an unthoughtful apt-get update today, GDAL no longer works on my Ubuntu Machine (bionic) because libogdi.so.3.2 is missing: daniel@gin-nuest:~$ gdalinfo gdalinfo: error while loading shared ...
1
vote
1answer
43 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
255 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
365 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
149 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
232 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
44 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
214 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
34 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
165 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
1k 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
97 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
2k 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
36 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
444 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
386 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
312 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
179 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
643 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
188 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
41 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
93 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
232 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
2k 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
550 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 ...
1
vote
1answer
213 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
396 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
244 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
1k 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
299 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
188 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 ...
1
vote
1answer
922 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....