[ka-Map-users] Re: mapserver query system in kamap

Alessio Di Lorenzo alessio.dilorenzo at gmail.com
Wed Oct 3 12:37:00 EDT 2007


Guys,
now it works. The correct js function is the following


function myQuery( eventID, queryType, coords ) {

    var szLayers = '';
    var layers = myKaMap.getCurrentMap().getQueryableLayers();
    if(layers.length==0) {
     alert("No queryable layers at this scale and extent");
     return;
    }
    for (var i=0;i<layers.length;i++) {
        szLayers = szLayers + "" + layers[i].name;
    }


//    var extent = myKaMap.getGeoExtents();
//    var scale = myKaMap.getCurrentScale();
//    var cMap = myKaMap.getCurrentMap().name;
//    var 
params='map='+cMap+'&q_type='+queryType+'&scale='+scale+'&groups='+szLayers+'&coords='+coords+'&extent='+extent[0]+'|'+extent[1]+'|'+extent[2]+'|'+extent[3];

window.open("/cgi-bin/mapserv?map=/usr/local/apache2/webdomains/gisst/home/mapfiles/majella.map&mode=query&qlayer=" 
+ szLayers + "&mapxy=" + coords[0] + "+" + 
coords[1],'QueryWindow','width=400,height=300');
}


ciao

Alessio


Alessio Di Lorenzo ha scritto:
> My friends,
> I think I understood the problem in querying.
> The cgi needs that the qlayer=layer name parameter is specified in the 
> query!
> So, the following query works fine:
>
> http://www.gisst.eu/cgi-bin/mapserv?map=/usr/local/apache2/webdomains/gisst/home/mapfiles/majella.map&mode=query&mapxy=418570.6073052054+4668411.6457243785&qlayer=Centri%20visita 
>
>
> Now, how can I tell to ka-map to specify the queryable layer by 
> modifing this part of startUp.js code?
>
> window.open("/cgi-bin/mapserv?map=/usr/local/apache2/webdomains/gisst/home/mapfiles/majella.map&mode=query&mapxy=" 
> + coords[0] + "+" + coords[1]);
>
> Consider that I already specified that the layer must be queryable by 
> adding "queryable" "true" in the layer METADATA object.
> The problem is that I cant "lock" the query function in startUp.js by 
> writing the layer name manually because in my applicatione there is 
> more than one queryable layer.
> The layer name value have to be dynamic: ka-map have to pass it to the 
> cgi choosing the layer depending to the mouse click on the map. 
> (...sorry for english!)
>
>
> I hope you can help me!
>
> Alessio
>
>
>
> Alessio Di Lorenzo ha scritto:
>> Hi Brad,
>>
>>> I was just saying that your URL
>>> (http://www.openmaps.it/cgi-bin/mapserv?map=/usr/local/apache2/webdomains/gisst/home/mapfiles/majella.map&mode=query&mapxy=419523.1067908557) 
>>>
>>> only has one coordinate following the mapxy, and it should have two, 
>>> with
>>> a "+" in between (like "...&mapxy=419523+4890111").   That's the 
>>> cause of
>>> the "loadForm(): Web application error. Not enough arguments for mapxy"
>>> error. You may have just accidentally not copied the end of the 
>>> URL.  If
>>> that is the whole URL, though, you're only getting one coordinate.  
>>> Maybe
>>> uncomment that alert in MyQuery and get clear what parameters are 
>>> there.
>>>   
>>
>> Ok, now I understand... it was only a copy/paste error... sorry :-)
>>
>>> Since you mention them, what settings did you put for TOLERANCE and
>>> TOLERANCE UNITS, and are they within your LAYER?  
>>
>> I put TOLERANCE 300 (default unit: pixel) and, yes, I specified them 
>> within the layer
>>
>>> Also make sure your
>>> coordinate systems match.
>>>   
>>
>> Yes, coordinate system mach...
>> I don't understand... it is very strange that the query fails.
>> The result is always
>>
>>
>> msQueryByPoint(): Search returned no results. No matching record(s) 
>> found.
>>
>> Help guys! There's someone in this list that has done something 
>> working using the mapserver html-templates from ka-map?
>>
>>> Just a few more ideas,
>>> Brady
>>>
>>>  
>>>> Message: 4
>>>> Date: Mon, 01 Oct 2007 17:08:30 +0200
>>>> From: Alessio Di Lorenzo <alessio.dilorenzo at gmail.com>
>>>> Subject: Re: [ka-Map-users] Re: mapserver query system in kamap
>>>>     (Alessio Di    Lorenzo)
>>>> To: ka-map-users at lists.maptools.org
>>>> Message-ID: <47010D6E.2080003 at gmail.com>
>>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>>>
>>>> neuhausr at bitstream.net ha scritto:
>>>>   
>>>>> In your URL, you only have one coordinate (x).  Add "+[your y
>>>>> coordinate]"
>>>>> and hopefully that'll work.
>>>>>
>>>>> Brad
>>>>>
>>>>>       
>>>> Hi Brad,
>>>> do you mean that:
>>>>
>>>> [...]mode=query&mapxy="+ coords[0] + "+" + coords[1]);
>>>>
>>>>
>>>> are not the x y coordinates but only the x?
>>>> I don't understand...
>>>> coords[0] and coords[1] are not x and y taken from ka-map and 
>>>> passed to
>>>> the cgi?
>>>>
>>>> Could you write me an example?
>>>> Thank you a lot...
>>>>
>>>> Alessio
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> _______________________________________________
>>>> ka-Map-users mailing list
>>>> ka-Map-users at lists.maptools.org
>>>> http://lists.maptools.org/mailman/listinfo/ka-map-users
>>>>
>>>>
>>>> End of ka-Map-users Digest, Vol 30, Issue 1
>>>> *******************************************
>>>>
>>>>     
>>>
>>>
>>> _______________________________________________
>>> ka-Map-users mailing list
>>> ka-Map-users at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/ka-map-users
>>>
>>>   
>>
>>
>
>



More information about the ka-Map-users mailing list