Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

synw/geopoint_sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geopoint Sql

pub package

Sql operations for geospatial data. Uses Geopoint and Geojson for data structures and Sqlcool for database management.

Documentation

Init a geospatial database

import 'package:sqlcool/sqlcool.dart';
import 'package:geopoint_sql/geopoint_sql.dart';

final geoDb = Db();
await geoDb
   .init(
      path: "geodb.sqlite",
      schema: [geoPointSchema, geoSerieSchema],
      verbose: true)
   .catchError((dynamic e) {
      throw ("Can not init geo database $e");
   });

Crud operations

For geopoints:

import 'package:geopoint_sql/geopoint_sql.dart';

final geoPointSql = GeoPointSql(db: geoDb);
// save
geoPointSql.save(
   geoPoint: GeoPoint(name: "point", latitude: 0.0, longitude: 0.0));

For geoseries:

import 'package:geopoint_sql/geopoint_sql.dart';

final geoSerieSql = GeoSerieSql(db: geoDb);
// save
geoSerieSql.save(
   geoSerie: GeoSerie(name: "serie1", geoPoints: <GeoPoint>[]));
// update
geoSerieSql.update(
   geoSerie: GeoSerie(name: "serie1", geoPoints: <GeoPoint>[]));
// delete
geoSerieSql.delete(someExistingGeoserie);

Admin crud view

import 'package:geopoint_sql/geopoint_sql.dart';

@override
Widget build(BuildContext context) {
   return Scaffold(
      body: GeoCrudNavigationPage(db: geoDb, activeTab: ActiveTab.line));
}

Screenshot