-1

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 :)

meewog
  • 1,690
  • 1
  • 22
  • 26

1 Answers1

1

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.

geocodezip
  • 158,664
  • 13
  • 220
  • 245
  • Thanks for the quick reply. Any idea how to format hexa-decimal color codes to octa-decimal? – meewog Mar 05 '13 at 03:34
  • Why do you want to do that? I usually use [this for choosing KML colors](http://www.zonums.com/gmaps/kml_color/) – geocodezip Mar 05 '13 at 06:36
  • It's just that I noticed all the examples I've looked at so far use the octa method of colors, assumed it was the standard to use. – meewog Mar 05 '13 at 06:48
  • What examples? What do you mean by octa method of colors? [KML colors](https://developers.google.com/kml/documentation/kmlreference#color) are "expressed in hexadecimal notation. The range of values for any one color is 0 to 255 (00 to ff). For alpha, 00 is fully transparent and ff is fully opaque. The order of expression is aabbggrr, where aa=alpha (00 to ff); bb=blue (00 to ff); gg=green (00 to ff); rr=red (00 to ff)." – geocodezip Mar 05 '13 at 06:51
  • You seem to be an expert in maps judging by your username and also by your website. Would you mind having a look at one of my KML files and pushing me in the right direction of filling in the polygon please? [my kml file](http://beta.deorigin.net/assets/kl_1.kml) much appreciate your time – meewog Mar 05 '13 at 06:54
  • hexa = 6 octa = 8 There are 8 digits referencing the color code. So the difference is the KML colors have alpa-opacity as the first 2 digits. Thanks for clarification – meewog Mar 05 '13 at 06:59
  • You don't have any [Polygons](https://developers.google.com/kml/documentation/kmlreference#polygon) in your KML, only [LineStrings (Polylines)](https://developers.google.com/kml/documentation/kmlreference#linestring). – geocodezip Mar 05 '13 at 16:56