[Chameleon] querytool and radius
Bart van den Eijnden
bartvde at xs4all.nl
Sun May 15 08:01:35 EDT 2005
Hi list,
I have accomplished the first step of this process. I had some trouble
getting a hang of the ROI API at first, I tried to use the draw method of
the circle object, but I should have just added the circle roi object to
the roi manager in order for it to draw. I am reporting back my solution
to the list as I think this type of functionality is not really suitable
for a general widget.
I followed the process which is described on the Wiki for plugging in your
own query tool. My solution does need the following 2 widgets in the page
(although the ROICircle tool should be invisible, but I am having some
trouble getting it to behave invisible without getting a javascript error
about the cwc_image ...).
Notice that I have set numberofpoints to 0 since I want to draw a direct
opaque circle.
<cwc2 type="ROIManager" mode="normal" />
<cwc2 type="ROICircleTool" visible="true" styleresource="NavButtons"
image="images/icon_roi_ellipse.png" imagetip="Define a circular ROI"
toolset="Navigation" numberofpoints="0">
<image state="normal"/>
<image state="selected"/>
<image state="hover"/>
</cwc2>
Then in the javascript function which is triggered at the ON_QUERY event I
do:
function stragiswebquery( nX, nY )
{
// radius in meters, todo: retrieve from form variable so user can change
iRadiusGeo = 25;
iRadiusPix =
(iRadiusGeo/(goCWCJSAPI.oMap.maxx-goCWCJSAPI.oMap.minx))*gMapWiWidth;
ROICircleToolInitObjects();
ROICircleToolStartZoomBox();
goROICircleObj.centerX = nX;
goROICircleObj.centerY = nY;
goROICircleObj.radius = iRadiusPix;
goCWCROIManager.Add(goROICircleObj);
document.getElementById('TreeFrame').src =
'/stragisweb/stragisquery.phtml?x='+ nX + '&y=' + nY + '&sid='
+ document.forms[0].sid.value;
ShowTreeLayer();
}
In the process I had to fix the following javascript bug in cwc_roi.js:
http://chameleon.maptools.org/bugzilla/show_bug.cgi?id=1032
This draws a circle around the point clicked with the query tool using a
radius of 25 meters. After this I want to pass the radius value to
stragisquery.phtml and set the TOLERANCE of all the layers in the MAP file
to this value using PHP/Mapscript. That should finish the functionality I
want.
Best regards,
Bart
On Fri, 13 May 2005 16:59:17 +0200, Paul Spencer <pspencer at dmsolutions.ca>
wrote:
> Cool!!! I don't think it would take much to get it going ...
>
> Paul
>
> Bart van den Eijnden wrote:
>> Hi Paul,
>> thanks for the reply. I knew about the buffer option in queryByPoint
>> from dealing with Mapserver WFS lately.
>> First I thought this would require changes to be made to the Chameleon
>> core since executePointQuery in map_query.php does not take a
>> radius/buffer argument. But looking a bit further even buffers in
>> meters would be possible without changes to the Chameleon core by
>> setting TOLERANCEITEMS to METERS on the LAYER and a TOLERANCE on the
>> LAYER object using PHP/Mapscript.
>> Maybe I'll try to create this in the next weeks (for local layers).
>> Best regards,
>> Bart
>> Bart van den Eijnden
>> Syncera-ITSolutions
>> Postbus 270
>> 2600 AG DELFT
>> tel.nr.: 015-7512436
>> email: BEN at Syncera-ITSolutions.nl
>>
>>>>> Paul Spencer <pspencer at dmsolutions.ca> 05/13/05 03:50pm >>>
>> Bart,
>> the radius is actually not used except in WMS queries and it is a
>> vendor-specific-extension of WMS used by CubeSERV web servers ... I
>> think there was a plan to add it to MapServer but I don't know if it
>> ever happened. Also, the radius is in pixels, not geographic units.
>> I'm not sure if it is possible to do this out of the box with
>> mapserver queries, but it would be a neat addition to Chameleon. I
>> just checked the php/mapscript docs and it seems that only query by
>> point supports a buffer and it is in pixels. Specifying a buffer in
>> other coordinates would require a conversion to pixels at the current
>> scale with an associated loss of precision
>> The real solution to this will come with GEOS integration.
>> Paul
>> Bart van den Eijnden wrote:
>>
>>> Hi list,
>>>
>>> does Chameleon have functionality for the following? I see there is a
>>> radius attribute for the query tool which can be set by the developer,
>>> but can it be set by the user?
>>>
>>> Can a user specify a radius in meters in an input field, and then when
>>> he clicks in the map, similar DHTML functionality to the ROICircle
>>> tool draws the circle on the map. The query is then performed within
>>> this radius. If he resets the radius, and clicks again in the map, no
>>> circle is drawn.
>>>
>>> If there is no functionality for this, how could it be created best?
>>>
>>> Best regards,
>>> Bart
>>>
>>> Bart van den Eijnden
>>> Syncera-ITSolutions
>>> Postbus 270
>>> 2600 AG DELFT
>>>
>>> tel.nr.: 015-7512436
>>> email: BEN at Syncera-ITSolutions.nl
>>> _______________________________________________
>>> Chameleon mailing list
>>> Chameleon at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the Chameleon
mailing list