Skip to content

Commit 4ceaee0

Browse files
authored
feat: migrate from geotypes to geobase (#342)
This pr removes the `geotypes` package in favor of `geobase`. I’d appreciate to hear your opinion or potential concerns on this change in #312. Previous conversations: - #142 - #312
1 parent 60b218e commit 4ceaee0

File tree

83 files changed

+674
-562
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+674
-562
lines changed

docs/docs/events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ parameter.
1616
@override
1717
Widget build(BuildContext context) {
1818
return MapLibreMap(
19-
options: MapOptions(center: Position(9.17, 47.68)),
19+
options: MapOptions(center: Geographic(lon: 9.17, lat: 47.68)),
2020
// highlight-start
2121
onEvent: _onEvent,
2222
// highlight-end

docs/docs/getting-started/programmatic-control.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class _MyMapWidget extends State<GesturesPage> {
3333
body: MapLibreMap(
3434
options: MapOptions(
3535
// parameters that start with init* can't be updated
36-
initCenter: Position(9.17, 47.68),
36+
initCenter: Geographic(lon: 9.17, lat: 47.68),
3737
initZoom: 3,
3838
// other parameters can be updated
3939
// highlight-start
@@ -78,7 +78,7 @@ class _MyMapWidget extends State<GesturesPage> {
7878
Widget build(BuildContext context) {
7979
return Scaffold(
8080
body: MapLibreMap(
81-
options: MapOptions(initCenter: Position(9.17, 47.68), initZoom: 3),
81+
options: MapOptions(initCenter: Geographic(lon: 9.17, lat: 47.68), initZoom: 3),
8282
onEvent: (event) {
8383
// check if the MapEvent type is a MapEventMapCreated
8484
if (event case MapEventMapCreated()) {
@@ -108,7 +108,7 @@ class _MyMapWidget extends State<GesturesPage> {
108108
Widget build(BuildContext context) {
109109
return Scaffold(
110110
body: MapLibreMap(
111-
options: MapOptions(initCenter: Position(9.17, 47.68), initZoom: 3),
111+
options: MapOptions(initCenter: Geographic(lon: 9.17, lat: 47.68), initZoom: 3),
112112
onEvent: (event) {
113113
// check if the MapEvent type is a MapEventStyleLoaded
114114
if (event case MapEventStyleLoaded()) {

docs/docs/layers/circles.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ Circles are a simple way to show data on the map.
1919
@override
2020
Widget build(BuildContext context) {
2121
return MapLibreMap(
22-
options: MapOptions(center: Position(9.17, 47.68)),
22+
options: MapOptions(center: Geographic(lon: 9.17, lat: 47.68)),
2323
layers: [
2424
// highlight-start
2525
CircleLayer(
2626
points: <Point>[
27-
Point(coordinates: Position(9.17, 47.68)),
28-
Point(coordinates: Position(9.17, 48)),
29-
Point(coordinates: Position(9, 48)),
30-
Point(coordinates: Position(9.5, 48)),
27+
Point(Geographic(lon: 9.17, lat: 47.68)),
28+
Point(Geographic(lon: 9.17, lat: 48)),
29+
Point(Geographic(lon: 9, lat: 48)),
30+
Point(Geographic(lon: 9.5, lat: 48)),
3131
],
3232
color: Colors.orange.withOpacity(0.5),
3333
radius: 20,

docs/docs/layers/markers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ late final MapController _controller;
2121
@override
2222
Widget build(BuildContext context) {
2323
return MapLibreMap(
24-
options: MapOptions(center: Position(9.17, 47.68)),
24+
options: MapOptions(center: Geographic(lon: 9.17, lat: 47.68)),
2525
onEvent: (event) async {
2626
switch (event) {
2727
case MapEventMapCreated():
@@ -37,7 +37,7 @@ Widget build(BuildContext context) {
3737
case MapEventClick():
3838
// add a new marker on click
3939
setState(() {
40-
_points.add(Point(coordinates: event.point));
40+
_points.add(Point(event.point));
4141
});
4242
default:
4343
// ignore all other events
@@ -48,10 +48,10 @@ Widget build(BuildContext context) {
4848
// highlight-start
4949
MarkerLayer(
5050
points: <Point>[
51-
Point(coordinates: Position(9.17, 47.68)),
52-
Point(coordinates: Position(9.17, 48)),
53-
Point(coordinates: Position(9, 48)),
54-
Point(coordinates: Position(9.5, 48)),
51+
Point(Geographic(lon: 9.17, lat: 47.68)),
52+
Point(Geographic(lon: 9.17, lat: 48)),
53+
Point(Geographic(lon: 9, lat: 48)),
54+
Point(Geographic(lon: 9.5, lat: 48)),
5555
],
5656
textField: 'Marker',
5757
textAllowOverlap: true,

docs/docs/layers/polygon.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ Polygons are way to highlight an area on the map.
1919
@override
2020
Widget build(BuildContext context) {
2121
return MapLibreMap(
22-
options: MapOptions(zoom: 7, center: Position(9.17, 47.68)),
22+
options: MapOptions(zoom: 7, center: Geographic(lon: 9.17, lat: 47.68)),
2323
layers: [
2424
// highlight-start
2525
PolygonLayer(
2626
polygons: <Polygon>[
2727
Polygon(
2828
coordinates: [
2929
[
30-
Position(8.201306116882563, 48.107357488669464),
31-
Position(8.885254895692924, 48.09428546381665),
32-
Position(8.759684141159909, 47.69326800157776),
33-
Position(9.631980099303235, 48.08929468133098),
34-
Position(8.68543348810175, 48.45383566718806),
35-
Position(8.201306116882563, 48.107357488669464),
30+
Geographic(lon: 8.201306116882563, lat: 48.107357488669464),
31+
Geographic(lon: 8.885254895692924, lat: 48.09428546381665),
32+
Geographic(lon: 8.759684141159909, lat: 47.69326800157776),
33+
Geographic(lon: 9.631980099303235, lat: 48.08929468133098),
34+
Geographic(lon: 8.68543348810175, lat: 48.45383566718806),
35+
Geographic(lon: 8.201306116882563, lat: 48.107357488669464),
3636
],
3737
],
3838
),

docs/docs/layers/polyline.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ Polylines are way to show paths or similar on the map.
1919
@override
2020
Widget build(BuildContext context) {
2121
return MapLibreMap(
22-
options: MapOptions(zoom: 7, center: Position(9.17, 47.68)),
22+
options: MapOptions(zoom: 7, center: Geographic(lon: 9.17, lat: 47.68)),
2323
layers: [
2424
// highlight-start
2525
PolylineLayer(
2626
polylines: <LineString>[
2727
LineString(
2828
coordinates: [
29-
Position(9.17, 47.68),
30-
Position(9.5, 48),
31-
Position(9, 48),
29+
Geographic(lon: 9.17, lat: 47.68),
30+
Geographic(lon: 9.5, lat: 48),
31+
Geographic(lon: 9, lat: 48),
3232
],
3333
),
3434
],

docs/docs/layers/widgets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Widget build(BuildContext context) {
2929
body: MapLibreMap(
3030
options: MapOptions(
3131
initZoom: 3,
32-
initCenter: Position(0, 0),
32+
initCenter: Geographic(lon: 0, lat: 0),
3333
),
3434
children: [
3535
// highlight-start
@@ -39,7 +39,7 @@ Widget build(BuildContext context) {
3939
// must be the same dimension as the inner widget
4040
size: const Size.square(50),
4141
// the longitude / latitude position on the map
42-
point: Position(-10, 0),
42+
point: Geographic(lon: -10, lat: 0),
4343
// child can be any flutter widget tree
4444
child: const Icon(
4545
Icons.location_on,

docs/docs/style-layers/circle-layer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ late final MapController _controller;
1919
@override
2020
Widget build(BuildContext context) {
2121
return MapLibreMap(
22-
options: MapOptions(center: Position(9.17, 47.68)),
22+
options: MapOptions(center: Geographic(lon: 9.17, lat: 47.68)),
2323
onMapCreated: (controller) => _controller = controller,
2424
onStyleLoaded: (style) async {
2525
// highlight-start

docs/docs/style-layers/fill-extrusion-layer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ late final MapController _controller;
1919
@override
2020
Widget build(BuildContext context) {
2121
return MapLibreMap(
22-
options: MapOptions(center: Position(9.17, 47.68)),
22+
options: MapOptions(center: Geographic(lon: 9.17, lat: 47.68)),
2323
onMapCreated: (controller) => _controller = controller,
2424
onStyleLoaded: (style) async {
2525
// add the tile source

docs/docs/style-layers/fill-layer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ late final MapController _controller;
1919
@override
2020
Widget build(BuildContext context) {
2121
return MapLibreMap(
22-
options: MapOptions(center: Position(9.17, 47.68)),
22+
options: MapOptions(center: Geographic(lon: 9.17, lat: 47.68)),
2323
onMapCreated: (controller) => _controller = controller,
2424
onStyleLoaded: (style) async {
2525
// highlight-start

0 commit comments

Comments
 (0)