def getClusterContent(request, zoom, gridSize): clusterer = MapClusterer(request, zoom, gridSize) entries = clusterer.getClusterContent() return render(request, 'anycluster/clusterPopup.html', {'entries':entries})
def getGrid(request, zoom, gridSize=256): clusterer = MapClusterer(zoom, gridSize) grid = clusterer.gridCluster(request) return HttpResponse(json.dumps(grid), content_type="application/json")
def getPins(request, zoom, gridSize, gt_filter=0): clusterer = MapClusterer(zoom, gridSize) gt_filter = long(gt_filter) markers = clusterer.kmeansCluster(request, filter_gt_count=gt_filter) return HttpResponse(json.dumps(markers), content_type="application/json")
def loadAreaContent(request, zoom, gridSize): clusterer = MapClusterer(zoom, gridSize) params = clusterer.loadJson(request) filterstring = clusterer.constructFilterstring(params["filters"]) geojson = params["geojson"] markers = [] if geojson["type"] == "Feature": features = [params["geojson"]] elif geojson["type"] == "FeatureCollection": features = geojson["features"] for feature in features: geometry = GEOSGeometry(json.dumps(feature["geometry"]), srid=clusterer.input_srid) geometry.transform(clusterer.srid_db) markers_qry = Gis.objects.raw( '''SELECT * FROM "%s" WHERE ST_Intersects(%s, ST_GeomFromText('%s',%s) ) %s;''' % (geo_table, geo_column_str, geometry, clusterer.srid_db, filterstring) ) markers += list(markers_qry) return markers
def getAreaContent(request, zoom, gridSize): clusterer = MapClusterer(request, zoom, gridSize) entries = clusterer.getAreaContent() return render(request, 'anycluster/clusterPopup.html', {'entries': entries})
def getPins(request, zoom, gridSize): clusterer = MapClusterer(request, zoom, gridSize) markers = clusterer.kmeansCluster() return HttpResponse(json.dumps(markers), content_type="application/json")
def getCentroids(request, zoom, gridSize): clusterer = MapClusterer(zoom, gridSize) markers = clusterer.centroidCluster(request) return HttpResponse(json.dumps( markers ), content_type="application/json")
def getPins(request, zoom, gridSize): clusterer = MapClusterer(request, zoom, gridSize) markers = clusterer.kmeansCluster() return HttpResponse(json.dumps( markers ), content_type="application/json")
def getGrid(request, zoom, gridSize=256): clusterer = MapClusterer(request, zoom, gridSize) grid = clusterer.gridCluster() return HttpResponse(json.dumps( grid ), content_type="application/json")
def getKmeansClusterEntries(request, zoom, gridSize=512): clusterer = MapClusterer(zoom, gridSize) filters = clusterer.parseFilters(request) clusterIDs = request.GET.getlist("id", []) x = float(request.GET["x"]) y = float(request.GET["y"]) entries = clusterer.getKmeansClusterContent(x, y, clusterIDs, filters) return entries
def loadAreaContent(request, zoom=1, gridSize=256): clusterer = MapClusterer(zoom, gridSize) params = clusterer.loadJson(request) filterstring = clusterer.constructFilterstring(params["filters"]) geojson = params.get("geojson", None) geomfilterstring = clusterer.getGeomFilterstring(request, geojson) markers_qryset = Gis.objects.raw( '''SELECT * FROM "%s" WHERE %s %s;''' % (geo_table, geomfilterstring, filterstring)) return markers_qryset
def loadAreaContent(request, zoom=1, gridSize=256): clusterer = MapClusterer(zoom, gridSize) params = clusterer.loadJson(request) filterstring = clusterer.constructFilterstring(params["filters"]) geojson = params.get("geojson", None) geomfilterstring = clusterer.getGeomFilterstring(geojson) markers_qryset = Gis.objects.raw( '''SELECT * FROM "%s" WHERE %s %s;''' % (geo_table, geomfilterstring, filterstring) ) return markers_qryset
def get_clusterer(self, request, zoom, grid_size, **kwargs): clusterer = MapClusterer(request, zoom, grid_size) return clusterer
def get_clusterer(self, request, zoom, grid_size, **kwargs): init_kwargs = get_init_kwargs(request) clusterer = MapClusterer(request, zoom, grid_size, **init_kwargs) return clusterer