Re: [R] Winding Number

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

Re: [R] Winding Number

Roger Bivand
Administrator
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



Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: [R] Winding Number

Clint Bowman
Roger,

Thanks for your reference.  Since I can get the polygon coordinates (and
have the coordinates of my sites, I can cobble together a function that
will do the trick.

Again, thanks,

Clint

On Fri, 2 Apr 2004, Roger Bivand wrote:

> 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
> >
> >
>
>

--
Clint Bowman INTERNET: clint at ecy.wa.gov
Air Quality Modeler INTERNET: clint at math.utah.edu
Department of Ecology VOICE: (360) 407-6815
PO Box 47600 FAX: (360) 407-7534
Olympia, WA 98504-7600



Reply | Threaded
Open this post in threaded view
|

Re: [R] Winding Number

Roger Bivand
Administrator
Clint,

Could you please report back to the r-sig-geo list on how you got this
done so that others can benefit?

Roger

On Fri, 2 Apr 2004, Clint Bowman wrote:

> Roger,
>
> Thanks for your reference.  Since I can get the polygon coordinates (and
> have the coordinates of my sites, I can cobble together a function that
> will do the trick.
>
> Again, thanks,
>
> Clint
>
> On Fri, 2 Apr 2004, Roger Bivand wrote:
>
> > 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



Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: [R] Winding Number

Tim Keitt
In reply to this post by Clint Bowman
Members of this list may be interested in
http://www.vividsolutions.com/jts/jtshome.htm. There is a C++ port asw
well by the postgis folks.

Tim

On Fri, 2004-04-02 at 12:29, Clint Bowman wrote:

> Roger,
>
> Thanks for your reference.  Since I can get the polygon coordinates (and
> have the coordinates of my sites, I can cobble together a function that
> will do the trick.
>
> Again, thanks,
>
> Clint
>
> On Fri, 2 Apr 2004, Roger Bivand wrote:
>
> > 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
> > >
> > >
> >
> >
--
Timothy H. Keitt
Section of Integrative Biology
University of Texas at Austin
http://www.keittlab.org/