[GRASS-SVN] r41188 - grass-addons/raster/r.out.kml
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 26 07:12:56 EST 2010
Author: hamish
Date: 2010-02-26 07:12:55 -0500 (Fri, 26 Feb 2010)
New Revision: 41188
Modified:
grass-addons/raster/r.out.kml/r.out.kml
Log:
add -z flag to create KMZ file; bugfix GE doesn't like quotes around href image name (thanks Peter)
Modified: grass-addons/raster/r.out.kml/r.out.kml
===================================================================
--- grass-addons/raster/r.out.kml/r.out.kml 2010-02-26 07:14:27 UTC (rev 41187)
+++ grass-addons/raster/r.out.kml/r.out.kml 2010-02-26 12:12:55 UTC (rev 41188)
@@ -41,7 +41,12 @@
#% answer: png
#% description: Graphics file format
#%end
+#%flag
+#% key: z
+#% description: Create a KMZ file instead of KML and image files
+#%end
+
if [ -z "$GISBASE" ] ; then
echo "You must be in GRASS GIS to run this program." 1>&2
exit 1
@@ -52,6 +57,13 @@
fi
+#### check if we have zip
+if [ "$GIS_FLAG_Z" -eq 1 ] && [ ! -x "`which zip`" ] ; then
+ g.message -e "zip required for creating KMZ, please install first"
+ exit 1
+fi
+
+
MAP_NAME="$GIS_OPT_MAP"
g.findfile element=cell file="$MAP_NAME" > /dev/null
@@ -139,7 +151,7 @@
<visibility>1</visibility>
<open>1</open>
<Icon>
- <href>"$OUT_NAME.$IMG_EXT"</href>
+ <href>$OUT_NAME.$IMG_EXT</href>
</Icon>
<drawOrder>0</drawOrder>
<LatLonBox>
@@ -167,5 +179,12 @@
;;
esac
+# create KMZ if requested
+if [ "$GIS_FLAG_Z" -eq 1 ] ; then
+ zip "$OUT_NAME.kmz" "$OUT_NAME.kml" "$OUT_NAME.$IMG_EXT"
+ rm -f "$OUT_NAME.kml" "$OUT_NAME.$IMG_EXT"
+fi
+
+
#done
More information about the grass-commit
mailing list