Home > Software design >  how transform center map in address flutter
how transform center map in address flutter

Time:03-13

I use this code to generate the map. I would need, however, that when the user moves the map he gives me the coordinates of the center. I would then have to transform the coordinates into the street. can anyone help me?

                                      FlutterMap(
                                        mapController: _mapController,
                                        options: MapOptions(
                                          center: coordinates,
                                          minZoom: 6.132941532936457,
                                          maxZoom: 18.499999,
                                        ),
                                        layers: [
                                          TileLayerOptions(
                                            urlTemplate:'',
                                            additionalOptions: {
                                              'accessToken':
                                                  _mapboxKey.value!,
                                              'id':
                                                  'mapbox.mapbox-streets-v7',
                                            },
                                          ),
                                        ],
                                      ),

CodePudding user response:

To achieve this you can use geolocator

This is the link for this package https://pub.dev/packages/geolocator

It will give

1 Get the last known location 2 Get the current location of the device 3 Get continuous location updates 4 Check if location services are enabled on the device 5 Calculate the distance (in meters) between two geocoordinates 6 Calculate the bearing between two geocoordinates

and using geocode package

this is the link https://pub.dev/packages/geocode

Package to make Geocode requests. It exposes two methods to translate coordinates into locations and addresses into coordinates.

using coordinates you can use maps

  • Related