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
3
votes
1 answer

spplot issue with legend range and colors distribution

I have problem with correct color range on my plot and legend. This is code which I use: data.ch4 <- read.csv2("v42_CH4_1970_TOT.txt",skip = 3,stringsAsFactors = FALSE, header = F) num_data <-…
Karmel
  • 115
  • 3
  • 10
3
votes
1 answer

R package Error in get("rgeos", envir = .MAPTOOLS_CACHE) : object 'rgeos' not found

I'm new to R and it's package system, just wrote my first package with the intent to use it with OpenCPU. while executing this function: #' Create a PNG which shows interpolated senseMap Data #' #' @export #' @import jsonlite #' @import sp #'…
mdragunski
  • 31
  • 3
3
votes
3 answers

move and rescale alaska and hawaii

I'm following this tutorial to move and rescale alaska and hawaii. This is the code that I'm running: x = c("ggplot2", "rgdal", "maptools", "mapproj", "rgeos") lapply(x, library, character.only = TRUE) remove.territories = function(.df) { …
Ignacio
  • 7,646
  • 16
  • 60
  • 113
3
votes
2 answers

Extracting the parent polygon from a nested SpatialPolygonsDataFrame or 'Dissolving' holes from a parent ploygon

EDIT After more research and still no solution, I am adding a substantial edit as well as a link to the .shp file. The shape file is included here I have a SpatialPolygonsDataFrame that contains 9 polygons, each of which also contains multiple…
B. Davis
  • 3,391
  • 5
  • 42
  • 78
3
votes
1 answer

Error in if (x[i] > 0) { : missing value where TRUE/FALSE needed

I have this line in my code to create dots for a dot-density map. The function I'm misusing is dotsInPolys in the maptools package. I get this error when I run it and I'm not sure what it means. Can anyone help? NSWdots <- dotsInPolys(NSW,…
Eugene Brown
  • 4,032
  • 6
  • 33
  • 47
3
votes
1 answer

Geographical CRS given to non-conformant data in R

sorry for bothering you for this, but it is maybe 5 hours I am getting mad on this issue and I don't manage to sort it out. I have a dataset of about 37,000 entries. Each of them has its own Lon and Lat coordinate values. Checking the overall…
Nemesi
  • 781
  • 3
  • 13
  • 29
3
votes
1 answer

Plotting a map with lines density in place of colours in R: legend and lines

I have data about relative productivity for the Italian provinces. I built 5 groups according to the productivity level. Finally I want to represent such a scenario using a map of the Italian provinces, given that I CAN NOT use colours, since the…
Bob
  • 452
  • 6
  • 18
3
votes
2 answers

How to get a SpatialPolygons (SP-class) from a set of segments (psp in spatstat)?

I have a set of random segments drawing a kind of tessellation (of triangles, rectangles ...) in a window (in spatstat R). I need to convert it into a set of polygons (SpatialPolygons) to calculate some indices (like area, shape indices ...). This…
2
votes
0 answers

Creating an inverse of polygons

I have downloaded shapefile containing polygons for urban areas. However, I am interested in polygons representing rural areas. Therefore I would like to convert the shapefile containing urban areas polygons to rural areas using R. Thus an inverse…
ccc
  • 21
  • 2
2
votes
1 answer

How can I add names of cities and centroids in maps in R with maptools, ggplot or other packages?

I am trying to incorporate labels of provinces, and cities with labels and dots into a South African map.I can get a map with provincial subdivisions from a spdf file, from website https://gadm.org/download_country_v3.html SA1spdf <-…
2
votes
1 answer

How to plot an Europe map with my own data?

I'd like to do an Europe map, so I was trying with this code but I don't really know how it works. #that's my data europe<-structure(list(Code = c("BE", "BG", "CZ", "DK", "DE", "EE", "IE", "EL", "ES", "FR", "HR", "IT", "CY", "LV", "LT", "LU",…
2
votes
1 answer

how to get geocode in R?

i have tried 2 approaches to get the long lat of location. install.packages("maptools") library(maptools) A1 <- data.frame(A1= c("Dordrecht", "Berlin", "New York", "Batu Pahat", "Edinburgh"), …
DD3
  • 79
  • 4
2
votes
2 answers

Why does my plot of a raster in R blur in saved file?

I'm hoping to export a map with a raster plotted on it as a .pdf or some other vector file. For some reason, when I save it as a .pdf or .ps file, the raster is blurry/fuzzy/smeared and unusable. Any tips for fixing this? A .png saves with the…
druryj
  • 41
  • 3
2
votes
1 answer

Error with Plotting Cartogram - 'This function does not give correct centroids and distances for longitude/latitude data.'

I'm trying to use the wrld_simple data from the maptools package to plot a Cartogram that involves some European countries based on their Population in 2005: countries = c('Austria', 'Belgium', 'Bulgaria', 'Cyprus', 'Czech Republic', 'Denmark',…
Dan
  • 61
  • 4
2
votes
1 answer

R map - poor representation of land borders

I map the southern part of the South hemisphere. My issue is Australia which has poorly drawn borders. My data : library("maptools") library("ggplot2") library("tidyverse") ylim_map <- c(-90, -30) xlim_map <- c(-180, 180) world <-…
Loulou
  • 703
  • 5
  • 17
1 2
3
10 11