Mapext from itemnquerymap?

Mike Street mike at MIKESTREET.CA
Tue Jun 12 00:08:48 EDT 2007


Hi Steve,

Thanks for the reply. I've since changed things around - an itemnquery 
search from the main map_frame, then added a "Map it" link to each 
returned record in the query template that loads the map_frame in browse 
mode and recentres using the specific item's shpmid&scale (points) or 
shpext (lines/polygons). No fancy hilite, but eliminating the Rosa 
SetImageURL function also eliminated another weirdness I was dealing 
with (I can't figure out how to make IE/Opera play nice with it due to 
the "Click to activate" issue - even though my workaround 
*(jactivating*.sourceforge.net/) works admirably with Rosa within the 
main map_frame).

As for #2, it's likely not a bug, just bad coding. :) When I insert the 
onclick=do_something directly into the query template (ie., put the "map 
it" graphic in the query template and link it to load the map_frame), it 
works fine. When I try using an outside js function (ie., onclick= 
"LoadMap()"), it only uses the last record. I'm guessing it's because 
the js function isn't in the <head> (though I barely recall including 
the <head> tags at 3am with no success) :), but I'm now using an inline 
link it's not a problem.

I'm sure smarter guys than me are laughing at reading this. :)

Anyway, thanks again for the help, and after I (cough) actually finish 
plotting the shapes, I'll return to the fancy hilite thing and mucking 
with the JSON.
Mike

Steve Lime wrote:
> For 1) you can't get both an extent and the image using itemnquerymap. The ...map modes return an image stream so there is no way to encode other information. The work around is to use templates and probably AJAX. If you do an itemnquery with the following template:
>
> [img]
> [mapext]
>
> You'll get back the base path to the created image (in the temporary directory) and the extent in one little package. You could muck with the format to return XML or JSON to ease parsing on the client. That's your best bet.
>
> For 2) I'd like to see that behavior. Sounds like a bug to me or possibly a conflict with parameters being passed. If you're using 4.10 you could try the [item...] tag as a work around.
>
> Steve
>
>   
>>>> On 6/8/2007 at 11:59 PM, in message <466A33AA.5090007 at mikestreet.ca>, Mike
>>>>         
> Street <mike at MIKESTREET.CA> wrote:
>   
>> Hi list,
>>
>> First, thanks for all the help. I've taken in as much as a lurker can,
>> and lately the archives have been my best friend and have solved most of
>> my problems. But now I'm stuck on a few things:
>>
>> Specs: MS4W with a 'tricked out' version of the Itasca demo and the Rosa
>> applet for display. First project, so just CGI, HTML templates, and lots
>> of messy javascript. :)
>>
>> Details: A basic browse/query/itemnquery setup to find city info (shp
>> layers - roads, trains, landmarks, etc.). The map displays in a main
>> HTML template frame, the queries display in query frame.
>>
>> For query, I use a javascript call in the query frame for the Rosa
>> SetImageURL function to display the querymap hilited feature in the main
>> frame. (I haven't quite figured out the persistent hilite thing yet, but
>> that's not really an issue for this project).
>>
>> For itemnquery, the user supplies the base of a qstring in a textbox in
>> the mainframe, and the query displays in the query frame. I've then set
>> links to the [Name] field of each layer's query template, which supplies
>> the final qstring for an itemnquerymap call in the query frame to
>> display in the main frame via the Rosa SetImageURL function. (It works
>> well as long as there's only one return - more on this below).
>>
>> So, with that... everything works okay, except:
>>
>> 1. Most of my data are points layers, so I use
>> "scale=10000&mapext=shapes" in the itemnquerymap call to centre on the
>> point, but of course the main frame still 'remembers' its last extent,
>> so I need to reset the mapext (and other stuff) in the
>> parent.map_frame.document, so the user can continue on without interruption.
>>
>> Question 1: How can I find the mapext used in the 'mapext=shapes' thing
>> from the itemnquerymap so I can set the
>> parent.map_frame.document.form.mapext.value?
>>
>> 2. This one is less important, but totally annoys me because I can't
>> understand it. :) Each shp file has 2 fields in common - [Name] and
>> [Link]. When the records are returned via the query/itemnquery queries,
>> I can use the value of the [Link] (i.e. http://whatever.com) to onclick
>> pop a new browser window and load the URL, even if there are multiple
>> records. But when I try the same with the [Name] field (set it as a
>> link, then onclick to call the script to display the itemnquerymap
>> (using the [Name] value as the qstring), the only value for EVERY listed
>> record is that of the last returned record of the itemnquery.
>>
>> Question 2: So what's up with that? :)
>>
>> Sorry for the length. It's probably obvious I lack the correct
>> terminology, so I made up for it with verbosity. :)
>>
>> I'd appreciate any help, and I promise to <!--comment--> your name (and
>> my gratitude) into the live version. :)
>>
>> Cheers, and many thanks in advance,
>> Mike Street
>>
>>
>>
>>
>> _________________________________________________________________
>> Need personalized email and website? Look no further. It's easy
>> with Doteasy $0 Web Hosting! Learn more at www.doteasy.com
>>     
>
>
>
>
>   



_________________________________________________________________
Need personalized email and website? Look no further. It's easy
with Doteasy $0 Web Hosting! Learn more at www.doteasy.com



More information about the mapserver-users mailing list