Esri Geoportal Server
1.0

com.esri.gpt.framework.util
Class KmlUtil

java.lang.Object
  extended by com.esri.gpt.framework.util.KmlUtil

public class KmlUtil
extends Object

KML/KMZ utility class.


Constructor Summary
KmlUtil()
           
 
Method Summary
static InputStream convertToFeaturesStream(InputStream kmlInputStream, String rootUrl)
          Drills-down KML stream for "Placemark" and follows "NetworkLink".
static InputStream extractKmlStream(InputStream kmzInputStream)
          Gets KML input stream from KMZ stream.
static InputStream openKmlStream(String url)
          Creates a stream from the URL possibly referencing KML/KMZ.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KmlUtil

public KmlUtil()
Method Detail

openKmlStream

public static InputStream openKmlStream(String url)
                                 throws IOException
Creates a stream from the URL possibly referencing KML/KMZ. If this is a KMZ, it will be interrogated for the enclosed KML, than that KML will be reopened.

Parameters:
url - KML/KMZ url
Throws:
IOException - if creating stream failed

extractKmlStream

public static InputStream extractKmlStream(InputStream kmzInputStream)
                                    throws IOException
Gets KML input stream from KMZ stream.

Parameters:
kmzInputStream - KMZ stream
Returns:
encoded input stream containing KML data
Throws:
IOException - extracting KML stream fails

convertToFeaturesStream

public static InputStream convertToFeaturesStream(InputStream kmlInputStream,
                                                  String rootUrl)
                                           throws IOException
Drills-down KML stream for "Placemark" and follows "NetworkLink". THis method ALWAYS closes input stream passed as an argument.

Parameters:
kmlInputStream - KML input stream
rootUrl - root URL used when KML contains relative URL
Returns:
first found feature stream.
Throws:
IOException - if convertiong stream fails

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.