Questions tagged [r-maptools]

The R package maptools provides a set of tools for manipulating and reading geographic data, in particular ESRI shapefiles.

The R package maptools is a set of tools for manipulating and reading data, in particular s. The package also provides interface wrappers for packages such as PBSmapping, spatstat, maps, RArcInfo, tmap, , , and others.

Repositories

Vignettes

Other resources

Related tags

157 questions
1
vote
2 answers

How to limit boundaries when plotting a shapefile in R

I hope this isn't a basic question, I've had a hard time finding online resources for using R with shapefiles. I have a shapefile of the 5 digit zip codes in Texas, specifically the one at the bottom of this page. I'm loading the zip code data and…
user2859829
  • 125
  • 2
  • 8
1
vote
1 answer

R: plotting neighbouring countries using maptools

Say I am plotting countries on a world map using maptools, if I were to plot a country, is there a way of plotting the countries that border this country in a different colour? I am using the shapefile wrld_simpl that comes with maptools, so say I…
userk
  • 901
  • 5
  • 11
  • 19
1
vote
1 answer

Shapefiles in R

I'm relatively new to using Shapefiles in R. I want to create visualizations of country and district level data for India for which I'm using maptools in R. For the shapefiles, I got the data from gadm.org which includes state/district/subdistrict…
1
vote
1 answer

Plot point text labels over polygon w/o overlap

Using pointLabel in the maptools package in R will plot text labels for points to avoid overlap of text. But is there a way to avoid/minimize overlap of text labels with the outline of an underlying polygon created from a shape file? For example,…
Aaron
  • 132
  • 2
  • 3
  • 17
1
vote
0 answers

How can I calculate sunrise azimuth for multiple locations and dates in R?

I'm using bird banding (ringing for Europeans) records to study the relationship between sunrise azimuth and migration heading. I have the banding (ringing) locations for several thousand birds from Europe and North America for a period of 1935 -…
1
vote
1 answer

Error opening SHP file in Rstudio

I am using maptools to open a shapefile in R, but I get the following error in Rstudio: library(maptools) basins = readShapeSpatial("H:GIS/shapefiles/basins") Error in getinfo.shape(fn) : Error opening SHP file When I try the exact same code in…
sbg
  • 1,772
  • 8
  • 27
  • 45
0
votes
0 answers

How do I find references to maptools, rgdal, or rgeos, in my R-package? sf is the only spatial analysis package in the namespace

In my R package I replaced calls to other spatial analysis packages with sf functions, but still get a message: "The legacy packages maptools, rgdal, and rgeos, underpinning this package will retire shortly. Please refer to R-spatial evolution…
0
votes
1 answer

R Cartogram issue: Error in Fij[distance <= radius[j]] <- Fbij[distance <= radius[j]] : NAs are not allowed in subscripted assignments

I am trying to create a cartogram using the R cartogram package. My code looks as follows: #Create the dataframe data(wrld_simpl) world_map4 <- wrld_simpl news2 <- news %>% group_by(iso_a3) %>% select(iso_a3, Mentions_sum, Goldstein_avg) %>%…
0
votes
0 answers

SDM extra value from MODIS

I am trying to extract monthly sea surface temperature, monthly chlorophyll concentration, depth, salintity via R. My tibble consist of 10000 presence-only data with columns of year, month, data, latitude and longitude. How can I extract the value…
0
votes
0 answers

Create a grid of 10x10m within polygon 100x100m shapefile and rotate the grid matching the orientation of 100x100m ploygon

I am loading shapefile with multiple square polygon feature of size 100x100 m in R using st_read. I am able to create a grid of 10x10 m using st_make_grid, but how can I rotate each grid to match the orientation of polygon feature. Any suggestions…
james
  • 15
  • 3
0
votes
0 answers

What is causing the error loading worldmap

I get the folowing error when trying to load rworldmap. I am running the latest version of r ie 4.2.3 and have tried downloading and installing again, but has no effect Any solutions? I am trying to plot a map using code that worked last…
0
votes
1 answer

Converting Shape file from GIS into a PPP using spatstat UK

I am trying to create a PPP in spatstat using my study area (a large polygon made up of individual polygons) from a shape file from GIS. I have been following: Handling shapeles in the spatstat package Adrian Baddeley, Rolf Turner and Ege…
0
votes
1 answer

Query About How To Generate Vietnam Map With Custom Labels For Each Province R Script

I want to generate the Vietnam Map using an R script which I have done but I cant figure out how to generate the map with custom labels. My…
Shab
  • 1
  • 3
0
votes
0 answers

GGplot Error Continuous Scale Command errors

I am working on a homework assignment in R Studio and keep getting the Error: Discrete value supplied to continuous scale error. When doing this part: ggplot()+plot1+plot2+plot3 + coord_equal() + scale_fill_gradient( low="#473B31", high="#FFFFFF") I…
0
votes
1 answer

Can't plot image which is converted from a raster

I converted a raster to an image and wanted to plot it. However, I then get the following error: library(raster) r #class : RasterLayer #dimensions : 23320, 37199, 867480680 (nrow, ncol, ncell) #resolution : 0.02, 0.02 (x, y) #extent :…
Maik
  • 1
  • 1