Simplifying polygons in rgeos and maintaining data in SpatialPolygonsDataFrameHow to attach a simple data.frame to a SpatialPolygonDataFrame in R?gSimplify not simplifying shapefile in RHow to join (merge) data frames (inner, outer, left, right)Drop data frame columns by nameHow to create new polygons by simplifying from two SpatialPolygonsDataFrame objects in R?Simple way to subset SpatialPolygonsDataFrame (i.e. delete polygons) by attribute in RRGeo Projected Buffer Polygon too smallLoop polygon clipping with gIntersectionVariant of rgeos::gUnion that won't dissolve adjacent polygons?Value of coordinates() for a SpatialPolygonsDataFrame object?Remove certain polygons from SpatialPolygonsDataFrameMerge data frame with SpatialPolygonsDataFrame
How to design an effective polearm-bow hybrid?
Upper Bound for a Sum
Is it uncompelling to continue the story with lower stakes?
The Game of the Century - why didn't Byrne take the rook after he forked Fischer?
What are the limitations of the Hendersson-Hasselbalch equation?
A Checkmate of Dubious Legality
How does Geralt transport his swords?
Is there a way to improve my grade after graduation?
What's "halachic" about "Esav hates Ya'akov"?
Is there a booking app or site that lets you specify your gender for shared dormitories?
How do I show and not tell a backstory?
What does C++ language definition say about the extent of the static keyword?
What printing process is this?
Conditional probability of dependent random variables
What is it exactly about flying a Flyboard across the English channel that made Zapata's thighs burn?
Why is the Vasa Museum in Stockholm so Popular?
Is there a way to say "double + any number" in German?
Generate random number in Unity without class ambiguity
GFCI tripping on overload?
How do I know when and if a character requires a backstory?
How can I use commands with sudo without changing owner of the files?
Can you put ranks into knowledge skills that aren't class skills?
In MTG, was there ever a five-color deck that worked well?
Broken bottom bracket?
Simplifying polygons in rgeos and maintaining data in SpatialPolygonsDataFrame
How to attach a simple data.frame to a SpatialPolygonDataFrame in R?gSimplify not simplifying shapefile in RHow to join (merge) data frames (inner, outer, left, right)Drop data frame columns by nameHow to create new polygons by simplifying from two SpatialPolygonsDataFrame objects in R?Simple way to subset SpatialPolygonsDataFrame (i.e. delete polygons) by attribute in RRGeo Projected Buffer Polygon too smallLoop polygon clipping with gIntersectionVariant of rgeos::gUnion that won't dissolve adjacent polygons?Value of coordinates() for a SpatialPolygonsDataFrame object?Remove certain polygons from SpatialPolygonsDataFrameMerge data frame with SpatialPolygonsDataFrame
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Background
I'm interested in simplifying polygons with use of the gSimplify
function available through the rgeos
package.
Reproducible example
A reproducible example can be generated with use of the code below:
# Data sourcing -----------------------------------------------------------
# Download an read US state shapefiles
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
# Libs
require(rgdal)
require(rgeos)
# Read
us_shps <- readOGR(dsn = tmp_dir, layer = "cb_2014_us_state_20m")
# Simplified --------------------------------------------------------------
# Simplifiy
us_shps_smpl <- gSimplify(spgeom = us_shps,
tol = 200,
topologyPreserve = TRUE)
Preview
par(mfrow = c(2,1))
plot(us_shps_smpl, main = "Simplified")
plot(us_shps, main = "Original")
Problem
In addittion to simplifying polygons the gSimplify
function changed classes of the resulting object:
>> class(us_shps)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
>> class(us_shps_smpl)
[1] "SpatialPolygons"
attr(,"package")
[1] "sp"
>> names(us_shps)
[1] "STATEFP" "STATENS" "AFFGEOID" "GEOID" "STUSPS" "NAME" "LSAD" "ALAND" "AWATER"
>> names(us_shps_smpl)
[1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19"
[21] "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39"
[41] "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51"
Questions
How can I safely reattached the data that was initially available in the original object and transform the resulting
SpatialPolygons
object to aSpatialPolygonsDataFrame
I reckon that one approach would simply involve attaching data frame;but this depends on the order of elements not changing. Are there any other better approaches (ideally preserving initial object class)?
r gis spatial sp rgeo
|
show 4 more comments
Background
I'm interested in simplifying polygons with use of the gSimplify
function available through the rgeos
package.
Reproducible example
A reproducible example can be generated with use of the code below:
# Data sourcing -----------------------------------------------------------
# Download an read US state shapefiles
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
# Libs
require(rgdal)
require(rgeos)
# Read
us_shps <- readOGR(dsn = tmp_dir, layer = "cb_2014_us_state_20m")
# Simplified --------------------------------------------------------------
# Simplifiy
us_shps_smpl <- gSimplify(spgeom = us_shps,
tol = 200,
topologyPreserve = TRUE)
Preview
par(mfrow = c(2,1))
plot(us_shps_smpl, main = "Simplified")
plot(us_shps, main = "Original")
Problem
In addittion to simplifying polygons the gSimplify
function changed classes of the resulting object:
>> class(us_shps)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
>> class(us_shps_smpl)
[1] "SpatialPolygons"
attr(,"package")
[1] "sp"
>> names(us_shps)
[1] "STATEFP" "STATENS" "AFFGEOID" "GEOID" "STUSPS" "NAME" "LSAD" "ALAND" "AWATER"
>> names(us_shps_smpl)
[1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19"
[21] "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39"
[41] "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51"
Questions
How can I safely reattached the data that was initially available in the original object and transform the resulting
SpatialPolygons
object to aSpatialPolygonsDataFrame
I reckon that one approach would simply involve attaching data frame;but this depends on the order of elements not changing. Are there any other better approaches (ideally preserving initial object class)?
r gis spatial sp rgeo
gis.stackexchange.com they can help you for surely
– Andre Elrico
Sep 5 '17 at 14:24
@AndreElrico I post on gis periodically but to my mind this question is more concerned with how the thegSimplify
handlesSpatialPolygonDataFrame
class, less with quantitative geography aspect of the problem. I reckon it's not a clear cut but I presume that a lot of people who follow rgeos and gis look at both boards.
– Konrad
Sep 5 '17 at 14:27
1
just wanted to make sure you're aware of that site :-)
– Andre Elrico
Sep 5 '17 at 14:28
1
Answere here may be of relevance.
– Z.Lin
Sep 5 '17 at 14:34
1
Are you wedded torgeos
? Otherwise, I believesf::st_simplify()
could help you out here.
– coletl
Oct 9 '17 at 8:55
|
show 4 more comments
Background
I'm interested in simplifying polygons with use of the gSimplify
function available through the rgeos
package.
Reproducible example
A reproducible example can be generated with use of the code below:
# Data sourcing -----------------------------------------------------------
# Download an read US state shapefiles
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
# Libs
require(rgdal)
require(rgeos)
# Read
us_shps <- readOGR(dsn = tmp_dir, layer = "cb_2014_us_state_20m")
# Simplified --------------------------------------------------------------
# Simplifiy
us_shps_smpl <- gSimplify(spgeom = us_shps,
tol = 200,
topologyPreserve = TRUE)
Preview
par(mfrow = c(2,1))
plot(us_shps_smpl, main = "Simplified")
plot(us_shps, main = "Original")
Problem
In addittion to simplifying polygons the gSimplify
function changed classes of the resulting object:
>> class(us_shps)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
>> class(us_shps_smpl)
[1] "SpatialPolygons"
attr(,"package")
[1] "sp"
>> names(us_shps)
[1] "STATEFP" "STATENS" "AFFGEOID" "GEOID" "STUSPS" "NAME" "LSAD" "ALAND" "AWATER"
>> names(us_shps_smpl)
[1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19"
[21] "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39"
[41] "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51"
Questions
How can I safely reattached the data that was initially available in the original object and transform the resulting
SpatialPolygons
object to aSpatialPolygonsDataFrame
I reckon that one approach would simply involve attaching data frame;but this depends on the order of elements not changing. Are there any other better approaches (ideally preserving initial object class)?
r gis spatial sp rgeo
Background
I'm interested in simplifying polygons with use of the gSimplify
function available through the rgeos
package.
Reproducible example
A reproducible example can be generated with use of the code below:
# Data sourcing -----------------------------------------------------------
# Download an read US state shapefiles
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
# Libs
require(rgdal)
require(rgeos)
# Read
us_shps <- readOGR(dsn = tmp_dir, layer = "cb_2014_us_state_20m")
# Simplified --------------------------------------------------------------
# Simplifiy
us_shps_smpl <- gSimplify(spgeom = us_shps,
tol = 200,
topologyPreserve = TRUE)
Preview
par(mfrow = c(2,1))
plot(us_shps_smpl, main = "Simplified")
plot(us_shps, main = "Original")
Problem
In addittion to simplifying polygons the gSimplify
function changed classes of the resulting object:
>> class(us_shps)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
>> class(us_shps_smpl)
[1] "SpatialPolygons"
attr(,"package")
[1] "sp"
>> names(us_shps)
[1] "STATEFP" "STATENS" "AFFGEOID" "GEOID" "STUSPS" "NAME" "LSAD" "ALAND" "AWATER"
>> names(us_shps_smpl)
[1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19"
[21] "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39"
[41] "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51"
Questions
How can I safely reattached the data that was initially available in the original object and transform the resulting
SpatialPolygons
object to aSpatialPolygonsDataFrame
I reckon that one approach would simply involve attaching data frame;but this depends on the order of elements not changing. Are there any other better approaches (ideally preserving initial object class)?
r gis spatial sp rgeo
r gis spatial sp rgeo
asked Sep 5 '17 at 14:17
KonradKonrad
8,24310 gold badges58 silver badges109 bronze badges
8,24310 gold badges58 silver badges109 bronze badges
gis.stackexchange.com they can help you for surely
– Andre Elrico
Sep 5 '17 at 14:24
@AndreElrico I post on gis periodically but to my mind this question is more concerned with how the thegSimplify
handlesSpatialPolygonDataFrame
class, less with quantitative geography aspect of the problem. I reckon it's not a clear cut but I presume that a lot of people who follow rgeos and gis look at both boards.
– Konrad
Sep 5 '17 at 14:27
1
just wanted to make sure you're aware of that site :-)
– Andre Elrico
Sep 5 '17 at 14:28
1
Answere here may be of relevance.
– Z.Lin
Sep 5 '17 at 14:34
1
Are you wedded torgeos
? Otherwise, I believesf::st_simplify()
could help you out here.
– coletl
Oct 9 '17 at 8:55
|
show 4 more comments
gis.stackexchange.com they can help you for surely
– Andre Elrico
Sep 5 '17 at 14:24
@AndreElrico I post on gis periodically but to my mind this question is more concerned with how the thegSimplify
handlesSpatialPolygonDataFrame
class, less with quantitative geography aspect of the problem. I reckon it's not a clear cut but I presume that a lot of people who follow rgeos and gis look at both boards.
– Konrad
Sep 5 '17 at 14:27
1
just wanted to make sure you're aware of that site :-)
– Andre Elrico
Sep 5 '17 at 14:28
1
Answere here may be of relevance.
– Z.Lin
Sep 5 '17 at 14:34
1
Are you wedded torgeos
? Otherwise, I believesf::st_simplify()
could help you out here.
– coletl
Oct 9 '17 at 8:55
gis.stackexchange.com they can help you for surely
– Andre Elrico
Sep 5 '17 at 14:24
gis.stackexchange.com they can help you for surely
– Andre Elrico
Sep 5 '17 at 14:24
@AndreElrico I post on gis periodically but to my mind this question is more concerned with how the the
gSimplify
handles SpatialPolygonDataFrame
class, less with quantitative geography aspect of the problem. I reckon it's not a clear cut but I presume that a lot of people who follow rgeos and gis look at both boards.– Konrad
Sep 5 '17 at 14:27
@AndreElrico I post on gis periodically but to my mind this question is more concerned with how the the
gSimplify
handles SpatialPolygonDataFrame
class, less with quantitative geography aspect of the problem. I reckon it's not a clear cut but I presume that a lot of people who follow rgeos and gis look at both boards.– Konrad
Sep 5 '17 at 14:27
1
1
just wanted to make sure you're aware of that site :-)
– Andre Elrico
Sep 5 '17 at 14:28
just wanted to make sure you're aware of that site :-)
– Andre Elrico
Sep 5 '17 at 14:28
1
1
Answere here may be of relevance.
– Z.Lin
Sep 5 '17 at 14:34
Answere here may be of relevance.
– Z.Lin
Sep 5 '17 at 14:34
1
1
Are you wedded to
rgeos
? Otherwise, I believe sf::st_simplify()
could help you out here.– coletl
Oct 9 '17 at 8:55
Are you wedded to
rgeos
? Otherwise, I believe sf::st_simplify()
could help you out here.– coletl
Oct 9 '17 at 8:55
|
show 4 more comments
1 Answer
1
active
oldest
votes
The sf
package is based entirely on data frames, so its geometry manipulations always preserve the data attached to each feature. The package hasn't caught up with all the standard spatial packages in R yet, but it's fairly easy to go back and forth between sf
and sp
objects when you need more functionality.
Here, st_simplify()
does the work, but you'll need to project your polygons first:
library(sf)
# Download and read example data
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
us_shps <- st_read(paste(tmp_dir, "cb_2014_us_state_20m.shp", sep = "/"))
# st_simplify needs a projected CRS
us_shps_merc <- st_transform(us_shps, 3857)
simple_us_merc <- st_simplify(us_shps_merc)
# Change back to original CRS
simple_us <- st_transform(simple_us_merc, st_crs(us_shps))
# Change to sp object, if you like
simple_us_sp <- as(st_zm(simple_us), "Spatial")
i found that if st_simplify drops some polygons, the geometry column will become an empty list in those rows ("list()"). those "empty geometry" rows will have to be removed before as(.,"Spatial") is applied or an error appears
– Richard DiSalvo
Mar 27 at 2:41
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46057249%2fsimplifying-polygons-in-rgeos-and-maintaining-data-in-spatialpolygonsdataframe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The sf
package is based entirely on data frames, so its geometry manipulations always preserve the data attached to each feature. The package hasn't caught up with all the standard spatial packages in R yet, but it's fairly easy to go back and forth between sf
and sp
objects when you need more functionality.
Here, st_simplify()
does the work, but you'll need to project your polygons first:
library(sf)
# Download and read example data
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
us_shps <- st_read(paste(tmp_dir, "cb_2014_us_state_20m.shp", sep = "/"))
# st_simplify needs a projected CRS
us_shps_merc <- st_transform(us_shps, 3857)
simple_us_merc <- st_simplify(us_shps_merc)
# Change back to original CRS
simple_us <- st_transform(simple_us_merc, st_crs(us_shps))
# Change to sp object, if you like
simple_us_sp <- as(st_zm(simple_us), "Spatial")
i found that if st_simplify drops some polygons, the geometry column will become an empty list in those rows ("list()"). those "empty geometry" rows will have to be removed before as(.,"Spatial") is applied or an error appears
– Richard DiSalvo
Mar 27 at 2:41
add a comment |
The sf
package is based entirely on data frames, so its geometry manipulations always preserve the data attached to each feature. The package hasn't caught up with all the standard spatial packages in R yet, but it's fairly easy to go back and forth between sf
and sp
objects when you need more functionality.
Here, st_simplify()
does the work, but you'll need to project your polygons first:
library(sf)
# Download and read example data
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
us_shps <- st_read(paste(tmp_dir, "cb_2014_us_state_20m.shp", sep = "/"))
# st_simplify needs a projected CRS
us_shps_merc <- st_transform(us_shps, 3857)
simple_us_merc <- st_simplify(us_shps_merc)
# Change back to original CRS
simple_us <- st_transform(simple_us_merc, st_crs(us_shps))
# Change to sp object, if you like
simple_us_sp <- as(st_zm(simple_us), "Spatial")
i found that if st_simplify drops some polygons, the geometry column will become an empty list in those rows ("list()"). those "empty geometry" rows will have to be removed before as(.,"Spatial") is applied or an error appears
– Richard DiSalvo
Mar 27 at 2:41
add a comment |
The sf
package is based entirely on data frames, so its geometry manipulations always preserve the data attached to each feature. The package hasn't caught up with all the standard spatial packages in R yet, but it's fairly easy to go back and forth between sf
and sp
objects when you need more functionality.
Here, st_simplify()
does the work, but you'll need to project your polygons first:
library(sf)
# Download and read example data
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
us_shps <- st_read(paste(tmp_dir, "cb_2014_us_state_20m.shp", sep = "/"))
# st_simplify needs a projected CRS
us_shps_merc <- st_transform(us_shps, 3857)
simple_us_merc <- st_simplify(us_shps_merc)
# Change back to original CRS
simple_us <- st_transform(simple_us_merc, st_crs(us_shps))
# Change to sp object, if you like
simple_us_sp <- as(st_zm(simple_us), "Spatial")
The sf
package is based entirely on data frames, so its geometry manipulations always preserve the data attached to each feature. The package hasn't caught up with all the standard spatial packages in R yet, but it's fairly easy to go back and forth between sf
and sp
objects when you need more functionality.
Here, st_simplify()
does the work, but you'll need to project your polygons first:
library(sf)
# Download and read example data
tmp_shps <- tempfile()
tmp_dir <- tempdir()
download.file(
"http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps
)
unzip(tmp_shps, exdir = tmp_dir)
us_shps <- st_read(paste(tmp_dir, "cb_2014_us_state_20m.shp", sep = "/"))
# st_simplify needs a projected CRS
us_shps_merc <- st_transform(us_shps, 3857)
simple_us_merc <- st_simplify(us_shps_merc)
# Change back to original CRS
simple_us <- st_transform(simple_us_merc, st_crs(us_shps))
# Change to sp object, if you like
simple_us_sp <- as(st_zm(simple_us), "Spatial")
edited Mar 27 at 2:49
answered Oct 9 '17 at 9:12
coletlcoletl
6273 silver badges15 bronze badges
6273 silver badges15 bronze badges
i found that if st_simplify drops some polygons, the geometry column will become an empty list in those rows ("list()"). those "empty geometry" rows will have to be removed before as(.,"Spatial") is applied or an error appears
– Richard DiSalvo
Mar 27 at 2:41
add a comment |
i found that if st_simplify drops some polygons, the geometry column will become an empty list in those rows ("list()"). those "empty geometry" rows will have to be removed before as(.,"Spatial") is applied or an error appears
– Richard DiSalvo
Mar 27 at 2:41
i found that if st_simplify drops some polygons, the geometry column will become an empty list in those rows ("list()"). those "empty geometry" rows will have to be removed before as(.,"Spatial") is applied or an error appears
– Richard DiSalvo
Mar 27 at 2:41
i found that if st_simplify drops some polygons, the geometry column will become an empty list in those rows ("list()"). those "empty geometry" rows will have to be removed before as(.,"Spatial") is applied or an error appears
– Richard DiSalvo
Mar 27 at 2:41
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46057249%2fsimplifying-polygons-in-rgeos-and-maintaining-data-in-spatialpolygonsdataframe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
gis.stackexchange.com they can help you for surely
– Andre Elrico
Sep 5 '17 at 14:24
@AndreElrico I post on gis periodically but to my mind this question is more concerned with how the the
gSimplify
handlesSpatialPolygonDataFrame
class, less with quantitative geography aspect of the problem. I reckon it's not a clear cut but I presume that a lot of people who follow rgeos and gis look at both boards.– Konrad
Sep 5 '17 at 14:27
1
just wanted to make sure you're aware of that site :-)
– Andre Elrico
Sep 5 '17 at 14:28
1
Answere here may be of relevance.
– Z.Lin
Sep 5 '17 at 14:34
1
Are you wedded to
rgeos
? Otherwise, I believesf::st_simplify()
could help you out here.– coletl
Oct 9 '17 at 8:55