Comments (10)
I'm also interested in this
from leaflet.heat.
Yeah, me too
from leaflet.heat.
This would be a great enhancement!
from leaflet.heat.
+1
from leaflet.heat.
I am also looking for the support of GeoJson data for heatmap. If we could optionally choose any attribute field as weighting factor, that would be ever better! Thanks!!!
from leaflet.heat.
I think this plugin should have as simple API as possible. You can always transform your GeoJSON data with simple function like this:
function geoJson2heat(geojson, intensity) {
return geojson.features.map(function(feature) {
return [
feature.geometry.coordinates[0][1],
feature.geometry.coordinates[0][0],
feature.properties[intensity]
];
});
}
from leaflet.heat.
While using this function to fetch the data...I get this following error....
Uncaught RangeError: Maximum call stack size exceeded on leaflet.js:6
var geoData = geoJson2heat(layer.data, 2);
// returns 0: Array[3] 0: "42.3439925" 1: "-3.696906" 2: "4", 1: Array[3] 0: "38.2733071"1: "-3.6065861"2: "3" .....
var heatMap = L.heatLayer(geoData,{ radius: 20,blur: 15, maxZoom: 17})
map.addLayer(heatMap);
function geoJson2heat(geojson, intensity) {
return geojson.features.map(function(feature) {
return [
feature.geometry.coordinates[1],
feature.geometry.coordinates[0],
feature.properties[intensity]
];
});
}
from leaflet.heat.
the main problem was double quotes in each array. Therefore, i did a tiny change(using parseFloat) in the same function and passing to directly L.heatLayer.. It seems working.
var geoData = geoJson2heat(layer.data, intensity);
var heatMap = new L.heatLayer(geoData,{radius: 30,blur: 15, maxZoom: 17});
geoJson2heat = function(geojson, intensity) {
return geojson.features.map(function(feature) {
return [parseFloat(feature.geometry.coordinates[1]), parseFloat(feature.geometry.coordinates[0]), intensity];
});
}
from leaflet.heat.
I agree with @mattesCZ, it should be easy enough to transform GeoJSON into a flat list of coordinates.
from leaflet.heat.
thankyou @ajgeers and @Jmuccigr i solved this issue
geoJson2heat = function(geojson) {
return geojson.features.map(function(feature) {
return [parseFloat(feature.geometry.coordinates[1]), parseFloat(feature.geometry.coordinates[0])];
});
}
function addObsToMap(obs, map) {
var geoData = geoJson2heat(obs, 1);
var heatMap = new L.heatLayer(geoData,{radius: 50, blur: 25, maxZoom: 17});
map.addLayer(heatMap);
}
from leaflet.heat.
Related Issues (20)
- IndexSizeError: Index or size is negative or greater than the allowed amount HOT 2
- maxZoom in leaflet HOT 2
- Need demo for adding heat using click
- Is it possible to change the intensity color based on the number of heatpoints combined in view? HOT 6
- Heatlayer radius over 80 creates strange object outside default heat HOT 1
- Layering different heat maps on top of eachother
- Crashes when container has 0 width/height HOT 2
- Zooming to bounds of points added. HOT 1
- How to add popup to heat points. HOT 1
- Crash on Firefox 72 on Mac (script is "blocked from extracting canvas data") HOT 7
- Laggy Heatmaps
- Demos don't work: Blocked loading mixed active content HOT 1
- ERROR: ENOENT: no such file or directory, open 'node_modules/simpleheat/simpleheat.js' HOT 1
- Not working offline HOT 1
- Uncaught TypeError: L.heatLayer is not a function HOT 2
- MaxOpacity HOT 2
- Intensity doesn't affect gradient HOT 1
- New npm release
- possible to add a legend ?
- Heatmap Gradient disapears when zooming in
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.heat.