diff --git a/example/lib/main.dart b/example/lib/main.dart index 19523df7d..c07210957 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_map_example/pages/epsg4326_crs.dart'; import 'package:flutter_map_example/pages/map_inside_listview.dart'; import 'package:flutter_map_example/pages/network_tile_provider.dart'; @@ -75,7 +76,8 @@ class MyApp extends StatelessWidget { StatefulMarkersPage.route: (context) => StatefulMarkersPage(), MapInsideListViewPage.route: (context) => MapInsideListViewPage(), ResetTileLayerPage.route: (context) => ResetTileLayerPage(), - MaxBoundsPage.route: (context) => MaxBoundsPage() + EPSG4326Page.route: (context) => EPSG4326Page(), + MaxBoundsPage.route: (context) => MaxBoundsPage(), }, ); } diff --git a/example/lib/pages/epsg4326_crs.dart b/example/lib/pages/epsg4326_crs.dart new file mode 100644 index 000000000..2c586502d --- /dev/null +++ b/example/lib/pages/epsg4326_crs.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; + +import '../widgets/drawer.dart'; + +class EPSG4326Page extends StatelessWidget { + static const String route = 'EPSG4326 Page'; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('EPSG4326')), + drawer: buildDrawer(context, route), + body: Padding( + padding: EdgeInsets.all(8.0), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(top: 8.0, bottom: 8.0), + child: Text('This is a map that is showing (42.58, 12.43).'), + ), + Flexible( + child: FlutterMap( + options: MapOptions( + minZoom: 0, + crs: const Epsg4326(), + center: LatLng(0, 0), + zoom: 0.0, + ), + layers: [ + TileLayerOptions( + wmsOptions: WMSTileLayerOptions( + crs: const Epsg4326(), + baseUrl: 'http://ows.mundialis.de/services/service?', + layers: ['TOPO-OSM-WMS'], + ), + ) + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/example/lib/widgets/drawer.dart b/example/lib/widgets/drawer.dart index f1b98689e..58811e249 100644 --- a/example/lib/widgets/drawer.dart +++ b/example/lib/widgets/drawer.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_map_example/pages/epsg4326_crs.dart'; import 'package:flutter_map_example/pages/map_inside_listview.dart'; import 'package:flutter_map_example/pages/marker_rotate.dart'; import 'package:flutter_map_example/pages/network_tile_provider.dart'; @@ -234,6 +235,13 @@ Drawer buildDrawer(BuildContext context, String currentRoute) { Navigator.pushReplacementNamed(context, ResetTileLayerPage.route); }, ), + ListTile( + title: const Text('EPSG4326 Crs'), + selected: currentRoute == EPSG4326Page.route, + onTap: () { + Navigator.pushReplacementNamed(context, EPSG4326Page.route); + }, + ), _buildMenuItem( context, const Text('Stateful markers'), diff --git a/lib/src/geo/crs/crs.dart b/lib/src/geo/crs/crs.dart index 522701bd7..fadb9e511 100644 --- a/lib/src/geo/crs/crs.dart +++ b/lib/src/geo/crs/crs.dart @@ -148,7 +148,7 @@ class Epsg4326 extends Earth { const Epsg4326() : projection = const _LonLat(), - transformation = const Transformation(1 / 180, 0.5, -1 / 180, 0.5), + transformation = const Transformation(1 / 180, 1, -1 / 180, 0.5), super(); }