Beispiel #1
0
def getClusterContent(request, zoom, gridSize):

    clusterer = MapClusterer(request, zoom, gridSize)

    entries = clusterer.getClusterContent()

    return render(request, 'anycluster/clusterPopup.html', {'entries':entries})
Beispiel #2
0
def getGrid(request, zoom, gridSize=256):

    clusterer = MapClusterer(zoom, gridSize)

    grid = clusterer.gridCluster(request)

    return HttpResponse(json.dumps(grid), content_type="application/json")
Beispiel #3
0
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")
Beispiel #4
0
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
Beispiel #5
0
def getAreaContent(request, zoom, gridSize):

    clusterer = MapClusterer(request, zoom, gridSize)
    entries = clusterer.getAreaContent()

    return render(request, 'anycluster/clusterPopup.html',
                  {'entries': entries})
Beispiel #6
0
def getPins(request, zoom, gridSize):

    clusterer = MapClusterer(request, zoom, gridSize)

    markers = clusterer.kmeansCluster()

    return HttpResponse(json.dumps(markers), content_type="application/json")
Beispiel #7
0
def getCentroids(request, zoom, gridSize):
    clusterer = MapClusterer(zoom, gridSize)

    markers = clusterer.centroidCluster(request)
    
    return HttpResponse(json.dumps(
        markers
        ), content_type="application/json")
Beispiel #8
0
def getPins(request, zoom, gridSize):

    clusterer = MapClusterer(request, zoom, gridSize)

    markers = clusterer.kmeansCluster()
    
    return HttpResponse(json.dumps(
        markers
        ), content_type="application/json")
Beispiel #9
0
def getGrid(request, zoom, gridSize=256):

    clusterer = MapClusterer(request, zoom, gridSize)

    grid = clusterer.gridCluster()
    
    return HttpResponse(json.dumps(
        grid
        ), content_type="application/json")
Beispiel #10
0
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
Beispiel #11
0
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
Beispiel #12
0
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
Beispiel #13
0
 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