-
Notifications
You must be signed in to change notification settings - Fork 524
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
Does the intensity/altitude value work with individual points? #43
Comments
@eddielu No, the plugin should work with an array of individual points where the altitude values represent the intensity at that point (as explained in the docs). I am having the same issue with the most recent version of leaflet.heat, which seems buggy. The following test code... var heatData = [
[
-85.4667,
-142.4,
1
],
[
-38.0364,
141.9025,
278
],
[
-39.05835,
174.82185,
1596
],
...
];
var heatmap = L.heatLayer(heatData, {
minOpacity: 0.1,
max: _.maxBy(heatData, function(latLngDensity) { return latLngDensity[2]; })[2],
radius: 70,
blur: 30,
gradient: {
0.4: '#f23e45',
0.50: 'lime',
0.70: 'yellow',
0.95: '#FF8300',
1.0: 'red'
}
}).addTo(map); produces the following: However, when I run the exact same code with an older version of leaflet.heat (which I pulled out of a legacy project I'm taking over--the version number wasn't recorded), it produces something that looks like what I expect: If in the first example with the current version I manually set max to 15 (rather than the actual max altitude of ~61,000), it starts to look like what is produced in the second example. Leads me to think there's something buggy with the most recent version. Will compare the two versions I'm working with to see if I can pinpoint the issue. If anyone has any suggestions, please post. I'm running these tests in Chrome 47.0.2526.106 (64-bit). |
@jameslaneconkling looks like a perfect case for using |
I'm having the same problem with the most recent version, can anyone tell me how to get an older version without that bug? |
same issue here |
…blem when intensity not present based on some code very kindly provided by github user jameslaneconkling. the code in L.heat that redraws the layers was multiplying intensities by a value related to the zoom level stored in a variable named v. v is typically a very small number, ranging from .008 to .00002. The code works better if it just uses the intensity value. Since I only provide points with an intensity value set, I'm not sure what happens when the intensity isn't set. The code probably breaks. This commit is not intended as a permanent fix. Instead, it highlights where the problem is. I hope someone that knows the code better considers re-organizing the render loop perhaps treating separating it into two distinct pieces: one for when intensities are provided and one where they are not.
+1, my problem is probably related to this one. Namely, changing the background map (as I have several maps with different resolutions) will completely change the heatmap even when the data stays the same. This is probably due to point intensity being related to the zoom level, instead of staying the same? |
may also contain code for ca1f430
I have committed a pull request which resolves this issue: |
@jameslaneconkling If you have the older version of this library, can you please share? |
I wonder if this is the culprit: ... instead of just accumulating the I see that in L183 the This issue looks like it may be related to #65 also. |
This bug is 9 month old. |
People, isn't this critical or I miss something? Couldn't you write about this limitation in readme, instead praising how tiny and fast it is, so that we don't hit the wall, then google and browse issues to find nothing? For other poor souls, I found that this plugin behaves as one would expected from heatmap: https://www.patrick-wied.at/static/heatmapjs/plugin-leaflet-layer.html Although if you read this issue you are already aware perhaps... |
Sorry, with so many open source repos to maintain, this went off my radar. I'm going to triage some issues in Leaflet.heat this week and hopefully fix or clear up the biggest hurdles. |
This patch works by automatically setting the max as it changes on each zoom level as points get combined/separated. You no longer need to manually set options.max When calculating the max value it considers all points (even if they are off the screen). This way you always get the same results at a particular zoom level. Thanks to @spacemansteve for pointing me in the right direction ca1f430
Hi guy's, I've submitted a pull request which potentially resolves this issue #78 It removes the max option and instead works it out for itself at each zoom level after points have been consolidated. |
Leaflet#43 Patch to fix intensity/altitude issue (auto max)
Leaflet#43 Patch to fix intensity/altitude issue (auto max)
I have the same problem so far, what is the solution? |
…issue Leaflet#43 Patch to fix intensity/altitude issue (auto max)
Leaflet#43 Patch to fix intensity/altitude issue (auto max)
Leaflet#43 Patch to fix intensity/altitude issue (auto max)
Leaflet#43 Patch to fix intensity/altitude issue (auto max)
It seems that the only way to have sections show up as higher color intensities is to have several points clustered close together.
In other words, when given individual points (that are far apart from another) with different altitude values, the heatmap will show the same color of intensity for all points. Is this expected behavior?
The text was updated successfully, but these errors were encountered: