Thanks Robert.

I did something like that with Spatialite for a consulting project last
summer.

I think that I have some reasonable solutions now, I am just trying to
compare the speeds and tune them.  I can fairly easily make ugly, brute
force use of the modules, I hoping to take advantage of the features of the
modules.  It is in trying to figure out those idioms or best practices that
I am struggling.

I am actually replacing a few processes where I load data into PostGIS, do
the queries and write the data back out to a different database, all using
Python as the glue.

My goal is to do it all in Python, unencumbered by proprietary licenses.

David.

On Tue, Mar 26, 2013 at 2:59 PM, Robert Sanson <
[email protected]> wrote:

> One other options might be to load data into Spatialite, and then use
> Python to loop through and execute the queries. I don't know whether
> this would be faster or slower, but the spatial queries should be able
> to handle the different types of geometries.
>
> regards,
>
> Robert
>
> >>> David Fawcett <[email protected]> 27/03/2013 2:30 a.m. >>>
> 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
> python-gis-sig+unsubscribe@**googlegroups.com<
> python-gis-sig%[email protected]>
> >> .
> >> For more options, visit
> <URL:https://groups.google.**com/groups/opt_out<
> https://groups.google.com/groups/opt_out>
> >> >https://**groups.google.com/gro
> <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
> python-gis-sig+unsubscribe@**googlegroups.com<
> python-gis-sig%[email protected]>
> > .
> > For more options, visit
> https://groups.google.com/**groups/opt_out<
> 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.
>
>
>
>
> This email and any attachments are confidential and intended solely for
> the addressee(s). If you are not the intended recipient, please notify us
> immediately and then delete this email from your system.
>
> This message has been scanned for Malware and Viruses by Websense Hosted
> Security.
> www.websense.com
>

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