rgdal

Converting NAD83 state plane coordinates to WS84 standard lon/lat in degrees

一个人想着一个人 提交于 2019-12-06 04:10:21
I tried to use this instruction to convert a set of x-y coordinates in NAD83 State Plane Coordinates to regular Lan/Lat coordinates in degrees. I could reproduce for the example given in this post but it fails to give right answer to my set! Following is what I have tried and what I obtained [wrong answer]. library(rgdal) nad83_coords <- data.frame(x=c(577430), y=c(2323270)) # My coordinates in NAD83 coordinates(nad83_coords) <- c('x', 'y') proj4string(nad83_coords)=CRS("+init=esri:102272") # West Illinois coordinates_deg <- spTransform(nad83_coords,CRS("+init=epsg:3436")) # West Illinois > x

r gis: find borders between polygons

扶醉桌前 提交于 2019-12-06 04:03:16
Having a polygon shapefile, I need to produce a polyline shapefile containing only the common borders between polygons (see the picture). My question is similar to 1 and 2 , only I need to do this in R . The latter similar question refers to a solution with the use of Shapely package for python . The analogue of Shapely for R is rgeos . Though, I couldn't find the solution with rgeos on my own. Note: the shapefile with borders used for illustration was produced in ArcGIS using the solution from similar question 1. Now I need to do the same in R . What you want is the lines that are the

rgdal won't install on AWS RStudio AMI

做~自己de王妃 提交于 2019-12-05 22:10:19
I have managed to successfully launch the most recent RStudio AWS EC2 instance (louisaslett.com, RStudio-1.1383_R-3.4.2…ubuntu-16.04-LTS-64). R operates mostly as expected in this instance, and I can install and open a number of packages. However I get an error if I try to install either of the rgdal of gdalUtils packages. Below is the console output when I attempt to install rgdal. The output for the gdalUtils install is too long to include here, but both include the text "error: upgrade GDAL to 1.11.4 or later" which I suspect is the problem, but have no idea how to correct. Any thoughts or

R: Error thrown while using RGDAL and RASTER packages

谁说胖子不能爱 提交于 2019-12-05 22:08:33
To whom this may concern: Here is the source code: GRA_D1<- raster(files[[1]]) //Sets up an empty output raster: GRA_D1<- writeStart(GRA_D1,filename='GRA_D1.tif', format='GTiff', overwrite=TRUE) //Write to the raster, for loop: for(i in 1:dim(GRA_D1)[1]){ //Extract raster values at rows d.Frame<- matrix(NA,ncol=2,nrow=dim(GRA_D1)[2]) d.Frame[,1]<- getValues(r1[[1]],i) d.Frame[,2]<- getValues(r1[[2]],i) w.Frame<- as.data.frame(d.Frame) names(w.Frame)<- c("D1_pred_disAg","D1_pred_RK") //Apply the predictive model: m.pred<-predict(mod.1, w.Frame) //Write the predictions to the empty TIFF raster

Select only one state in a map in a Shiny application

雨燕双飞 提交于 2019-12-05 18:37:42
I have the following dataset: library(rgdal) library(leaflet) tmp <- tempdir() url <- "http://personal.tcu.edu/kylewalker/data/mexico.zip" file <- basename(url) download.file(url, file) unzip(file, exdir = tmp) mexico <- readOGR(dsn = tmp, layer = "mexico", encoding = "UTF-8") pal <- colorQuantile("YlGn", NULL, n = 5) state_popup <- paste0("<strong>Estado: </strong>", mexico$name, "<br><strong>PIB per c?pita, miles de pesos, 2008: </strong>", mexico$gdp08) On top of this data I build the following Shiny Application: # load necessary packages library(leaflet) library(shiny) library

Read shape file with readOGR verses readShapePoly

匆匆过客 提交于 2019-12-05 14:46:19
问题 I have read a shapefile using readShapePoly in the maptools package, but cannot read that same file with readOGR . I am hoping someone may be able to help me read the shapefile with readOGR . I downloaded the file orcounty.shp from here: http://geography.uoregon.edu/geogr/topics/maps.htm I also downloaded the associated files: orcounty.shx , orcounty.sbx , orcounty.sbn , and orcounty.dbf and put all five files in the folder: c:/users/mark w miller/gis_in_R/shapefile_example/ The following

RGDAL won't install

余生长醉 提交于 2019-12-05 03:06:43
I can't get RGDAL to install in R. I'm using Ubuntu 12.04. configure: error: gdal-config not found or not executable. ERROR: configuration failed for package ‘rgdal’ * removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.2/rgdal’ Warning in install.packages : installation of package ‘rgdal’ had non-zero exit status I found some solutions which said to do this: sudo apt-get install aptitude sudo aptitude install libgdal-dev sudo aptitude install libproj-dev I follow these through, accepting 'yes' when prompted, but afterwards the same original error. It doesn't resolve it. I wonder whether I

Encoding of German umlauts when using readOGR

早过忘川 提交于 2019-12-05 01:34:18
I'm trying to read an OGR vector map using the readOGR function provided by the rgdal package, but I'm having a little trouble with the German umlauts. I've provided a little example of what the data looks like, umlauts like ö are replaced with \303\266 . map <-readOGR("/path/to/data.gdb", layer = "layer") map@data$name # [1] L\303\266rrach # [2] Karlsruhe # [3] B\303\266blingen # [4] ... I've tried to specify an encoding in the readOGR function ( readOGR(dsn = "/path/to/data.gdb", layer = "layer", encoding = "UTF-8" or readOGR(dsn = "/path/to/data.gdb", layer = "layer", encoding = "LATIN-1" )

Unable to install rgdal and rgeos R libraries on Red hat linux

 ̄綄美尐妖づ 提交于 2019-12-05 00:54:34
I have error while compiling rgdal adn rgoes package on our redhat linux machine. I tried to do some research but couldn't find a possible solution. Could you please help me with this as this is very important for me to solve. **ERROR WHILE COMPILING RGDAL in R 3.0** **strong text** * installing *source* package ârgdalâ ... ** package ârgdalâ successfully unpacked and MD5 sums checked configure: CC: gcc -std=gnu99 configure: CXX: g++ configure: rgdal: 0.8-10 checking for /usr/bin/svnversion... yes configure: svn revision: 496 configure: gdal-config: gdal-config checking gdal-config usability..

How to convert NAD 83 coordinates to latitude and longitude with rgdal package?

五迷三道 提交于 2019-12-04 04:59:34
I have coordinates, all of which should be located in DC, but I cannot figure out how to convert them from NAD 83 to latitude and longitude in R. I'm using the spTransform() function in the rgdal package and get an error about non-conformant data. library(rgdal) nad83_coords <- data.frame(x=c(396842.6, 397886.9, 398315.5, 398154.3, 398010.3), y=c(140887.1, 139847.0, 138743.9, 139534.5, 138697.3)) coordinates(nad83_coords) <- c('x', 'y') proj4string(nad83_coords) <- CRS("+init=epsg:4269") Error in `proj4string<-`(`*tmp*`, value = <S4 object of class "CRS">) : Geographical CRS given to non