Files
rog_app/lib/services/location_polygon_service.dart

33 lines
794 B
Dart
Raw Normal View History

2022-03-14 12:28:57 +05:30
import 'package:geojson/geojson.dart';
import 'package:http/http.dart' as http;
class LocationPolygonervice{
static Future<GeoJsonFeature?> loadLocationLines() async {
final geo = GeoJson();
GeoJsonFeature? fs;
2022-06-06 21:15:58 +05:30
//String url = 'http://container.intranet.sumasen.net:8100/api/location_polygon/';
String url = 'http://localhost:8100/api/location_polygon/';
2022-03-14 12:28:57 +05:30
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
geo.processedFeatures.listen((fst) {
fs = fst;
});
await geo.parse(response.body, verbose:true);
return fs;
} else {
throw Exception('Failed to create album.');
}
}
}