Thanks Sean,

Will do.  You might want to add something at
http://toblerity.github.com/shapely/project.html (under support) too.

I will finish this thread over on the other list.

David.

On Tue, Mar 26, 2013 at 1:16 PM, Sean Gillies <[email protected]>wrote:

> David, Esteban,
>
> I think the best place for this discussion is the list mentioned in
> Shapely's README
>
>   https://pypi.python.org/pypi/Shapely#support
>
> which I'll add to Fiona's.
>
> The fiona.open() function doesn't read anything until you iterate over
> it, so there's very little overhead for throwaway point collections.
> And if the shapefile has an index along with it, you can take
> advantage of Collection.filter(bbox=...).
>
> On Tue, Mar 26, 2013 at 6:30 AM, David Fawcett <[email protected]>
> wrote:
> > Thank you Esteban.
> >
> > Using a list or a list of dicts for the points makes sense.  I am
> thinking
> > that I would then need to create each point geometry on the fly as I
> loop.
> > I will test this out.
> >
> > In this case, one of the feature collections has a geometry type of pont,
> > but in other cases that I have, it is line or polygon.  I am hoping to
> > figure out a solution that can efficiently work for all of these cases.
> >
> > My goal is really to leverage Shapely and get the most simplicity and
> > efficiency that I can.  If I can use existing shapely/fiona data
> structures,
> > I would like to.
> >
> > I haven't been able to find any examples that fit this case very well.  I
> > can promise a pull request with an example.
> >
> > Thanks,
> >
> > David.
> >
> >
> > On Mon, Mar 25, 2013 at 5:14 PM, Esteban Munoz <[email protected]>
> wrote:
> >>
> >> Hi David,
> >>
> >> try creating a list first:
> >>
> >> for country in list(countryCollect):
> >>
> >> then when you have found the station you may want to delete that station
> >> from the loaded data. Normally you would do that with the remove
> command:
> >> stationCollect.remove(station). Unfortunatlly that works only with list
> data
> >> formats...
> >>
> >> Cheers,
> >> Esteban
> >>
> >> David Fawcett writes:
> >>
> >>> « HTML content follows »
> >>>
> >>> I am working through a couple of iterations of examples using Shapely
> do
> >>> point in poly intersects.  I plan to add prepared geometries and rtree
> in
> >>> future examples, but I am starting with the basics.
> >>> I have county polys and station points.  I am using fiona to open up
> the
> >>> shapefiles and create collections.
> >>> My outer loop goes through the counties and the inner loop goes through
> >>> each station, testing whether the station intersects() the county.
> >>> It appears as though I need to reset or recreate the station collection
> >>> between each outer loop iteration.  It seems inefficient to reload the
> >>> collection from disk each time, but I don't see a .reset() method or
> >>> anything like that.
> >>> What is the best way to implement this?  In the below example, I only
> get
> >>> a list of station xy's in the first iteration of the outer loop.
> >>>
> >>> Thanks,
> >>> David.
> >>>
> >>> stationCollect = fiona.open(stationPath,'r')
> >>> countyCollect = fiona.open(countyPath,'r')
> >>>
> >>> for county in countyCollect:
> >>>     countyGeom = shape(county['geometry'])
> >>>
> >>>     for station in stationCollect:
> >>>         stationGeom = shape(station['geometry'])
> >>>         print stationGeom.x, stationGeom.y
> >>>                 if stationGeom.intersects(countyGeom):
> >>>             print station['properties']['SYS_LOC_CO']
> >>>             print county['properties']['COUNTYNAME']
> >>>
> >>> countyCollect.close()
> >>> stationCollect.close()
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "Unofficial Python GIS SIG" group.
> >>> To unsubscribe from this group and stop receiving emails from it, send
> an
> >>> email to [email protected].
> >>> For more options, visit
> >>> <URL:https://groups.google.com/groups/opt_out>
> https://groups.google.com/gro
> >>> ups/opt_out.
> >>>
> >>>
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Unofficial Python GIS SIG" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to [email protected].
> >> For more options, visit https://groups.google.com/groups/opt_out.
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Unofficial Python GIS SIG" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
>
> --
> Sean Gillies
>
> --
> You received this message because you are subscribed to the Google Groups
> "Unofficial Python GIS SIG" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Unofficial Python GIS SIG" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to