[ka-Map-users] iframe passing extents back to containing page
percy
percyd at pdx.edu
Wed Sep 6 00:41:09 EDT 2006
So, now that we have a way to GET the extents that the user zoomed to,
we'd like to do the opposite!
We'd like to SET the extents of the iframe, based on what the user has
already zoomed to, after they look at their results and then hit the
back button in their browser to refine their search.
I can capture and parse the extents from the bounding box fields using
the window.onload event, but I am trying to figure out the most elegant
way to pass these to the iframe object. I couldn't find a
"setGeoExtents" method. I thought about programmatically poking the
values into the src property of the iframe object, but I worry that I am
setting myself up for some creepy cross-browser DOM issues.
Any ideas on the best approach to this? Here's the beta version we are
using for testing:
http://ngmdb.usgs.gov/ngmdb_work/ngm_compsearch_map.html
Thanks,
Percy
percy wrote:
> Hi Paul, below is the code we ended up using, in case it helps anyone
> else...
> And here's the page it's in for testing:
> http://geospatial.research.pdx.edu/~bjpd/usgs/ngm_quicksearch9.html
>
> Thanks again,
> Percy
>
> -------------------iframe code to dump extents into hidden fields for
> database search----------------
> <iframe id = "geosrchmap" name= "geosrchmap" src =
> "http://geospatial.research.pdx.edu/~bjpd/kamap-cvs/htdocs/iframe.html"
> width = "100%" height = "400">
> </iframe>
> <input name = "showextents" value ="Use This Extent" type = "button"
> onclick = "storeExtents()">
> <script type = "text/javascript" language = "javascript">
> function storeExtents()
> {
> var myextents =
> document.getElementById('geosrchmap').contentWindow.myKaMap.getGeoExtents()
>
> //alert(myextents)
> document.getElementById('kaminx').value = myextents[0]
> document.getElementById('kaminy').value = myextents[1]
> document.getElementById('kamaxx').value = myextents[2]
> document.getElementById('kamaxy').value = myextents[3]
> }
>
> </script>
> <input id="kaminx" name="kaminx" type = "hidden" value="" >
> <input id="kaminy" name="kaminy" type = "hidden" value="" >
> <input id="kamaxx" name="kamaxx" type = "hidden" value="" >
> <input id="kamaxy" name="kamaxy" type = "hidden" value="" >
> ---------------------------------------------------------------------------------------------------------
>
>
> Paul Spencer wrote:
>> Percy,
>>
>> I'll try to catch you on IRC (pagameba) but in case I don't ...
>>
>> If your iframe is loaded from the same site as your main page, then
>> you are allowed to script between them. Whatever triggers your
>> query, you can do one of the following:
>>
>> 1) from the main page (in response to clicking a button or
>> something), you can call the kaMap object in the frame ...
>>
>> document.getElementById('frameid').contentWindow.myKaMap.getExtents();
>>
>> 2) from the iframe (in response to an event for instance), you can
>> call a function in the parent window ...
>>
>> window.parent.someFunction();
>>
>> Cheers
>>
>> Paul
>>
>> On 31-Jul-06, at 1:19 PM, percy wrote:
>>
>>> I would like to embed a kamap iframe within a database search page and
>>> have it pass back the extent of what the user has zoomed to so that I
>>> can use this in a query to my database.
>>>
>>> the goofy part is that the embedding page is a Perl CGI, so I think
>>> I'm stuck using Perl mapscript to access the iframe's properties.
>>>
>>> any hints on the best way to do this? I'm on the IRC right now...
>>>
>>> thanks,
>>> percy
>>>
>>> PS I searched the mailing list archives already...
>>>
>>> _______________________________________________
>>> ka-Map-users mailing list
>>> ka-Map-users at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/ka-map-users
>>
>> +-----------------------------------------------------------------+
>> |Paul Spencer pspencer at dmsolutions.ca |
>> +-----------------------------------------------------------------+
>> |Applications & Software Development |
>> |DM Solutions Group Inc http://www.dmsolutions.ca/|
>> +-----------------------------------------------------------------+
>>
>>
>>
>>
>>
>
More information about the ka-Map-users
mailing list