From: | User Map <map(dot)user(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Fw: Distance w.r.t scalebar and postgre distance query |
Date: | 2008-05-30 07:55:57 |
Message-ID: | 138868.2363.qm@web45707.mail.sp1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
----- Forwarded Message ----
From: User Map <map(dot)user(at)yahoo(dot)com>
To: mapserver-users(at)lists(dot)osgeo(dot)org; mapserver-users(at)lists(dot)osgeo(dot)org
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.
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 165 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Vanderborght | 2008-05-30 08:49:21 | The optimizer is too smart for me - How can I trick it? |
Previous Message | Joe Conway | 2008-05-30 04:46:35 | Re: PL/R download |