<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Paul,<br>it may not help to attach the data dump to the bug report, because I created a small table dump with 3 of the offending district polygons, loaded it myself, but the mapserver and ST_Within problems did not occur.  That's probably a good clue, that the new table got built with different index state because fewer records, record order, whatever.<br><br>Robert<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>Er, open an issue and attach the relevant supporting files. The<br><pre>smaller the test table, the better.<br><br>P<br><br>On Wed, Mar 11, 2009 at 2:04 PM, Paul Ramsey <pramsey@opengeo.org> wrote:<br>> If you can provide<br>><br>> - a data table dump and<br>> - a SQL query that returns different results depending on whether<br>> _ST_Within() or ST_Within() is
 used<br>><br>> that's enough to debug with. Open an issue in the tracker.<br>><br>> P.<br>><br>> Turn on statement logging in PostgreSQL, then run the Mapserver<br>> request that causes the<br>><br>> On Wed, Mar 11, 2009 at 1:54 PM, Robert Hollingsworth<br><reh2@prodigy.net> wrote:<br>>> using postgresql 8.3.4<br>>> using postgis 1.3.3<br>>> using geos 3.0.0<br>>> using proj 4.6.1<br>>><br>>> I'm encountering a couple of oddities which I'm pretty sure<br>are related.<br>>><br>>> I have US Census Congressional districts modeled in PostGIS.<br>>><br>>> I've got a simple php program that uses ST_Within( ) to check a<br>lat,lon<br>>> against the congressional district polygons.  A small number of the<br>>> districts are causing the query to return zero records incorrectly.<br>>><br>>> I've also got a simple php-mapscript with a LAYER to
 simply<br>display all of<br>>> these congressional districts.  When zoomed out around 1:400k and<br>further<br>>> out, these peculiar districts appear along side their neighbors. <br>When I<br>>> zoom in closer, these same districts stop appearing.<br>>><br>>> I'm pretty sure this is a problem with the spatial indexes, which<br>were<br>>> created by shp2pgsql, because I converted the search program from<br>ST_Within(<br>>> ) to _ST_Within( ), which is advertised as skipping the indexing.<br>>> _ST_Within( ) is a bit slower, but finds these districts ok.<br>>><br>>> I've run VACUUM ANALYZE on the table, but this hasn't changed<br>anything.<br>>><br>>> I haven't dug into the mapserver pg driver to see if there is any<br>way for me<br>>> to manipulate the generated query into skipping indexes.<br>>><br>>> I haven't yet dug into the records further to see if
 they have<br>pathological<br>>> bboxes or similar.<br>>><br>>> There are no holes in these polygons.<br>>><br>>> Anyone have any ideas on this?<br>>><br>>> thanks,<br>>> Robert H.<br>>><br>>> _______________________________________________<br>>> postgis-users mailing list<br>>> postgis-users@postgis.refractions.net<br>>> http://postgis.refractions.net/mailman/listinfo/postgis-users<br>>><br>>><br>><br></pre></blockquote></td></tr></table>