geojson 0.1.0
geojson: ^0.1.0 copied to clipboard
Manipulate geojson data. Load and parse geojson from a string or a file.
Geojson #
Utilities to work with geojson data in Dart.
Example #
import 'dart:io';
import 'package:geojson/geojson.dart';
void main() async {
polygons();
lines();
}
void polygons() async {
final file = File("lakes_of_europe.geojson");
final geoSeries = await geoSerieFromGeoJsonFile(file, nameProperty: "label");
for (final geoSerie in geoSeries) {
print("${geoSerie.name}: ${geoSerie.geoPoints.length} geopoints");
}
}
void lines() async {
final file = File("railroads_of_north_america.geojson");
final geoSeries = await geoSerieFromGeoJsonFile(file, nameProperty: "continent");
for (final geoSerie in geoSeries) {
print("${geoSerie.name}: ${geoSerie.geoPoints.length} geopoints");
}
}
Api #
geoSerieFromGeoJson
: create geoseries from geojson string data. Parameters:
data
: a string with the geojson data, requirednameProperty
: the property used for the geoserie name, automaticaly set if nulltype
: the geoserie type, infered from data if not providedverbose
: print data if true
geoSerieFromGeoJsonFile
: create geoseries from a geojson file. Parameters:
file
: the file to load, requirednameProperty
: the property used for the geoserie name, automaticaly set if nulltype
: the geoserie type, infered from the file if not providedverbose
: print data if true