Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to use mapbox plugins? #63

Closed
HMubaireek opened this issue Sep 29, 2018 · 9 comments
Closed

A way to use mapbox plugins? #63

HMubaireek opened this issue Sep 29, 2018 · 9 comments

Comments

@HMubaireek
Copy link

Hi,

I've been looking to find a way to use mapbox plugins, specifically mapbox-gl-rtl-text.

I've been thinking we could use it in NgxMapboxGLModule.withConfig but that is not supported.

What is the way to do it?

@sroettering
Copy link
Contributor

I would also like to use plugins, namely mapbox-gl-draw. As far as I can tell it would be enough for me to be able to write my own control directive, but that is not an option right now as MapService and ControlComponent are not exposed in the library.

@calbear47
Copy link

I have the drawing tools working with this project.

I accomplished it by doing the following:

Load the css in angular.json

            "styles": [
              "src/styles.scss",
              "node_modules/mapbox-gl/dist/mapbox-gl.css",
              "node_modules/@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css"
            ]

Import the drawing module into your component;

import * as MapboxDraw from '@mapbox/mapbox-gl-draw';

On load, add the control to your map;


@ViewChild('map') map;


  ngAfterViewInit() {
    const draw = new MapboxDraw();
    this.map.load.pipe(take(1)).subscribe(() => {
      this.map.MapService.addControl(draw, 'top-right');
    });
  }

@raysuelzer
Copy link
Contributor

I think it would be good if the created exposed ControlComponent to the public API. This would allow creation of custom directives, like Draw.

@raysuelzer
Copy link
Contributor

Here is a PR with that I think is a more elegant solution and would allow community based plugins.

#79

@amirofy2002
Copy link

amirofy2002 commented Jan 5, 2019

after installing mapbox-gl-rtl-text

following errors occured:


**ERROR in ./node_modules/@mapbox/mapbox-gl-rtl-text/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\My Data\Angular\BehzistiSearch\node_modules\@mapbox\mapbox-gl-rtl-text'
ERROR in ./node_modules/@mapbox/mapbox-gl-rtl-text/index.js
Module not found: Error: Can't resolve 'path' in 'C:\My Data\Angular\BehzistiSearch\node_modules\@mapbox\mapbox-gl-rtl-text'**

@rrecio
Copy link

rrecio commented Dec 10, 2019

I would also like to use plugins, namely mapbox-gl-draw. As far as I can tell it would be enough for me to be able to write my own control directive, but that is not an option right now as MapService and ControlComponent are not exposed in the library.

It would be awesome to use mapbox draw

@dmytro-gokun
Copy link
Collaborator

As far as i understand this was solved by #79 and should be available to do with the latests version of the library (4.8.1). Thus, i'm closing this issue. If someone thinks there's still work to do - please chime in and we'll figure it out.

@ArmaProjects
Copy link

ArmaProjects commented Oct 4, 2020

@amirofy2002 mentioned above error when the mapbox-gl-rtl-text connected with addControl method.
The error is still there. It seems that mapbox-gl-rtl-text differs from another plugins.

Does anyone has an idea how to connect mapbox-gl-rtl-text to a project?

@dmytro-gokun
Copy link
Collaborator

@ArmaProjects This issue is closed. Please create a new one and provide a reproduction project (preferrably, using the stackblitz template supplied). Then, if someone has time, they may help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants