예제 #1
0
    def features(self, ds, start=0,limit = None, per_req=30):
        if limit is None:
            limit = ds.feature_count

        gen = jsonwrap.map_many(features.Feature).map

        sofar = 0
        while sofar < limit:
            if (sofar + per_req) >= limit:
                per_req = limit - sofar

            u = self.url("dataset_features_url", start=sofar, limit=per_req, id=ds.geoiq_id)
            fin,res = self.do_req(u, "GET", None, unwrapper=gen)
            for f in fin:
                sofar+=1
                yield f
예제 #2
0
    def features(self, ds, start=0, limit=None, per_req=30):
        if limit is None:
            limit = ds.feature_count

        gen = jsonwrap.map_many(features.Feature).map

        sofar = 0
        while sofar < limit:
            if (sofar + per_req) >= limit:
                per_req = limit - sofar

            u = self.url("dataset_features_url",
                         start=sofar,
                         limit=per_req,
                         id=ds.geoiq_id)
            fin, res = self.do_req(u, "GET", None, unwrapper=gen)
            for f in fin:
                sofar += 1
                yield f
예제 #3
0
class Map(geoiq.GeoIQObj):
    writeable = True

    def add_layer(self, source):
        if self.layers is None: self.layers = []
        if not isinstance(source, LayerSource):
            source = LayerSource(source, self.geoiq)

        res = Layer({"source": source})

        fin = self.svc.map_add_layer(self, res)
        self.refresh()

        for l in self.layers:
            if (l.source.dataset_id == source.dataset_id):
                return l
        raise ValueError("Couldn't find the saved layer?")


jsonwrap.props(
    Map,
    "title",
    "basemap",
    "description",
    "tags",
    "extent",
    "projection",
    "permissions",  # TODO: map to permissions
    layers={"map": jsonwrap.map_many(Layer)},
    contributor={"ro": True})
예제 #4
0
파일: map.py 프로젝트: geoiq/geoiq-python
    writeable = True
    
    def add_layer(self, source):
        if self.layers is None: self.layers = []
        if not isinstance(source, LayerSource):
            source = LayerSource(source, self.geoiq)

        res = Layer({"source":source})
        
        fin = self.svc.map_add_layer(self, res)
        self.refresh()

        for l in self.layers:
            if (l.source.dataset_id == source.dataset_id):
                return l
        raise ValueError("Couldn't find the saved layer?")



jsonwrap.props(Map, 
               "title",
               "basemap",
               "description",
               "tags",
               "extent",
               "projection",
               "permissions", # TODO: map to permissions
               layers={"map":jsonwrap.map_many(Layer)},
               contributor={"ro":True})

예제 #5
0
            loader = self.geoiq.maps.get_by_id
        elif self.is_analysis():
            loader = self.geoiq.analysis.get_by_id

        if (loader is None):
            raise NotImplementedError("No implementation for: " + tp + "yet.")

        return loader(self.key)


jsonwrap.props(SearchPointer, "detail_link", "description", "type", "tags",
               "author", "title", "id")


def search_pointers(ptrs, *args, **kwargs):
    return [SearchPointer(p, *args, **kwargs) for p in ptrs]


class SearchPage(jsonwrap.JsonWrappedObj):
    pass


jsonwrap.props(SearchPage,
               "totalResults",
               "itemsPerPage",
               "next",
               entries={
                   "ro": True,
                   "map": jsonwrap.map_many(SearchPointer)
               })
예제 #6
0
            loader = self.geoiq.analysis.get_by_id

        if (loader is None):
            raise NotImplementedError("No implementation for: " + tp + "yet.")
        
        return loader(self.key)


jsonwrap.props(SearchPointer,
               "detail_link",
               "description",
               "type",
               "tags",
               "author",
               "title",
               "id")


def search_pointers(ptrs, *args, **kwargs):
    return [SearchPointer(p,*args,**kwargs) for p in ptrs]

class SearchPage(jsonwrap.JsonWrappedObj):
    pass

jsonwrap.props(SearchPage,
               "totalResults",
               "itemsPerPage",
               "next",
               entries={ "ro":True, 
                         "map": jsonwrap.map_many(SearchPointer) })