Closed rpanjwani closed 5 years ago
This means for some reason the layer returned by getLayer
does not have a popup defined, so you cannot set its contents. Just guessing, but have you set the popup before, with bindPopup
? If you have, it might also be since your layer is re-created on each update rather than reused. Hard to tell without seeing a running example.
You can either try to use bindPopup
instead, or debug why the returned layer does not a have a popup.
thank you for the response. I am just starting with the demo code provided and changing it as I described above.
Hi Tinus, I finally managed to integrate Leaflet Realtime into my page. There is still an error in updating the popup. Error already present in the example: [http://embed.plnkr.co/wwd1Xk/] "Uncaught TypeError: realtime.getLayer(...).getPopup is not a function" on the example the marker moves but the content of the popup is not updated (except manual refresh of the page) It's a detail for me I am already very happy with the result (under construction) 👍 https://perilous-overcoats.000webhostapp.com/BRM200.html
DANKJEWEL !
Hello, according to documentation, I am trying to test out using a function as a source since my actual source will return a set of multiple points updated in the last 2.5 minutes (must wait minimum time between calls). Updating the feature works, but updating popup info fails.
I'm testing it out like so:
`var source = {"geometry": {"type": "Point", "coordinates": [-91.40760834363121, 12.865107275099213]}, "type": "Feature", "properties": {"name": "Remote Mapper 1"}};
var realtime = L.realtime( function(success, error){ success(source); }, // { // url: 'https://wanderdrone.appspot.com/', // crossOrigin: true, // type: 'json' // }, { //min time interval to wait between calls to API, otherwise IP will get blocked. interval: 2.5 / 60 /1000 }).addTo(map);`
But I get an error: "Cannot read property 'setContent' of undefined" here in the example:
updateFeaturePopup = function(fId) { realtime.getLayer(fId).getPopup().setContent(popupContent(fId)); };