1

I need to accomplish two things in bulk:

  1. Convert SHP to KML
  2. Modify the fill and outline color and opacity either of SHP or KML files

What tools can you recommend for these two tasks?

I've tried Google Earth Pro, which allows me to import in bulk and set the fill/outline color/opacity in bulk. But, I'm unable to export to KML in BULK. For the collection of data I have right now I have 193 *.shp files. In Google Earth Pro, I would have to export each one manually. In the future I will have 1000's of *.shp files and one-at-a-time won't cut it then.

Can you bulk export to KML in Google Earth Pro?

4
  • Do you need this for personal or commercial use?
    – Mapperz
    Commented Sep 3, 2014 at 14:59
  • Please clarify your question: 1) do you want to merge 193 files into a single file? Or do you want to convert each .shp to a .kml? The answer to 2 may change depending on your answer to the first point.
    – Barrett
    Commented Sep 3, 2014 at 14:59
  • When I'm done I would like to have 193 *.kml files with custom fill/outline color/opacity.
    – s15199d
    Commented Sep 3, 2014 at 15:01
  • 1
    Hi @s15199d you should limit your question to one question. You can edit this one to be the first one, as Barrett has already answered it, and then create a new question for the second issue.
    – HeikkiVesanto
    Commented Apr 24, 2019 at 9:20

1 Answer 1

3

To answer #1, how about looping through this google developers snippet for each .kml file. Something close to this batch script:

 for %f in (*.shp) do ( 

    ogr2ogr -f "KML" %%~nf.kml %f

 )

The %%~nf.kml might need work - you might have to concatenate %%~nf and .kml

If this gets you into KML Format, how about using Google Earth Pro to modify your styles in bulk? There are libraries like libkml or pyKML or SharpKML that you might leverage. You can use XSL Stylesheets. Or perhaps create a script to read the XML, strip the code and replace with your updated code. I've never done any of those, so I am offering options to explore.

2
  • Not sure I understand the need for the nbrhood piece. Since each *.shp file only contains 1 set of boundaries. What about modifying the fill/outline color/opacity? I need both pieces.
    – s15199d
    Commented Sep 3, 2014 at 15:45
  • ... That was the example code from google developers site. I've updated to work with your question. You need both pieces but maybe only get one at a time.
    – Barrett
    Commented Sep 3, 2014 at 15:51

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