Package 

Class GeoJsonParser


  • 
    public class GeoJsonParser
    
                        

    Parses a JSONObject and places data into their appropriate GeoJsonFeature objects. Returns an array of GeoJsonFeature objects parsed from the GeoJSON file.

    • Constructor Summary

      Constructors 
      Constructor Description
      GeoJsonParser(JSONObject geoJsonFile) Creates a new GeoJsonParser
    • Method Summary

      Modifier and Type Method Description
      static Geometry parseGeometry(JSONObject geoJsonGeometry) Parses a single GeoJSON geometry object containing a coordinates array or a geometries arrayif it has type GeometryCollection.
      ArrayList<GeoJsonFeature> getFeatures() Gets the array of GeoJsonFeature objects
      LatLngBounds getBoundingBox() Gets the array containing the coordinates of the bounding box for the FeatureCollection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GeoJsonParser

        GeoJsonParser(JSONObject geoJsonFile)
        Creates a new GeoJsonParser
        Parameters:
        geoJsonFile - GeoJSON file to parse
    • Method Detail

      • parseGeometry

         static Geometry parseGeometry(JSONObject geoJsonGeometry)

        Parses a single GeoJSON geometry object containing a coordinates array or a geometries arrayif it has type GeometryCollection. FeatureCollections, styles, bounding boxes, and propertiesare not processed by this method. If you want to parse GeoJSON including FeatureCollections,styles, bounding boxes, and properties into an array of GeoJsonFeatures theninstantiate GeoJsonParser and call getFeatures.

        Parameters:
        geoJsonGeometry - geometry object to parse
      • getBoundingBox

         LatLngBounds getBoundingBox()

        Gets the array containing the coordinates of the bounding box for the FeatureCollection. Ifthe FeatureCollection did not have a bounding box or if the GeoJSON file did not contain aFeatureCollection then null will be returned.