Skip to content
This repository has been archived by the owner on Jun 4, 2020. It is now read-only.

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
synw committed Dec 3, 2019
1 parent 0d57a85 commit 4352070
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 21 deletions.
22 changes: 22 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include: package:extra_pedantic/analysis_options.yaml

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
errors:
missing_return: error
missing_required_param: error
invalid_use_of_protected_member: error
dead_code: info
sdk_version_async_exported_from_core: ignore
linter:
rules:
- unnecessary_statements
- unnecessary_lambdas
- avoid_classes_with_only_static_members
- avoid_renaming_method_parameters
- camel_case_types
- constant_identifier_names
- cascade_invocations
- omit_local_variable_types
11 changes: 9 additions & 2 deletions example/dart/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ import 'package:geojson/geojson.dart';
// data is from http://www.naturalearthdata.com

void main() async {
await smallData();
await multipolygons();
await lines();
await smallData();
}

Future<void> smallData() async {
final file = File("../data/small_data.geojson");
final features = await featuresFromGeoJsonFile(file);
for (final feature in features.collection) {
print("Point: ${feature.geometry.geoPoint.name}");
if (feature.type == GeoJsonFeatureType.point) {
print("Point: ${feature.geometry.geoPoint.name}");
} else {
print("Feature: ${feature.type}: ${feature.geometry}");
for (final geom in feature.geometry.geometries) {
print("Geometry: $geom");
}
}
}
return;
}
Expand Down
113 changes: 94 additions & 19 deletions example/data/small_data.geojson
Original file line number Diff line number Diff line change
@@ -1,21 +1,96 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {"name": "point1"},
"geometry": {
"type": "Point",
"coordinates": [0, 0]
}
},
{
"type": "Feature",
"properties": {"name": "point2"},
"geometry": {
"type": "Point",
"coordinates": [0, 0]
}
}
]
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "point1"
},
"geometry": {
"type": "Point",
"coordinates": [
0,
0
]
}
},
{
"type": "Feature",
"properties": {
"name": "point2"
},
"geometry": {
"type": "Point",
"coordinates": [
0,
0
]
}
},
{
"type": "Feature",
"properties": {
"name": "collection"
},
"geometry": {
"geometries": [
{
"type": "Polygon",
"coordinates": [
[
[
100.0,
0.0
],
[
101.0,
0.0
],
[
101.0,
1.0
],
[
100.0,
1.0
],
[
100.0,
0.0
]
]
]
},
{
"type": "Polygon",
"coordinates": [
[
[
100.0,
0.0
],
[
101.0,
0.0
],
[
101.0,
1.0
],
[
100.0,
1.0
],
[
100.0,
0.0
]
]
]
}
],
"type": "GeometryCollection"
}
}
]
}

0 comments on commit 4352070

Please sign in to comment.