Angular no recognizing Leaflet TimeDimension

341 Views Asked by At

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

1

There are 1 best solutions below

0
kboul On

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