I&#39;m not sure if this is what you are doing, but I have done something similar I think.<br><br>When I want to use the centroid geometry of a polygon, what I do is load the layer into postgis, create a new geometry field called &quot;points_geom&quot; or something like that, and write a stand alone program to find the centroid of each feature, adn insert that geometry into the new geometry field.  I usually use Java since it has a really nice PostGIS object library<br>
<br>Hope this helps<br><br>-Adam<br><br><div class="gmail_quote">On Thu, May 28, 2009 at 11:01 AM, Varun saraf <span dir="ltr">&lt;<a href="mailto:vsaraf.gmu@gmail.com">vsaraf.gmu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I know mapserver uses a point-in-polygon method to find a feature<br>
given a set of co-ordinates, but can it do the same thing reversed?<br>
For example. Each polygon I draw has a number associated with it which<br>
is in a &quot;dbf&quot; file with the same name as the &quot;shp&quot; file that mapserver<br>
uses to draw the polygons. My current map file allows me to fetch that<br>
unique number whenever I pass the co-ordinates of any point inside<br>
that polygon (mapserver uses the point-in-polygon method to fetch me<br>
the polygonID). The query I use is<br>
<br>
<a href="http://127.0.0.1:8123/cgi-bin/mapserv.exe?&amp;map=C:/ms4w/apps/workshop-5.0/testMap.map&amp;mode=query&amp;mapxy=-77.098617" target="_blank">http://127.0.0.1:8123/cgi-bin/mapserv.exe?&amp;map=C:/ms4w/apps/workshop-5.0/testMap.map&amp;mode=query&amp;mapxy=-77.098617</a><br>

38.87795<br>
<br>
where mapxy keeps changing based on the user&#39;s click. The html<br>
template I send just has the variable name [polygonID] which helps me<br>
get the polygon ID of the point I specify in the mapxy variable. Now,<br>
is there a way in which I can send this polygonID to mapserver and get<br>
hold of any point (perhaps the centroid) inside of this polygon? Can<br>
someone point me in the right direction here?<br>
<br>
Thanks a lot.<br>
<br>
-Varun<br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
</blockquote></div><br>