Pub

mapmyindia_flutter

A Unofficial mapmyindia flutter packages .

Internally use Mapmyindia REST API

Table of Contents

Installation

Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  mapmyindia_flutter: ^1.0.7

Install it

You can install packages from the command line:

with pub:
$ dart pub get

Alternatively, your editor might support dart pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:mapmyindia_flutter/mapmyindia_flutter.dart';

Usage

If you need to get latitude and longitude of your current location there is a package recommanded for you Geolocator

First you need to create an account on Mapmyindia Signup. If you have allready an account then Mapmyindia Login . In reverse geocoding you will use the REST API Key for Web/Android/iOS.

Documentation

Reverse Geocoding

Reverse Geocoding is a process to give the closest matching address to a provided geographical coordinates (latitude/longitude). MapmyIndia reverse geocoding API provides real addresses along with nearest popular landmarks for any such geo-positions on the map.

  import 'package:mapmyindia_flutter/mapmyindia_flutter.dart';
  
  MapMyIndiaGeocoding("[API_KEY]")
        .getAddress(_latitude,_longitude)
                      .then((getAddress) {
                      ReverseGeocoding address = getAddress.formattedAddress;            
    });

Code explaination

MapMyIndiaGeocoding class contain getAddress(double,double) method and it return Future<ReverseGeocoding>.

ReverseGeocoding Model

DataDescription
houseNumberThe house number of the location. It may be empty String if house number not exist
houseNameThe name of the location.
poiThe name of the POI if the location is a place of interest (POI).
poiDistdistance from nearest POI in metres.
streetThe name of the street of the location.
streetDistdistance from nearest Street in metres.
subSubLocalityThe name of the sub-sub-locality where the location exists.
subLocalityThe name of the sub-locality where the location exists.
localityThe name of the locality where the location exists.
villageThe name of the village if the location exists in a village.
districtThe name of the district in which the location exists.
subDistrictThe name of the sub-district in which the location exists.
cityThe name of the city in which the location exists.
stateThe name of the state in which the location exists.
pincodeThe pin code of the location area.
latitudeThe latitude of the location.
longitudeThe longitude of the location.
formattedAddressThe complete human readable address string that is usually the complete postal address of the result.
areain-case the co-ordinate lies in a country the name of the country would be returned or if the co-ordinate lies in an ocean, the name of the ocean will be returned.

Still Map Image

The Still Map Image returns the map as an image which you can display on your application. The API lets you embed MapmyIndia Maps image according to geo-position, pixel size and zoom level of the map on your application without requiring any dynamic page loading. The image can be a retina image and markers can be added to the image to indicate position of any object.

   String mapImageUrl = MapMyIndiaStillMap("[API_KEY]")
                              .getMapImage(
                                  latitude,
                                  longitude,
                                 );

Additional Parameter in getMapImage() method are -

ParameterDescription
markersToptional markers that you may want to add to the map tile. default Value List(centerLatitude,centerLongitude)
widthThe size of the image requested in pixels as Width.
heightThe size of the image requested in pixels as Height.
zoomThe zoom level for which the image is requested. Ranges from 4 to 18 with 18 being the highest zoomed in level.
ssfscale factor indicating retina or non-retina tiles. 0→non-retina tiles. 1→retina tiles.

Upcoming_Feature

  • Forward Geocoding
  • Autosuggest
  • eLOC
  • Traveled Route Image

License

BSD 2-Clause "Simplified" License

Issues

Please file any issues, bugs or feature requests as an issue on our GitHub page. Commercial support is available, you can contact us at nikhilbcps@gmail.com.

Want_to_contribute

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our code and send us your pull request.

Libraries

ClientSideException
mapmyindia_flutter
MapmyindiaGeocoding
MapmyIndiaStillmap
reverse_geocoding
ServerSideException