GeomGeoJson.fromJson constructor

GeomGeoJson.fromJson(
  1. dynamic input
)

Implementation

GeomGeoJson.fromJson(dynamic input) {
  points = null;
  lines = null;
  multilines = null;
  polygons = null;
  type = input['type'];

  switch (type.toLowerCase()) {
    case 'linestring':
      lines = GeomLine.fromGeojson(input, withInvertedCoords: true);
      break;
    case 'multilinestring':
      multilines = GeomMultiLine.fromGeojson(input, withInvertedCoords: true);
      break;

    case 'polygon':
      polygons = [GeomPolygon.fromJson(input, withInvertedCoords: true)];
      break;

    case 'multipolygon':
      polygons = GeomMultiPolygon.fromJson(input, withInvertedCoords: true)
          .multiPolygons;
      break;

    case 'point':
      points = GeomPoint.fromGeojson(input);
      break;

    case 'geometrycollection':
      _parseGeometryCollection(input);
      break;

    default:
      _debugDtoPrint('Cannot parse type: $type');
      break;
  }
}