-
Notifications
You must be signed in to change notification settings - Fork 139
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
Property 'timeDimension' does not exist on type 'typeof control' #202
Comments
Hi @tejaltar, $ npm install leaflet-timedimension@latest and: import 'leaflet/dist/leaflet.css'
import L from 'leaflet'
import 'leaflet-timedimension/dist/leaflet.timedimension.src.js'
import 'leaflet-timedimension/dist/leaflet.timedimension.control.css' |
Hi @bielfrontera, Yes I did that and still I am getting the same error. |
Hi @bielfrontera, When I imported timeDimension using following:
I am getting following error: But, if I use this everything works perfectly but L.control.timeDimension does not work.
|
Hi @tejaltar, |
Hi @bielfrontera, Even after installing and importing leaflet-timedimension I getting "Property 'timeDimension' does not exist on type 'typeof control'." error. Is there anything else I need to do? |
Can you check if there are some other messages in the console? |
Hi @bielfrontera, I added following properties to map object while creating L.Map and timedimension is working:
I want to hide and show timecontrol bar as per user's selection. Can you suggest some way to do it? |
If you want to add and remove manually the control, you can create the map with the option Basic example: the control is created, added to the map, removed 3 seconds later and, finally, added again. let timeControl = L.control.timeDimension({
autoPlay: false,
displayDate: true,
timeZones: ["Local"],
playerOptions: {
transitionTime: 500,
loop: true,
buffer: 10,
},
});
map.addControl(timeControl);
setTimeout(function () {
map.removeControl(timeControl);
}, 3000);
setTimeout(function () {
map.addControl(timeControl);
}, 6000); |
After installing leaflet-timedimension package does it update the index.d.ts file in node-modules? Control namespace in index.d.ts file is as follows:
Since timeDimension is not available here, it is giving me error. I have installed leaflet-timedimension and importing it as follows:
when I add timeDimension to Map object it is working fine but when I try to add and remove it using L.control.timeDimension it gives me "Property 'timeDimension' does not exist on type 'typeof control'." error. |
@tejaltar: i did not realise that you are using typescript (my fault, you mentioned index.d.ts on your first comment). I'm not very familiar with type definitions, but it is something that we should add to this project. There is an open issue about this topic (see #109 and #131). I've seen that @mano92fuentesjimenez has added the typescript definitions on their fork (see https://github.com/CFA-Meteorologia/Leaflet.TimeDimension/blob/master/src/definitions.d.ts). I don't know if Manuel would like to send us a PR to add it to the project. Or upload the definitions to DefinitelyTyped |
I installed leaflet-timedimension-scoped package but I am getting following error:
Also, I wanted to create tileLayer where URI for that layer should include the current time selected from the timeControl. How can I do that? |
When I am trying to use L.control.timeDimension( {
autoPlay: false,
displayDate: true,
timeZones: ["Local"],
playerOptions: {
transitionTime: 500,
loop: true,
buffer: 10
}
}) it gives following error:
Property 'timeDimension' does not exist on type 'typeof control'.
It is searching timeDimension option in control namespace of index.d.ts file of leaflet node module folder.
Do I need to install any specific version of leaflet?
The text was updated successfully, but these errors were encountered: