Combining SpatialLines into SpatialPolygons

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

Combining SpatialLines into SpatialPolygons

Антон Морковин
 
Dear all,
 
I have a kml file with a huge set of lines, which actually depict a grid of many rectangles. I want to unite these lines into polygons (i.e., each rectangle must be a separate spatial polygon), but I failed to find a function which does it directly.
 
I found several solutions on how to convert to polygons a set of isolated closed lines. But with my file, these methods can produce nothing more than a set of "polygons" with only one line each. The only way I can imagine is to convert these lines into a raster and then polygonize it, but this method probably would lack accuracy.
If anyone knows how to deal with such tasks, please help me. Thank you in advance!
                                                                                  
Best regards,
Anton A. Morkovin
 
Zoological Museum of M.V. Lomonosov Moscow State University
Russia, 125009 Moscow, Bolshaya Nikitskaya Str. 2.
 
 

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Combining SpatialLines into SpatialPolygons

Roger Bivand
Administrator
Please use plain text only, and provide a small reproducible example,
possibly demonstrating in code and data what you claim about "finding
solutions". I assume that you have already tried rgeos::gPolygonize().
Consider using its example to generate your reproducible example. You may
find that scaling also matters.

Roger

On Mon, 30 Jul 2018, Антон Морковин wrote:

>  
> Dear all,
>  
> I have a kml file with a huge set of lines, which actually depict a grid of
> many rectangles. I want to unite these lines into polygons (i.e., each
> rectangle must be a separate spatial polygon), but I failed to find a
> function which does it directly.
>  
> I found several solutions on how to convert to polygons a set of isolated
> closed lines. But with my file, these methods can produce nothing more than
> a set of "polygons" with only one line each. The only way I can imagine is
> to convert these lines into a raster and then polygonize it, but this method
> probably would lack accuracy.
> If anyone knows how to deal with such tasks, please help me. Thank you in
> advance!
>                                                                            
>       
> Best regards,
> Anton A. Morkovin
>  
> Zoological Museum of M.V. Lomonosov Moscow State University
> Russia, 125009 Moscow, Bolshaya Nikitskaya Str. 2.
>  *  Personal page: http://istina.msu.ru/profile/Anton_Morkovin/
>  *  Bibliography of scientific works on birds of Russia
>  *  The Birdwatchers union "Birds of Moscow and the Moscow
>     region" || Facebook || VK || Twitter
>  
>  
>
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway