Hi Nicklas<br><br>sr for the mistake  ...  field but it <b>was not</b> improve the perofrmance for ST_intersect<br><br>Cheers<br><br><div class="gmail_quote">On Tue, May 25, 2010 at 3:53 PM, nguyen liem <span dir="ltr"><<a href="mailto:liemnguyendl@gmail.com">liemnguyendl@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Nicklas<br><br>my dataset about 100.000 rows and after run my query i get about 15.000 rows. I has created index for "geom" field but it was improve the perofrmance for ST_intersect<br>
<br>I used SRID 4326, but I don't know how to convert from degree to meter.<br>
<br>Cheers<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Tue, May 25, 2010 at 3:43 PM, Nicklas Avén <span dir="ltr"><<a href="mailto:nicklas.aven@jordogskog.no" target="_blank">nicklas.aven@jordogskog.no</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">



<div>Ok<br>
        <br>
        The distance of 0.00001 degree in east west direction will vary depending on how far from the equator you are.<br>
        <br>
        How many points is there in your dataset?<br>
        <br>
        Do you see if the index is used?<br><font color="#888888">
        <br>
        /Nicklas</font><div><div></div><div><br>
        <br>
         2010-05-25 nguyen liem  wrote:<br>
        <br>
        Hi Nicklas<br>
        ><br>
        >Actually the points can be outside the polygon and returning true but it can be tolerance about 1 meters outside.<br>
        >I'm using SRID: 4326. I would like to know 0.00001 with the projection 4326 is equal 1 meter or not ?<br>
        ><br>
        >I used ST_Intersects (geom, geometry); but it's really slow, I don't know why.<br>
        >I also used ST_Dwithin (geom, <span style="font-weight: bold;">geometry</span>, <span style="font-weight: bold;">0</span>) and the result is empty, i couldn't found any neighbour.<br>
        ><br>
        >Cheers<br>
        ><br>
        >>
        </div></div><div><div><div></div><div>On Tue, May 25, 2010 at 3:22 PM, Nicklas Avén <<a>nicklas.aven@jordogskog.no</a>> wrote:<br>
                >



>
                <div>Hallo<br>
                        ><br>
                        >
        What you are doing with ST_Dwithin is to check if your geom and geometry have parts closer to (or exactly) 0.00001 mapunits from eachother. If you are using a meter based SRID then you are checking if they are within 0.00001 meters from eachother. So actually in this case your points can be just outside the polygon and returning true. If you want to use st_dwithin you should use 0 instead of 0.00001 . But I don't think that is any faster than ST_Intersects. The important thing in both cases is to have working spatial indexes. <br>


                        ><br>
                        >
        put an index on geom column in my_neighbour table and analyze the table.<br>
                        ><br>
                        >
        Create index idx_mn_geom <br>
                        >
        on my_neighbour<br>
                        >
        using gist(geom);<br>
                        >
        analyse my_neighbour;<br>
                        ><br>
                        >
        Then try:>
                        <div><br>
                                >
        SELECT id, geom<br>
                                >
        FROM my_neighbour<br>
                                ></div>
        WHERE ST_Intersects (geom, geometry);<br>
                        ><br>
                        >
        I guess that is the best solution.<br>
                        ><br>
                        >
        Hope that helps<br>
                        ><br>
                        >
        Nicklas>
                        <div><br>
                                ><br>
                                >
         2010-05-25 nguyen liem  wrote:<br>
                                ><br>
                                >
        Hi all<br>
                                >
        ><br>
                                >
        >At the first time i used ST_Contains but it take a long time, so I used ST_Dwithin to improve the performance for the query statement but i don't know it is correct or not.<br>
                                >
        >I would like to know my points are within in polygon or not:<br>
                                >
        ><br>
                                >
        >SELECT id, geom<br>
                                >
        >FROM my_neighbour<br>
                                >
        >WHERE ST_Dwithin (geom, <span style="font-weight: bold;">geometry</span>, <span style="font-weight: bold;">0.00001</span>)<br>
                                >
        ><br>
                                >
        ><span style="font-weight: bold;">geometry:</span> is a polygon(input parameter).<br>
                                >
        ><span style="font-weight: bold;">0.00001:</span> I means the radius of <span style="font-weight: bold;">geometry</span> is 1 meters, is it right?<br>
                                >
        ><br>
                                >
        ><br>
                                >
        >Cheers.<br>
                                >
        ><br>
                                >
        >-- <br>
                                >
        >Liem Nguyen<br>
                                >
        >Developer<br>
                                >
        >Axon Active Corp.<br>
                                >
        >----------------------------------------------------------------------------<br>
                                >
        >Direct Line      : +84 38 948 4645<br>
                                >
        >Fax                  : +84 38 811 3489<br>
                                >
        >
Mobile Phone  : +84 168 994 8897<br>
                                >
        >Skype ID         : liemnguyendl2204<br>
                                >
        >Email               : <a>liem.nguyen@axonactive.net</a> / <a>liemnguyendl@gmail.com</a><br>
                                ></div>
        >
Web Site          : <a href="http://axonactive.vn" target="_blank">axonactive.vn</a>>
                        <div><br>
                                >
        >Address           : 87 Thang Long Street,Gate 2 Ward 4,<br>
                                >
        >                          Tan Binh District, HCM city, Vietnam.<br>
                                >
        ><br>
                                >
        >

</div></div>

<br>
                >_______________________________________________<br>
                >
postgis-users mailing list<br>
                ><a>postgis-users@postgis.refractions.net</a><br></div></div><div>
                ><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
                ><br>
                ></div></div><div><br>
        ><br>
        ><br>
        >-- <br>
        >Liem Nguyen<br>
        >Developer<br>
        >Axon Active Corp.<br>
        >----------------------------------------------------------------------------<br>
        >Direct Line      : +84 38 948 4645<br>
        >
Fax                  : +84 38 811 3489<br>
        >Mobile Phone  : +84 168 994 8897<br>
        >Skype ID         : liemnguyendl2204<br>
        >Email               : <a>liem.nguyen@axonactive.net</a> / <a>liemnguyendl@gmail.com</a><br></div><div>
        >
Web Site          : <a href="http://axonactive.vn" target="_blank">axonactive.vn</a><br>
        >Address           : 87 Thang Long Street,Gate 2 Ward 4,<br>
        >                          Tan Binh District, HCM city, Vietnam.<br>
        ><br>
        >

</div></div>

<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
</div></div><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><div class="im"><br><br clear="all"><br>-- <br>Liem Nguyen<br>Developer<br>Axon Active Corp.<br>----------------------------------------------------------------------------<br>Direct Line      : +84 38 948 4645<br>

Fax                  : +84 38 811 3489<br>Mobile Phone  : +84 168 994 8897<br>Skype ID         : liemnguyendl2204<br>Email               : <a href="mailto:liem.nguyen@axonactive.net" target="_blank">liem.nguyen@axonactive.net</a> / <a href="mailto:liemnguyendl@gmail.com" target="_blank">liemnguyendl@gmail.com</a><br>
</div>
Web Site          : <a href="http://axonactive.vn" target="_blank">http://axonactive.vn</a><div><div></div><div class="h5"><br>Address           : 87 Thang Long Street,Gate 2 Ward 4,<br>                          Tan Binh District, HCM city, Vietnam.<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Liem Nguyen<br>Developer<br>Axon Active Corp.<br>----------------------------------------------------------------------------<br>Direct Line      : +84 38 948 4645<br>
Fax                  : +84 38 811 3489<br>Mobile Phone  : +84 168 994 8897<br>Skype ID         : liemnguyendl2204<br>Email               : <a href="mailto:liem.nguyen@axonactive.net">liem.nguyen@axonactive.net</a> / <a href="mailto:liemnguyendl@gmail.com">liemnguyendl@gmail.com</a><br>
Web Site          : <a href="http://axonactive.vn">http://axonactive.vn</a><br>Address           : 87 Thang Long Street,Gate 2 Ward 4,<br>                          Tan Binh District, HCM city, Vietnam.<br><br>