----- Forwarded Message ----
From: User Map <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, May 27, 2008 10:07:12 AM
Subject: [mapserver-users] Distance w.r.t scalebar and postgre distance query
hi,
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
SELECT Extent(geom) as ext, count
(*),Max(Distance(geom,GeomFromText('POINT(530525.056494402
191742.597993273)',27700))) as max_dist
FROM tarea
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)
AND Distance(geom, GeomFromText('POINT(530525.056494402
191742.597993273)',27700)) < 50;
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))'
is get from the query
select AsText(extent(expand(geom,50)))
from tarea
where id='*************';
the query results are
extent----------------------------------------------------------------------
count----max_dist
"BOX(530391.5625 191411.546875,530669.0625 192058.203125)"; 129;
49.4921047760564
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.
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.
SCALEBAR
IMAGECOLOR 255 255 255
LABEL
ANGLE auto
SIZE 8
OFFSET 0 0
COLOR 0 0 0
TYPE TRUETYPE
MINDISTANCE 100
FONT arial
BUFFER 4
END
STYLE 0
SIZE 1540 10
OUTLINECOLOR 0 0 0
UNITS METERS
INTERVALS 16
TRANSPARENT FALSE
STATUS ON
END # Scalebar object ends
My map size is set to:
SIZE 1540 1200
any help will be appreciated. thanks
waiting for response soon.
_______________________________________________
mapserver-users mailing list
[EMAIL PROTECTED]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
--
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general