Search code examples
xmlgoogle-maps-api-3kmlpolygonwikimapia

Adding background color to polygons in KML files


I'm working a on a new project which requires me to extract data from www.wikimapia.com in the form of KML files. I then need to display the said files on google maps. There doesn't seem to be much information on wikimapia on the Internet.

My aim to style the polygons and fill in a CSS equivalent background-color.

At the moment I only have the outline of the boundary showing up.

Thank you very much fellow stackoverflowers :)


Solution

  • The simplest way to style Polygons from KML is to use the KML styling for polygons PolyStyle. That would involve changing the KML.

    Another option would be to import your KML files into FusionTables, and use a FusionTablesLayer to display them on a Google Maps API v3 map. You can style the polygons with the FusionTables User Interface or dynamically using javascript (if you have less than 5 styles)

    More information

    A third option (if your KML is not very complicated would be to use a third party parser like geoxml3 or geoxml-v3 to parse the KML to native Google Maps API v3 objects and style those the normal way with the API.