Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a kml and shp I would like to convert to an xml to use with geoxml3. How would I go about doing such a thing? the xml I gen should look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"     xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Districts</name>
<Style>
    <ListStyle>
        <listItemType>checkHideChildren</listItemType>
        <bgColor>00ffffff</bgColor>
        <maxSnippetLines>2</maxSnippetLines>
    </ListStyle>
</Style>
<Style id="trb655">
    <BalloonStyle>
        <text><![CDATA[<font font size='3' color="#aa0000"><b>$[name]</b></font>
              <table border='1' padding='1'>$[description]</table>                  
              <br><a href='http://shape2earth.com'><b>Shape2Earth</b></a>]]></text>
    </BalloonStyle>
    <LineStyle>
        <color>ff84685b</color>
    </LineStyle>
    <PolyStyle>
        <color>ff13e69b</color>
    </PolyStyle>
</Style>
<Style id="trb71">
    <BalloonStyle>
        <text><![CDATA[<font font size='3' color="#aa0000"><b>$[name]</b></font>
              <table border='1' padding='1'>$[description]</table>                  
              <br><a href='http://shape2earth.com'><b>Shape2Earth</b></a>]]></text>
    </BalloonStyle>
    <LineStyle>
        <color>ff84685b</color>
    </LineStyle>
    <PolyStyle>
        <color>ffeaed3b</color>
    </PolyStyle>
</Style>
<Style id="trb470">

The "Polystyle" and "BalloonStyle"; what can generate this with a shapefile or kml as a ref?

share|improve this question
add comment

1 Answer 1

The geoxml3 library works with KML (which is just a variant of XML, anyway), so there is no need to "convert [your KML] to an XML." If you have Shapefiles you wan t to convert to KML files, you can use ogr2ogr.

ogr2ogr -f "KML" example.kml example.shp

You can generate KML programmatically in Python using PyKML.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.