Open Luigidefra opened 3 years ago
Hello,
is it possible refactoring code in PHP to run server side?
Yes you can probably do. However if your data is never move or change, you can consider using another algorithm server side, based on https://github.com/mourner/flatbush or similar. PruneCluster is a good algorithm when you don't have that much data and it's dynamic/moving.
What I did was copy the required functions from leaflet.js
and include those onto the server. (Not all of them are needed and some of them are front-end specific, making it incompatible with Node.js.)
Following that I created three functions on the server side, for POST
requests on "generating clusters", "collecting and doing statistics on members inside of markersArea
", and finally "transfering all markers of a certain cluster from backend to frontend if spiderfied
(expanded from a cluster into markers)".
Then on the frontend I modified the PruneCluster.js
to be included on the client side, making it capable of interacting with the services above.
I ended up with a MESSY CODE that processed a GeoJSON dataset of 100k points/63MB.
Nevertheless, I'll have to say, IT IS SATISFYING to see it actually works.
Hi, i have a little problem... I have 400k points, i used PruneCluster to create Cluster and it very fast, the problem is that i have to send a 400k points json from server to client before to create Cluster with your application... 400k points are equivalent to 26mb and it too big to send to client...
I would like create Cluster on my server and then send only Cluster with your coordinates and counter... is it possible refactoring code in PHP to run server side?
are there any other solutions?