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
0
votes
0 answers

Is there an R function that calculates sunrise/sunset and takes sf objects? Maptools appears to need sp objects

I am trying to calculate sunrise/sunset times based on lat/long coordinates and have done it previously with an sp object and maptools::sunriset. This function doesn't take sf objects and sp is being deprecated so we need to switch over our code. …
0
votes
1 answer

R: scaling Alaska using maptools::elide

I'm building a shapefile of states where Alaska and Hawaii are represented as being somewhere south of Texas, for ease of making an illustrative map. Using maptools package and some code from …
Brandon
  • 101
  • 2
0
votes
1 answer

How can I modify and save rnaturalearthdata::countries50 without losing information?

I'm new to geographic data. I've opened and modified the SpatialPolygonsDataFrame rnaturalearthdata::countries50. After using st_as_sf() and st_shift_longitude(), it is now a SpatialPointsDataFrame. What is the best way of saving the file so that I…
Tea Tree
  • 882
  • 11
  • 26
0
votes
1 answer

R maptools wrld_simpl in rpy2

In R: import(maptools) data(wrld_simpl) In python rpy2, how do I access wrld_simpl? The following code (in Python) fails as follows...package "maptools" has no attribute wrld_simpl maptools = importr('maptools') data =…
Jon
  • 2,280
  • 2
  • 25
  • 33
0
votes
1 answer

Quadrats in Spatstat

I am now doing exploratory analysis and the objective is to plot a quadrat map, determine if there exists complete spatial randomness (visually and using chi-square test), etc. However, I am having trouble plotting a quadrat map. I previously asked…
0
votes
1 answer

point pattern analysis in Spatstat

I am having some trouble setting up my data for some point pattern analysis. What I want to do: conduct a point pattern analysis on NYC arrest data and see if there exists a spatial dependence between arrests and Covid-19 cases. What I've done so…
0
votes
0 answers

Unable to install any packages on R

I am trying to install packages for a spatial data course however each package I try install to R I get this same error message Warning in install.packages : 'lib = "C:/Users/chris/OneDrive/Documents/R/win-library/3.4"' is not writable I have…
chris1
  • 11
  • 3
0
votes
1 answer

Error in rgeos::createPolygonsComment(oobj) : orphaned hole using geojsonio in R

Im am trying to create a .geojson file in my local repository for this output. I am downloading the file locally, making my adjustments and writing input21.geojson, however, I get the message: Error in rgeos::createPolygonsComment(oobj) :…
motipai
  • 328
  • 3
  • 10
0
votes
1 answer

R - Merging city name to approximate lat-long coordinates

I want to merge city names to approximate coordinates. I have two datasets. lat-long for cities, called cities. lat-long for observed events, called events. Most of the events occur just out-side the lat-longs of the city. I want to merge in the…
wake_wake
  • 1,332
  • 2
  • 19
  • 46
0
votes
0 answers

latitude and longitude to angle based on quadrat in r

I have a set of coordinates that I want to turn into an angle and do some Anova analysis. I used maptools trackAzimuth function to do it, but I keep losing one or two points. I assume it calculates angles between two coordinates. But I want 1 point…
0
votes
1 answer

Use elide to rotate multiple polylines

I would like to rotate multiple polylines based on their given bearing to magnetic north, or 0 degrees. I can do it for a single polyline, but need to run the code on hundreds of polylines. See the code below for a short…
jsimpsno
  • 448
  • 4
  • 19
0
votes
0 answers

Problems with names of points on map in ggplot2 in R

I need to make map with points with labels. I try to make put points on the map withot labels. library(maps) library(ggplot2) world_map <- map_data("world") Latitude <- c(-40.68222046, 82.49914551, -7.96999979, 23.26666641, …
0
votes
0 answers

Connecting rgeos to maptools in R 3.6.0

To implement a choropleth, I looked back to some prompt code which I found on the Internet and read how to use the 'maptools' library to fortify a SpatialPolygonsDataFrame object. The premise that I have to make is that I installed recently R 3.6.0,…
Fränzu
  • 1
  • 1
0
votes
1 answer

dotsInPolys length mismatch using data downloaded via tidycensus

Can you help figure out the best way to resolve the length mismatch error thrown by dotsInPolys? I think it is because there are NA's or NULLs or some funk in the polygon data that makes it too long. Here's code that reproduces the error.…
dca
  • 594
  • 4
  • 18
0
votes
0 answers

Plot map using ggplot2

I'm trying to plot data on map of switzerland using this code require("rgdal") require("maptools") require("ggplot2") require("plyr") require("maps") require("ggmap") ggplot() + geom_polygon(data = da, aes(x=long, y = lat)) +…
r tremeaud
  • 161
  • 1
  • 3
  • 11