[R] Winding Number
Roger Bivand
Roger.Bivand at nhh.no
Fri Apr 2 19:15:12 CEST 2004
On Fri, 2 Apr 2004, Clint Bowman wrote:
> I have shapefiles for the state climatic divisions for the United States
> and read.shape brings them in wonderfully. Now I wish to run through a
> list of several thousand observation sites to find out in which division
> each is located. I figure that I can compute the winding number for each
> site and be done. However a search doesn't find any references and I
> can't find a winding number function among the map/tools/stats. I have
> the code for an efficient C++ but was expecting that it would already be
> implemented as an R function
>
> Since I haven't used the map/tools/stats collection before, I suspect I'm
> overlooking the function and would be thankful for a pointer.
>
This is work in progress - where all good ideas and contributions will be
welcome. If you look on http://sourceforge.net/projects/r-spatial/, you
will see an "alpha" package called "sp", which already has a
point-in-polygon facility, but which may not scale up to the kinds of data
volumes you have, but which invites a spatial query (match polygon?)
function between a SpatialDataFrame with point coordinates and a
SpatialDataPolygons object (sometime). This is only as source packages so
far, so Windows binaries are not yet available.
I have used the splancs package inout() function before, trying the points
coordinate matrix on each polygon in turn; splancs is available as a
Windows binary. This ought to be less "rough at the edges", and in time
will be. The immediate solution is to use splancs, but this will not work
if the Shapes have multiple polygons. There is a more specialised list for
these kinds of questions in addition to r-help:
https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-geo
and since yesterday (thanks to Jonathan Baron), its archives are also
searchable from:
http://finzi.psych.upenn.edu/search.html
This question hasn't come up there, but maybe we could move further
discussion there - posting only for subscribers?
> TIA
>
> Clint
>
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
More information about the R-help
mailing list