Last updated:
0 purchases
geopoint
Geopoint #
Geospatial data structures for Dart
Models #
GeoPoint #
Datastructure:
String name;
final double latitude; // required
final double longitude; // required
String slug;
int timestamp;
double latitude;
double longitude;
double altitude;
double speed;
double accuracy;
double speedAccuracy;
double heading;
String number;
String street;
String locality;
String sublocality;
String postalCode;
String subregion;
String region;
String country;
List<File> images;
copied to clipboard
Extra constructors:
/// from a [LatLng]
GeoPoint.fromLatLng(name: "Position", point: LatLng(51.0,0.0));
/// from json
GeoPoint.fromJson(jsonData);
copied to clipboard
Methods and getters:
/// get the formated address
String address = geoPoint.address;
/// get the [LatLng] point
LatLng point = geoPoint.point;
/// convert to json
Map<String, dynamic> json = geoPoint.toMap();
/// convert to a map of strings
Map<String, String> strMap = geoPoint.toStringsMap();
copied to clipboard
GeoSerie #
Datastructure:
String name;
int id;
GeoSerieType type; /// one of [GeoSerieType.group]
/// [GeoSerieType.line] or
/// [GeoSerieType.polygon]
List<GeoPoint> geoPoints;
num surface;
GeoSerie boundary;
GeoPoint centroid;
copied to clipboard
Extra constructors:
/// from json
GeoSerie geoSerie = GeoSerie.fromJson(jsonData);
/// from strings
GeoSerie geoSerie = GeoSerie.fromNameAndType(
name: "A polygon",
type: GeoSerieType.polygon,
// or typeStr: "polygon"
);
copied to clipboard
Methods and getters:
// convert to json
Map<String, dynamic> jsonData = geoSerie.toMap();
/// convert to a list of [LatLng]
List<LatLng> points = geoSerie.toLatLng(ignoreErrors = true);
/// The invalid points will be skipped if ignoreErrors is true
// get the type as a string
String type = geoSerie.typeStr;
copied to clipboard
Geojson serialization #
Serializers are available to get geojson feature or coordinates strings:
/// Convert to a geojson feature string
String feature = geoSerie.toGeoJsonFeatureString();
/// Convert to a geojson coordinates string
String coordinates = geoSerie.toGeoJsonCoordinatesString();
/// Convert to a geojson feature string
String feature = geoPoint.toGeoJsonFeatureString();
/// Convert to a geojson coordinates string
String coordinates = geoPoint.toGeoJsonCoordinatesString();
copied to clipboard
Related packages #
Geojson : to work with geojson data
Geopoint location a Flutter plugin to handle real time position updates
Geopoint sql a Flutter plugin to handle database operations
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.