Slow-vs-fast I can understand... the spatial index can more effectively parcel out the problem for processing when the units of processing are smaller.
Wrong-vs-right I have a problem with. Are your multi-polygons valid? Run ST_IsValid() on them. It's possible that they are valid taken separately but invalid when combined (multipolygons are not allowed to have overlapping components). Paul On Tue, Jun 2, 2009 at 11:05 AM, sgrocho2 <[email protected]> wrote: > > I am having trouble querying a multipolygon feature intersection with another > multipolygon feature. When I execute the query it takes 45 seconds and > returns and incomplete answer, 167 rows. If I explode the parcel polygon > into its 6 parts and then run the same query it takes 5 seconds and returns > 209 rows which is the correct answer. Is there a way to write this query to > return the all the rows without having to first manipulate the data? The > same query works fine in SQL Server but we want to use PostGIS. Below is the > code for each of the Parcel tables they include only one parcel - one with 1 > row, the other with 6 rows. > > THIS IS THE SINGLE FEATURE MULTIPOLYGON CODE: 45sec 167 rows > SELECT DISTINCT g1.objectid As taxpar_id, g1.tax_parcel_num As > parcel_number, g2.objectid As fw_id, g2.wdfw_phs, g2.wdfw_occur_pt, > g2.wdfw_haulout, g2.pc_for_fish, g2.wdfw_fish_dist, g2.pc_oaks, > g2.pc_salmon, g2.wdfw_occur_pl, g2.doh_sf, g2.wdfw_owl, g2.pc_eelgrass, > g2.pc_hydro, g2.wdfw_sasi > FROM loader.single_parcel As g1, > loader.potential_fw_habitat_cons_areas_pg > As g2 > WHERE (g1.tax_parcel_num = '0618161001' AND > ST_Intersects(ST_Buffer(g1.Shape,-1), g2.Shape)) > > THIS IS THE EXPLODED 6 FEATURES CODE: 5sec 209 rows > SELECT DISTINCT g1.objectid As taxpar_id, g1.tax_parcel_num As > parcel_number, g2.objectid As fw_id, g2.wdfw_phs, g2.wdfw_occur_pt, > g2.wdfw_haulout, g2.pc_for_fish, g2.wdfw_fish_dist, g2.pc_oaks, > g2.pc_salmon, g2.wdfw_occur_pl, g2.doh_sf, g2.wdfw_owl, g2.pc_eelgrass, > g2.pc_hydro, g2.wdfw_sasi > FROM loader.multi_parcel As g1, > loader.potential_fw_habitat_cons_areas_pg > As g2 > WHERE (g1.tax_parcel_num = '0618161001' AND > ST_Intersects(ST_Buffer(g1.Shape,-1), g2.Shape)) > > -- > View this message in context: > http://www.nabble.com/query-multipolygon-tp23836573p23836573.html > Sent from the PostGIS - User mailing list archive at Nabble.com. > > _______________________________________________ > postgis-users mailing list > [email protected] > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
