[R-sig-Geo] convert points into SHP polygons

Nikhil Kaza nikhil.list at gmail.com
Sat Nov 28 14:56:24 CET 2009


Look at this website.

http://www.carsonfarmer.com/?p=455

On 27 Nov 2009, at 11:03PM, rusers.sh wrote:

> Dear Robert,
> My method to generate the Voronoi tessellation maybe not better, You  
> can
> show me you method to get it.
>  What i want to get is the the class of SpatialPolygons(sp) based on  
> the
> generated Voronoi tessellation.
>  Any ideas or suggestions are greatly appreciated.
>
> 2009/11/27 rusers.sh <rusers.sh at gmail.com>
>
>>  Yes, what i want is really the Voronoi tessellation that you  
>> showed in
>> the link. I can generate the Voronoi tessellation  (see my codes),  
>> but my
>> problem is how to generate the the class of SpatialPolygons(sp)  
>> based on the
>> generated  Voronoi tessellation? (SHP means shape file of polygon.)
>>  Thanks a lot.
>> ####My code to get the Voronoi tessellation########
>> library(spatstat)
>> win<-owin(c(0,1),c(0,1))
>> pp <- runifpoint(10,win=win)
>> #plot(pp)
>> library(tripack)
>> vm <- voronoi.mosaic(pp$x,pp$y)
>> plot(vm)
>> par(new=T)
>> points(pp$x,pp$y,col='blue')
>> axis(1,xlim=c(0,1)) #1=below
>> axis(2,ylim=c(0,1)) #2=left
>> box(xlim=c(0,1),ylim=c(0,1))
>>
>> 2009/11/27 Robert J. Hijmans <r.hijmans at gmail.com>
>>
>> I think you want a Voronoi tessalation (diagram):
>>> http://en.wikipedia.org/wiki/Voronoi_diagram
>>>
>>> But what are SHP polygons?  Is 'SHP' a class in an R package?
>>>
>>> Robert
>>>
>>> On Fri, Nov 27, 2009 at 2:03 PM, rusers.sh <rusers.sh at gmail.com>  
>>> wrote:
>>>> To make this problem more clear. Suppose i have some points in a
>>> certain
>>>> area (e.g. 10 points in a unit square), how to cut and generate the
>>>> corresponding SHP polygons of containing the points (1 point in 1
>>> polygon,
>>>> maybe the point as their centroid) in this certain area?
>>>> In GeoDa, there is a menu "tools->shape->point  to polygon" to  
>>>> achieve
>>>> that. I wonder how to do that in R. Thanks a lot.
>>>> ##Example##
>>>> win<-owin(c(0,1),c(0,1))
>>>> pp <- runifpoint(10) #generate 10 points
>>>> #i want to change these 10 points into 10 SHP polygons,something  
>>>> like
>>> the
>>>> manipulation in GeoDA, "tools->shape->point  to polygon"
>>>> #plot(pp)
>>>>
>>>> 2009/11/27 rusers.sh <rusers.sh at gmail.com>
>>>>
>>>>> Hi,
>>>>>  I always need to convert between the points and polygons. For
>>> converting
>>>>> the polygons to points, we can use the "get.Pcent(maptools) " to  
>>>>> get
>>> the
>>>>> centroids of the polygons. But for converting points to polygons
>>> (something
>>>>> like GeoDa's "tools->shape->point  to polygon"), i cannot find the
>>>>> corresponding method. I searched in R Site Search with "point to
>>> polygon"
>>>>> and "generate polygon", but still cannot get the answers.
>>>>> Does anybody know how to convert points to the SHP polygons?
>>>>> OR whether we can generate some SHP polygons randomly in R?
>>>>> ##Example##
>>>>> win<-owin(c(0,1),c(0,1))
>>>>> pp <- runifpoint(10) #generate 10 points
>>>>> #i want to change these 10 points into 10 SHP polygons,something  
>>>>> like
>>> the
>>>>> manipulation in GeoDA, "tools->shape->point  to polygon"
>>>>> #plot(pp)
>>>>>  Thanks a lot.
>>>>>
>>>>>
>>>>> --
>>>>> -----------------
>>>>> Jane Chang
>>>>> Queen's
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> -----------------
>>>> Jane Chang
>>>> Queen's
>>>>
>>>>       [[alternative HTML version deleted]]
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo at stat.math.ethz.ch
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>
>>>
>>
>>
>>
>> --
>> -----------------
>> Jane Chang
>> Queen's
>>
>
>
>
> -- 
> -----------------
> Jane Chang
> Queen's
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list