<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><P>hi,</P>
<P>i have a table with geom type geometry, with srid= 27700 set in the geometry_columns table. i have to calculate total extent of all the records that fall within 50 meters distance from the center of the specified polygon geometry. i have the following query</P>
<P><FONT color=#0000ff>SELECT Extent(geom) as ext, count (*),Max(Distance(geom,GeomFromText('POINT(530525.056494402 191742.597993273)',27700))) as max_dist</FONT></P>
<P><FONT color=#0000ff>FROM tarea</FONT></P>
<P><FONT color=#0000ff>WHERE geom && GeomFromText('POLYGON((530471.6875 191689.796875,530471.6875 191795.25,530578.125 191795.25,530578.125 191689.796875,530471.6875 191689.796875))',27700)</FONT></P>
<P><FONT color=#0000ff>AND Distance(geom, GeomFromText('POINT(530525.056494402 191742.597993273)',27700)) < 50;</FONT></P>
<P>The WHERE clause defines the bounding box i.e 'POLYGON((530471.6875 191689.796875,530471.6875 191795.25,530578.125 191795.25,530578.125 191689.796875,530471.6875 191689.796875))' </P>
<P>is get from the query</P>
<P><FONT color=#0000ff>select AsText(extent(expand(geom,50)))</FONT></P>
<P><FONT color=#0000ff>from tarea</FONT></P>
<P><FONT color=#0000ff>where id='*************';</FONT></P>
<P>the query results are</P>
<P><FONT color=#0000ff>extent---------------------------------------------------------------------- count----max_dist </FONT></P>
<P><FONT color=#0000ff>"BOX(530391.5625 191411.546875,530669.0625 192058.203125)"; 129; 49.4921047760564</FONT></P>
<P>the time problem is solved, now this query is quick enough. But a new problem is of the scalebar. the extent returned by the above query when set in the mapfile to generate map and scalebar, the area shownin the map is much bigger then what is suspected i.e 100 meters, 50 meters on each side as specified in the above query. The scalebar shows the scale of 800 meters. </P>
<P>Do anyone knows whats happening here. Is the calculation of the scalebar and the postgre statement differ in some respect. i have the following scalebar properties set in the mapfile.</P>
<P> </P><FONT face="Courier New" size=2>
<P><FONT color=#0000ff>SCALEBAR</FONT></P>
<P><FONT color=#0000ff>IMAGECOLOR 255 255 255</FONT></P>
<P><FONT color=#0000ff>LABEL</FONT></P>
<P><FONT color=#0000ff>ANGLE auto</FONT></P>
<P><FONT color=#0000ff>SIZE 8</FONT></P>
<P><FONT color=#0000ff>OFFSET 0 0</FONT></P>
<P><FONT color=#0000ff>COLOR 0 0 0</FONT></P>
<P><FONT color=#0000ff>TYPE TRUETYPE</FONT></P>
<P><FONT color=#0000ff>MINDISTANCE 100</FONT></P>
<P><FONT color=#0000ff>FONT arial</FONT></P>
<P><FONT color=#0000ff>BUFFER 4</FONT></P>
<P><FONT color=#0000ff>END</FONT></P>
<P><FONT color=#0000ff>STYLE 0</FONT></P>
<P><FONT color=#0000ff>SIZE 1540 10</FONT></P>
<P><FONT color=#0000ff>OUTLINECOLOR 0 0 0</FONT></P>
<P><FONT color=#0000ff>UNITS METERS</FONT></P>
<P><FONT color=#0000ff>INTERVALS 16</FONT></P>
<P><FONT color=#0000ff>TRANSPARENT FALSE</FONT></P>
<P><FONT color=#0000ff>STATUS ON</FONT></P>
<P><FONT color=#0000ff>END # Scalebar object ends</FONT></P>
<P>My map size is set to:</P>
<P><FONT color=#0000ff>SIZE 1540 1200</FONT></P>
<P> </P>
<P>any help will be appreciated. thanks</P>
<P>waiting for response soon.</P>
<P> </P></FONT>
<P> </P><FONT face=Arial size=2>
<P> </P></FONT></div><br>
</body></html>