{"type": "Feature", "id": {$id}, "geometry": {"type": "Point", "coordinates": [{$xp},{$yp}]}, "properties": {"iconContent": "{$summ}", "hintContent": "{$name}, {$address}"}}
var objectManager = new ymaps.LoadingObjectManager('_url_____spatial_mysql_?bbox=%b', { clusterize: true, clusterHasBalloon: false, clusterIconLayout: ymaps.templateLayoutFactory.createClass('<div class="outercluster"><div class="cluster" id="counter-$[id]"></div></div>',{ build: function () { this.constructor.superclass.build.call(this); i=0; for(o in this.getData().properties.geoObjects) { i+=parseInt(this.getData().properties.geoObjects[o].properties.iconContent); } $('#counter-'+this.getData().id).html(i); } }), clusterIconShape: { type: 'Circle',// islands#orangeClusterIcons coordinates: [0, 0], radius: 25// css }, geoObjectOpenBalloonOnClick: false, gridSize: 32 });
.outercluster { position: absolute; left: -25px; top: -25px; border-radius: 50%; width: 50px; height: 50px; background: #FFFFFF; border: 0; padding-top: 2px; } .cluster { border-radius: 50%; width: 46px; height: 46px; background: #FFFFFF; border: 6px solid orange; text-align: center; padding-top: 5px; margin-left: 2px; }
SELECT id, name, address, summ, X(point) AS xp, Y(point) AS yp FROM points FORCE INDEX (point) WHERE MBRContains(GeomFromText( 'LINESTRING({$carr[0]} {$carr[1]},{$carr[2]} {$carr[3]})' ),point)
$carr=array(0,0,0,0); if(isset($_GET['bbox'])) { $coords=explode(',',$_GET['bbox']); if(count($coords)==4) { $carr=array(); foreach($coords as $c) { $carr[]=floatval($c); } } }
Source: https://habr.com/ru/post/349356/
All Articles