Questions tagged [rgeo-shapefile]

33 questions
6
votes
1 answer

create evenly spaced polylines over counties using R

I would like to create evenly spaced polylines going North to South with 50 mile spacing between each line and 10 miles long. Not sure if this is possible using sf package. In the example below, I would like to have the lines filling the counties…
jsimpsno
  • 448
  • 4
  • 19
5
votes
1 answer

Check polygon intersection in R: sf::intersects incorrectly returns TRUE result while rgeos::gIntersects correctly returns FALSE

I'm trying to check whether two polygons intersect in R. When plotting, they clearly do not. When checking the intersection, rgeos::gIntersects() currently returns FALSE, while sf::intersects() returns TRUE. I imagine this is due to the polygons…
Rob Marty
  • 378
  • 1
  • 9
3
votes
2 answers

rgeos::gBuffer shrink without loss of points

I need to be able to shrink a polygon of lat/lon data without loss of points; more the point, I need the points to be effectively "smooshed" in the correct direction. Typically, gBuffer works fine, but there is no assurance on the number of points…
r2evans
  • 141,215
  • 6
  • 77
  • 149
3
votes
1 answer

Error whilst performing gCentroid in R

I am unable to get centroids from polygons in R. The confusing bit is, it used to work in the past and has suddenly stopped working! This is the piece of code: polygon.centroids <- SpatialPointsDataFrame(gCentroid(polygon, byid = TRUE), …
VGu
  • 386
  • 5
  • 23
1
vote
0 answers

Invalid geometry using ´sf´ in R

I am working with several messy polygon dataset in R, analysing thir overlap. I keep using st_make_valid() and st_buffer(., 0), even between operations, which makes it work most of the time, but not always. Is there a better way of solving this? In…
1
vote
1 answer

How to plot different district names on shapefile in R?

I have shapefile of my study area "Gilgit Baltistan". I want to plot names of districts on map(shapefile) Using this code I can plot study area map. How can I show names of districts on this map? library(mapdata) library(prettymapr) library(ggplot2)…
Ali Rawail
  • 21
  • 4
1
vote
1 answer

How to buffer/expand a census shapefile by 1 mile using rgeos::gBuffer?

I'm trying to expand/enlarge a shapefile of the Cherokee Nation that I downloaded from the Census dataset here: https://www2.census.gov/geo/tiger/TIGER2019/AIANNH/ using the rgeos package. The code I have for this currently…
ANam
  • 337
  • 2
  • 15
1
vote
0 answers

filter/subset a SpatialPolygonsDataFrame

I have an object, O, of type SpatialPolygonsDataFrame.Is it, there is a variable/column called Notes. The column Notes includes string files where some of them have the word double in it. I want to filter just the data that has the word double in…
OverFlow Police
  • 861
  • 6
  • 23
0
votes
0 answers

Changing Shapefiles structure for tmap in R

I would like to know if changing shapefile specifications is possible. I'm trying to create a map witht the tmap package in R. If I look for the shapefiles in national websites. I can't find the one the Ministry of Public Health created. Since I…
almr27
  • 43
  • 4
0
votes
1 answer

Combine units in a shapefile while keeping others granular in R

I have a 5-digit postcode shapefile for Germany. Big number 1-digits postcodes are similar to German states. I read shapefile data with rgdal thus having a SpatialPolygonsDataFrame. I have only data for some part of Germany, i.e. some postcodes. The…
Marco
  • 2,368
  • 6
  • 22
  • 48
0
votes
0 answers

Is there any way to draw Burundi Map in plotly?

i'd like to make an interactive map for Burundi so that i can click on a region and see the content for that region. i wanted to make a map like this one i import pandas as pd import plotly.express as px df = pd.read_csv("burundi_data.csv") # this…
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

rgeos gBuffer: Take sum of specific dwellings within a buffer zone

I have a very large dataset with dwellings. For every dwelling, I have the X and Y coordinates, and a boolean indicating whether the dwelling is a rental or not. For each dwelling, we need a radius of X meters, and get the number of rentals that…
TvCasteren
  • 449
  • 3
  • 18
0
votes
0 answers

Error in plot.SpatialPolygons(x, ...) : object 'pm25' not found when attempting to create a chloropleth in R

I am trying to create several chloropleths/heat maps of NYC in R. I downloaded the shapefile from NYC OpenData here: https://catalog.data.gov/dataset/zip-code-boundaries. And the demographic/other data I am attempting to merge it with and create…
0
votes
1 answer

st_buffer with geometry sfc_POINT

I'm working with geospatial data and for one part of the analysis I need to use coordinate points of regions that I get from an excel and turn that data into sf object using st_as_sf. When I tried to set a buffer around the points I use…
1
2 3