Convert poly line to polygon in R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Convert poly line to polygon in R

R help mailing list-2
I have a shape file as poly line and I want to convert it to polygon.Is it possible to do that in R?lake <-readShapeLines("./lake_main_utm.shp")proj4string(lake) <- CRS("+proj=utm +zone=39 +datum=WGS84")

Sincerely.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Convert poly line to polygon in R

Jeff Newmiller
Might want to post this on R-sig-geo.

Might also want to post in plain text format... see below how your message got messed up coming through the mailing list.
--
Sent from my phone. Please excuse my brevity.

On November 12, 2017 9:58:56 PM PST, Javad Bayat via R-help <[hidden email]> wrote:

>I have a shape file as poly line and I want to convert it to polygon.Is
>it possible to do that in R?lake
><-readShapeLines("./lake_main_utm.shp")proj4string(lake) <-
>CRS("+proj=utm +zone=39 +datum=WGS84")
>
>Sincerely.
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Convert poly line to polygon in R

MacQueen, Don
In addition to which, the
  rgeos
package may have something.

If it's just a single polyline, it may be pretty easy to pull out the coordinates as a two column matrix, append the first row at the end, and rebuild it as a polygon.

The readOGR function in the rgdal package is probably a better choice for loading a shapfile into R. See also the relatively new package named "sf".

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 

On 11/13/17, 12:47 AM, "R-help on behalf of Jeff Newmiller" <[hidden email] on behalf of [hidden email]> wrote:

    Might want to post this on R-sig-geo.
   
    Might also want to post in plain text format... see below how your message got messed up coming through the mailing list.
    --
    Sent from my phone. Please excuse my brevity.
   
    On November 12, 2017 9:58:56 PM PST, Javad Bayat via R-help <[hidden email]> wrote:
    >I have a shape file as poly line and I want to convert it to polygon.Is
    >it possible to do that in R?lake
    ><-readShapeLines("./lake_main_utm.shp")proj4string(lake) <-
    >CRS("+proj=utm +zone=39 +datum=WGS84")
    >
    >Sincerely.
    >
    > [[alternative HTML version deleted]]
    >
    >______________________________________________
    >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
    >https://stat.ethz.ch/mailman/listinfo/r-help
    >PLEASE do read the posting guide
    >http://www.R-project.org/posting-guide.html
    >and provide commented, minimal, self-contained, reproducible code.
   
    ______________________________________________
    [hidden email] mailing list -- To UNSUBSCRIBE and more, see
    https://stat.ethz.ch/mailman/listinfo/r-help
    PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
    and provide commented, minimal, self-contained, reproducible code.
   

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.