Questions tagged [rgdal]

R Bindings for the Geospatial Data Abstraction Library

Filter by
Sorted by
Tagged with
0
votes
0answers
44 views

Plotting spatialpoints on a shapefile [closed]

I have a shapefile and some SpatialPoints. I was able to plot shapefile and SpatialPoints seperately, but the problem is the SpatialPoints plot themselves only relative to each other instead of ...
2
votes
2answers
44 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
41 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
29 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
182 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
26 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
54 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
55 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
64 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
83 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
36 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
82 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
31 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
75 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
389 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
55 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
925 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
25 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
292 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
161 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
110 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
127 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
318 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
119 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
40 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
74 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
99 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
759 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
430 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
123 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
249 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
190 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
683 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
183 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
102 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
624 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
732 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
80 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
620 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
416 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
229 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
926 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
4k 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
797 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
749 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
549 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
513 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
258 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
97 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 = "...