[ka-Map-users] customizing ka-map

Alessio Di Lorenzo alessio.dilorenzo at gmail.com
Tue Aug 7 12:19:33 EDT 2007


Hi, by reading this link

http://www.ominiverdi.org/ka-map/ka-map/presentations/foss4g2006/foss4g2006.html

I get something working, but I still have problems when I try to add 
functionalities.

For example, if I want to add the legend I have to:

 * 1) add a script tag to your page:
 *
 * <script type="text/javascript" src="kaLegend.js"></script>
 *
 * 2) add a <div> element to your page to contain the legend.  The div must
 *    have a unique id:
 *
 * <div id="legend"></div>
 *
 * 3) create a new instance of kaLegend and pass it the id of the div:
 *
 * myKaLegend = new kaLegend( 'legend' );
 *
 * and that's it :)

(taken from the kaLegend.js file)

It seems so simple! I did it... but in my case it doesn't work... why?

The error generated when I load my sample interface is:

Error: this.kaMap.getRawObject is not a function
Source file: http://localhost/luoghidabruzzo/ka-map/htdocs/kaLegend.js
Row: 72

The map div (with the map inside) is the only thing visible...

There's my code:

<html>
    <head>
        <title>Customizing Ka-Map!</title>
 
        <script type="text/javascript" 
src="http://localhost/luoghidabruzzo/ka-map/htdocs/xhr.js"></script>
        <script type="text/javascript" 
src="http://localhost/luoghidabruzzo/ka-map/htdocs/kaMap.js"></script>
        <script type="text/javascript" 
src="http://localhost/luoghidabruzzo/ka-map/htdocs/kaTool.js"></script>
        <script type="text/javascript" 
src="http://localhost/luoghidabruzzo/ka-map/htdocs/kaLegend.js"></script>
       
        <script type="text/javascript">
                var myKaMap;
                var myKaNav; 
                                                
                function myOnLoad() {
                    myKaMap = new kaMap( 'mapDiv' );
                    myKaMap.server = 
'http://localhost/luoghidabruzzo/ka-map/htdocs/';
                    myKaMap.initialize();
 
                    myNav = new kaNavigator ( myKaMap );
                    myNav.activate ();
                 
                    myKaLegend = new kaLegend( 'legend' );
                  
                }
                
                </script>
     
    </head>
    <body onload="myOnLoad();">
         
                    <div id="mapDiv">
                    </div>
       
                    <div id="legend">
                    </div>
 
    </body>
</html>
 
<style type="text/css">
    #mapDiv {
        position: relative;
        width: 640px;
        height: 480px;
        background-color:  white;
        border: 1px solid black;
    }
</style>



I hope you have any suggestions!
thaks to all,

Alessio




Alessio Di Lorenzo ha scritto:
> Samuel Hiatt ha scritto:
>> Hi there!
> Hi Sam
>>
>> I am glad that my tutorial could be of help.
>> I've not had experience working with adding objects to the basic 
>> iframe interface, but I think it will be somewhat simple.  When I get 
>> a chance I'll try to do exactly what you requested and then write up 
>> the steps to do so as an addition to the wiki tutorial. 
> Thanks!
>>
>> If in the meantime you get it working, could you send me a quick 
>> outline of what you had to do?
> Sure!
>
>>
>>
>> I think it'd be great to continue solving simple tasks like this and 
>> then documenting them on the wiki to continue to expand the 
>> tutorial.  Does anyone else have any other ideas/requests?
>>
>> Sam
>>
>>
>>
>> On 8/3/07, *Alessio Di Lorenzo* <alessio.dilorenzo at gmail.com 
>> <mailto:alessio.dilorenzo at gmail.com>> wrote:
>>
>>     Hi Sam,
>>     first of all thank you for the answer and for your tutorial.
>>     I read it and now I can understand better what every single part
>>     of the
>>     code does.
>>
>>     However, I had not success to add other functions in my basic ka-map
>>     interface (iframe).
>>     I don't understand how to insert, for example, the legend at the
>>     side of
>>     the iframe or the scalebar.
>>
>>     By reading the api reference it seems quite simple, but it doesn't
>>     work
>>     (my error for sure...).
>>
>>     Have you (or anyone in the mailing list) any idea or example of good
>>     working code to obtain this result?
>>
>>     thank you
>>
>>     Alessio
>>
>>
>>
>>     Samuel Hiatt ha scritto:
>>     > Hi!
>>     >
>>     > I am about 1/2 way through writing up a tutorial that will 
>> likely be
>>     > of interest to you.  I am not dealing with the iframe.html, but I
>>     > believe that my tutorial will help you figure out how to add the
>>     tools
>>     > you need to your page.
>>     >
>>     > Take a look at the wiki, at "Customizing the ka-map interface"
>>     and let
>>     > me know what you think.  If you have further questions or if I
>>     need to
>>     > clarify my tutorial please let me know.
>>     >
>>     > Sam
>>     >
>>     >
>>     >
>>     >
>>     > On 8/1/07, *Alessio Di Lorenzo* <alessio.dilorenzo at gmail.com
>>     <mailto:alessio.dilorenzo at gmail.com>
>>     > <mailto: alessio.dilorenzo at gmail.com
>>     <mailto:alessio.dilorenzo at gmail.com>>> wrote:
>>     >
>>     >     Hi all,
>>     >     In this days I'm trying to customize the ka-map minimal
>>     interface
>>     >     (iframe.html) by adding more functions (rubber zoom, query,
>>     >     keymap, turn
>>     >     on/off layers).
>>     >     There's some example of code over the web that I can study?
>>     >
>>     >     My purpouse is to embed the viewer in a web page and add the
>>     functions
>>     >     at the side of the viewer iframe.
>>     >     Thank you very much,
>>     >
>>     >     Alessio
>>     >     _______________________________________________
>>     >     ka-Map-users mailing list
>>     >     ka-Map-users at lists.maptools.org
>>     <mailto:ka-Map-users at lists.maptools.org>
>>     >     <mailto:ka-Map-users at lists.maptools.org
>>     <mailto:ka-Map-users at lists.maptools.org>>
>>     >     http://lists.maptools.org/mailman/listinfo/ka-map-users
>>     >
>>     >
>>
>>     _______________________________________________
>>     ka-Map-users mailing list
>>     ka-Map-users at lists.maptools.org
>>     <mailto:ka-Map-users at lists.maptools.org>
>>     http://lists.maptools.org/mailman/listinfo/ka-map-users
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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