Code Monkey home page Code Monkey logo

Comments (11)

HarelM avatar HarelM commented on May 28, 2024 1

You need to install types/geojson, I think.
This will be solved in next release, but until then I believe this is the right solution.

from ngx-maplibre-gl.

HarelM avatar HarelM commented on May 28, 2024 1

I've updated the readme, and partially the API.md.
If you have a few minutes to spare to send a PR for updating the API.md links to point to maplibre documentation instead of mapbox documentation it would be extremely helpful :-)

from ngx-maplibre-gl.

HarelM avatar HarelM commented on May 28, 2024

You can check the code in the demo (documentation) pages to see working examples in stack blitz that uses angular.

from ngx-maplibre-gl.

HarelM avatar HarelM commented on May 28, 2024

Feel free to send any PR to update the documentation :-)

from ngx-maplibre-gl.

Ste-denko avatar Ste-denko commented on May 28, 2024

You need to install types/geojson, I think.
This will be solved in next release, but until then I believe this is the right solution.

Thanks, and yes, that solved the error message.

You can check the code in the demo (documentation) pages to see working examples in stack blitz that uses angular.

Would you be so kind and provide a link to the demo (documentation) you are talking about? I simply cannot find anything helpful.
(If you mean the documentation from the Readme file ... as I mentioned above, that did not work for me ;o)

Thank you VERY MUCH, also for the super fast replies.
Cheers

from ngx-maplibre-gl.

HarelM avatar HarelM commented on May 28, 2024

No problem, can I close this issue or do you think something should be added somewhere?
The documentation is here:
https://maplibre.org/ngx-maplibre-gl/
I'll update the readme to link there.

from ngx-maplibre-gl.

Ste-denko avatar Ste-denko commented on May 28, 2024

No problem, can I close this issue or do you think something should be added somewhere?
The documentation is here:
https://maplibre.org/ngx-maplibre-gl/
I'll update the readme to link there.

Thanks again for all your help and efforts.
I would like to mention that my problem is fixed meanwhile, but unfortunately it still exists, although I followed all the provided documentation.

This is what I did:

  • Created a fresh, blank and default Angular project
  • Executed: npm install ngx-maplibre-gl maplibre-gl @types/geojson
  • Modified the project files as shown in the documentation and demo.

The related files are then looking like this:

angular.json

...
"styles": [
  "src/styles.css",
  "./node_modules/maplibre-gl/dist/maplibre-gl.css"
],
...

polyfills.ts

...
(window as any).global = window;
...

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import { NgxMapLibreGLModule } from 'ngx-maplibre-gl';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    NgxMapLibreGLModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.component.ts

import { Component } from '@angular/core';

@Component({
  template: `
    <mgl-map
      [style]="'https://api.maptiler.com/maps/streets/style.json?key=MyOwnValidKey'"
      [zoom]="[9]"
      [center]="[-74.50, 40]"
    >
    </mgl-map>
  `,
  styles: [
    `
      mgl-map {
        height: 100%;
        width: 100%;
      }
    `,
  ],
})
export class AppComponent {}

The code succesfully compiles but the preview window still remains just white without a map.
What am I missing here?
Any help would be really appreciated.
Thanks again in advance.

from ngx-maplibre-gl.

HarelM avatar HarelM commented on May 28, 2024

You need a style and tiles source I guess...?
Please share the relevant code and I might be able to help...

from ngx-maplibre-gl.

Ste-denko avatar Ste-denko commented on May 28, 2024

The style source is given here in the app.component.ts:

[style]="'https://api.maptiler.com/maps/streets/style.json?key=MyOwnValidKey'"

Where to provide the vector tiles source? Cannot find this in the docu.

from ngx-maplibre-gl.

HarelM avatar HarelM commented on May 28, 2024

This is less related to this project.
This project only wraps maplibre. You should consult their documentation for style and tile sources. Note that version 2 is still in pre release and should not be used.
You can use the demotiles repo or get a key from maptiler.

from ngx-maplibre-gl.

HarelM avatar HarelM commented on May 28, 2024

Closing...

from ngx-maplibre-gl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.