NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi,

I have downloaded a Shape file from naturalearthdata.com and converted this shape file to KML file using QGIS tool.

I want to render my maps using OSM API and this KML file.and vary the color for each of the state from the KML file

Can any one guide me to achieve this functionality?

Thank you !!

asked 16 Nov '11, 13:21

VenuGopal's gravatar image

VenuGopal
16899
accept rate: 0%


The "OpenStreetMap API" generally refers to the API for editing software. That's something different from what you're after. You can display KML as an overlay on a slippy map (which may be showing OpenStreetMap as a baselayer) Some information about doing that is linked from the KML page on the wiki.

However you may have a problem that the KML file you have created is gigantic and will fail to load in the browser (I dont know if that will be a problem, it's just a hunch based on your description) A sensible sanity check might be to try loading it with google earth first of all, before trying a web overlay.

"color for each of the states" could be achieved within the KML definitions. Perhaps QGIS doesn't give you that flexibility with its KML output (anyone know?). You may be able to achieve this by fiddling with the XML file by hand.

permanent link

answered 16 Nov '11, 16:19

Harry%20Wood's gravatar image

Harry Wood
9.5k2588128
accept rate: 14%

Hi Harry, Thanks a lot for your reply,I am able to load the data from KML file as an overlay. However the polygons defined in the KML file,has a color and I am not getting any color updated over them,I am always getting a default color loaded on to them.

I am not sure How can we make a change,so that it would change the color for that polygon.

Please let me know if you come across this scenario like this.

(17 Nov '11, 09:51) VenuGopal

Have you tried editing the KML file directly?

(17 Nov '11, 11:40) SomeoneElse ♦

Yes,I tried that and modified the KML file as below I kept like this under PlaceMark element and also,I tried with fill and outlibne elements.Still noluck :( <style> <polystyle> <color>44ff0000</color> </polystyle> </style>

Even editing the KML file that did not solved my problem and I gone through few of the forums and they suggested that KML file might have been cached and they want to append "?123" at the end of the KML file URL in Javascript.

I tried that as well,still no luck

Please let me know if you come across any situation

(17 Nov '11, 12:29) VenuGopal

Interesting thing is ,when I loaded the KML file in the QGis Tool,I am able to see the color for that state,but when I am using with OSM API,I always see the default color(Orange)

(18 Nov '11, 11:30) VenuGopal

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×49

question asked: 16 Nov '11, 13:21

question was seen: 15,738 times

last updated: 18 Nov '11, 14:19

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum