kml color

48 views
Skip to first unread message

JoseJe

unread,
Nov 29, 2012, 6:40:34 PM11/29/12
to timemap-d...@googlegroups.com
How to add the KML color to the timemap?

Hi! I would like to do a kml timemap but taking the color of my kml, like it happens in Google Earth. Someone can help me? I dont want to add the custom themes.
Thanks.

The KML code (only first placemark):
<Placemark id="kml_132">
<name>NORUEGA</name>
<snippet> </snippet>
<description>...
</description>
<TimeStamp>
<when>2008</when>
</TimeStamp>
<Style>
<IconStyle>
<scale>0.8</scale>
</IconStyle>
<LabelStyle>
<scale>1.0</scale>
</LabelStyle>
<LineStyle>
<color>fffff2f2</color>
<width>1.0</width>
<gx:labelVisibility>1</gx:labelVisibility>
</LineStyle>
<PolyStyle>
<color>bffff2f2</color>
</PolyStyle>
</Style>
<ExtendedData>...
</ExtendedData>
<MultiGeometry>
<MultiGeometry>
<Polygon>
<outerBoundaryIs>...
....


The TimeMapJS code:

$(function () {       

             
 
    tm = TimeMap.init({
        mapId: "mapa",               // Id of map div element (required)
        timelineId: "timeline",     // Id of timeline div element (required)
        options: {
           
            mapZoom: 3,
            mapType: "physic",
            mapCenter: coordenadas
        },
        datasets: [
            {
                id: "SSS_T",
                title: "SSS",
                theme: "theme",
                // note that the lines below are now the preferred syntax
                type: "kml",
                options: {
            url:"Hinterland_main2.kml",

            extendedData: ["ID".....]
           
                }
            }
        ],
        bandInfo:..........



Nick Rabinowitz

unread,
Dec 1, 2012, 1:18:24 AM12/1/12
to famio...@msn.com, Timemap.js Development
There's no built-in support for KML color and style definitions. But you should be able to do this fairly easily. You can use the extraTags parameter in the options object for the KML loader to tell TimeMap to load additional tags it would otherwise ignore into the options object for each item, and you can use the tagMap parameter to map these tags to other keys, including those used in themes. So something like:

datasets: [
    {
        type: "kml",
        options: {
            // load the color tag into item.opts
            extraTags: ['color'],
            tagMap: {
                // map to a TimeMapTheme key
                'color': 'fillColor'
            }
            // etc
        },
        // etc
    }
],

should work pretty well. See http://code.google.com/p/timemap/source/browse/trunk/tests/geoRSSTests.js for an example of this syntax at work.The one thing I'm not sure about is how to distinguish between LineStyle.color and PolyStyle.color - my guess would be to try 'LineStyle > color', as TimeMap.js generally uses jQuery under the hood and that would be the appropriate selector.

-Nick








--
You received this message because you are subscribed to the Google Groups "Timemap.js Development" group.
To view this discussion on the web visit https://groups.google.com/d/msg/timemap-development/-/XX_FRBVR2fkJ.
To post to this group, send email to timemap-d...@googlegroups.com.
To unsubscribe from this group, send email to timemap-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/timemap-development?hl=en.

JoseJe

unread,
Dec 1, 2012, 11:46:37 AM12/1/12
to timemap-d...@googlegroups.com

Thank you very much Nick! You have been very useful your help!
One question: The center placemarks for polygons, could I delete them? I only like to see the polygons:

Nick Rabinowitz

unread,
Dec 1, 2012, 2:00:57 PM12/1/12
to famio...@msn.com, timemap-d...@googlegroups.com
Do you have a Point element in your placemarks? Timemap.js doesn't put in a marker by default, so I think this must be in your data.

-Nick
--
You received this message because you are subscribed to the Google Groups "Timemap.js Development" group.

JoseJe

unread,
Dec 3, 2012, 3:16:36 AM12/3/12
to timemap-d...@googlegroups.com
Thank you very much Nick!
Now I'm worked in resolve the mistakes.
José


El viernes, 30 de noviembre de 2012 00:40:34 UTC+1, JoseJe escribió:
Reply all
Reply to author
Forward
0 new messages