Home > database >  Angular no recognizing Leaflet TimeDimension
Angular no recognizing Leaflet TimeDimension

Time:03-21

I have installed leaflet-timedimension on an Angular project. I am using ngx-leaflet. I am not able to work with the geoJson time dimension, it seems that angular does not recognize the leaflet-timedimension plugin.

I receive this error: ERROR TypeError: can't access property "geoJson", leaflet__WEBPACK_IMPORTED_MODULE_0__.TimeDimension.layer is undefined

How can I import this plugin in the correct way? Is there some alternative for Angular in order to show lines on map following a timeline? Thank you

CodePudding user response:

I guess you have not imported correctly the plugin.

You should import the plugin like this:

import "leaflet-timedimension/dist/leaflet.timedimension.control.min.css";
import "leaflet-timedimension";

In the demo below you can find this example adapted in Angular 12.x using ngx-leaflet

CodePudding user response:

I found the answer at this link: https://github.com/Asymmetrik/ngx-leaflet-tutorial-plugins. There is a tutorial explaining how to install it and use it.

  • Related