Skip to content

Commit 18e3a22

Browse files
committed
Improve polar projection example
1 parent 2772595 commit 18e3a22

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

example/lib/pages/epsg3413_crs.dart

+29-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class _EPSG3413PageState extends State<EPSG3413Page> {
6969
point: LatLng(90, 0),
7070
radius: 20000,
7171
useRadiusInMeter: true,
72-
color: Colors.red,
72+
color: Colors.yellow,
7373
)
7474
];
7575
for (final lon in [-90.0, 0.0, 90.0, 180.0]) {
@@ -81,6 +81,18 @@ class _EPSG3413PageState extends State<EPSG3413Page> {
8181
));
8282
}
8383

84+
// Add latitude line at 80 degrees
85+
final distancePoleToLat80 =
86+
const Distance().distance(LatLng(90, 0), LatLng(80, 0));
87+
circles.add(CircleMarker(
88+
point: LatLng(90, 0),
89+
radius: distancePoleToLat80,
90+
useRadiusInMeter: true,
91+
color: Colors.transparent,
92+
borderColor: Colors.black,
93+
borderStrokeWidth: 1.0,
94+
));
95+
8496
return Scaffold(
8597
appBar: AppBar(title: const Text('EPSG:3413 CRS')),
8698
drawer: buildDrawer(context, EPSG3413Page.route),
@@ -91,18 +103,27 @@ class _EPSG3413PageState extends State<EPSG3413Page> {
91103
const Padding(
92104
padding: EdgeInsets.only(top: 8.0, bottom: 2.0),
93105
child: Text(
94-
'This map is in EPSG:3413',
106+
'Tricky edge-cases with polar projections',
95107
style: TextStyle(
96108
fontWeight: FontWeight.bold,
97109
color: Colors.blue,
98110
fontSize: 16.0,
99111
),
100112
),
101113
),
114+
const Text(
115+
'Details: https://github.com/fleaflet/flutter_map/pull/1295'),
102116
const Padding(
103117
padding: EdgeInsets.only(top: 8.0, bottom: 2.0),
104-
child: Text(
105-
'This page demonstrates some tricky edge-cases for maps with a polar projection.',
118+
child: SizedBox(
119+
width: 500,
120+
child: Text(
121+
'• Northern and eastern directions are relative to where you are on the map:\n'
122+
' • A red dot moves north toward the yellow dot (North Pole).\n'
123+
' • A red dot moves east counter-clockwise along the black latitude line (80°).\n'
124+
'• The lower left and right corners of the overlay image are the northern corners.'
125+
//textAlign: TextAlign.center,
126+
),
106127
),
107128
),
108129
Flexible(
@@ -126,9 +147,6 @@ class _EPSG3413PageState extends State<EPSG3413Page> {
126147
layers: ['gebco_north_polar_view'],
127148
),
128149
),
129-
CircleLayerOptions(
130-
circles: circles,
131-
),
132150
OverlayImageLayerOptions(
133151
overlayImages: [
134152
OverlayImage(
@@ -141,7 +159,10 @@ class _EPSG3413PageState extends State<EPSG3413Page> {
141159
).image,
142160
)
143161
],
144-
)
162+
),
163+
CircleLayerOptions(
164+
circles: circles,
165+
),
145166
],
146167
),
147168
),

0 commit comments

Comments
 (0)