Y
Y
Yurik7k2018-02-20 16:33:48
Mobile development
Yurik7k, 2018-02-20 16:33:48

How to connect api 2 gis to ionic 3?

I determine the user's location in the ionic 3 application using the Geolocation plugin, get the coordinates. I need to use api 2 gis to search for buildings, etc. how to connect api 2 gis to the application?

script src="https://maps.api.2gis.ru/2.0/loader.js?pkg=full">/script>
- this is not an option
, this is already better: npm i 2gis-maps but I don’t know how to connect the package itself to ionic later.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Redun, 2018-03-13
@Yurik7k

npm i 2gis-maps
We put in the template page map.html
In the map.ts component file

.....
import DG from '2gis-maps';
....

export class MapPage {
  map: any;
  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }

  ionViewDidLoad() {
    this.map = DG.map('map', {
        'center': [54.98, 82.89],
        'zoom': 13
    });
  }

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question