Esempio n. 1
0
    def get_feature_info(self, wherex, wherey, layers, callback, format, feature_count, srs, filter):
        if type(srs) is int:
            kind = "srid"
        elif srs.upper().startswith("EPSG"):
            kind = None
        elif srs.startswith("-") or srs.startswith("+"):
            kind = "proj"
        else:
            kind = "wkt"

        s_srs = create_spatialref(srs, srs_format=kind)
        t_srs = self.cls.srs
        crx = osr.CoordinateTransformation(s_srs, t_srs)
        wherex, wherey, _0 = crx.TransformPoint(wherex, wherey, 0)

        if not filter:
            return [
                self.cls.objects.filter({layer + "__contains": g.Point(wherex, wherey)}).limit(feature_count).values()
                for layer in layers
            ]
        else:
            return [
                self.cls.objects.filter({layer + "__contains": g.Point(wherex, wherey)})
                .filter(**filter)
                .limit(feature_count)
                .values()
                for layer in layers
            ]
Esempio n. 2
0
    def get_feature_info(self, wherex, wherey, layers, callback, format,
                         feature_count, srs, filter):
        if type(srs) is int:
            kind = 'srid'
        elif srs.upper().startswith('EPSG'):
            kind = None
        elif srs.startswith('-') or srs.startswith('+'):
            kind = 'proj'
        else:
            kind = 'wkt'

        s_srs = create_spatialref(srs, srs_format=kind)
        t_srs = self.cls.srs
        crx = osr.CoordinateTransformation(s_srs, t_srs)
        wherex, wherey, _0 = crx.TransformPoint(wherex, wherey, 0)

        if not filter:
            return [
                self.cls.objects.filter({
                    layer + "__contains":
                    g.Point(wherex, wherey)
                }).limit(feature_count).values() for layer in layers
            ]
        else:
            return [
                self.cls.objects.filter({
                    layer + "__contains":
                    g.Point(wherex, wherey)
                }).filter(**filter).limit(feature_count).values()
                for layer in layers
            ]
Esempio n. 3
0
    def get_feature_info(self, wherex, wherey, layers, callback, format,
                         feature_count, srs, filter):
        if type(srs) is int:
            kind = 'srid'
        elif srs.upper().startswith('EPSG'):
            kind = None
        elif srs.startswith('-') or srs.startswith('+'):
            kind = 'proj'
        else:
            kind = 'wkt'

        s_srs = create_spatialref(srs, srs_format=kind)
        t_srs = self.dataset.GetSpatialRef()
        crx = osr.CoordinateTransformation(s_srs, t_srs)
        wherex, wherey, _0 = crx.TransformPoint(wherex, wherey, 0)

        if not filter:
            for layer in layers:
                l = self.dataset.GetLayerByName(layer)
                l.ResetReading()
                l.SetSpatialFilterRect(wherex, wherey, wherex + 0.0001,
                                       wherey + 0.0001)
                return [f for f in l]
        else:
            for layer in layers:
                l = self.dataset.GetLayerByName(layer)
                l.ResetReading()
                l.SetSpatialFilterRect(wherex, wherey, wherex + 0.0001,
                                       wherey + 0.0001)
                return [f for f in l]  # TODO apply filter.
Esempio n. 4
0
    def get_feature_info(self, wherex, wherey, layers, callback, format, feature_count, srs, filter):
        if type(srs) is int:
            kind='srid'
        elif srs.upper().startswith('EPSG'):
            kind=None
        elif srs.startswith('-') or srs.startswith('+'):
            kind='proj'
        else:
            kind='wkt'

        s_srs = create_spatialref(srs, srs_format=kind)
        t_srs = self.dataset.GetSpatialRef()
        crx = osr.CoordinateTransformation(s_srs, t_srs)
        wherex, wherey, _0 = crx.TransformPoint(wherex, wherey, 0)

        if not filter:
            for layer in layers:
                l = self.dataset.GetLayerByName(layer)
                l.ResetReading()
                l.SetSpatialFilterRect(wherex, wherey, wherex+0.0001, wherey+0.0001)
                return [f for f in l]
        else:
            for layer in layers:
                l = self.dataset.GetLayerByName(layer)
                l.ResetReading()
                l.SetSpatialFilterRect(wherex, wherey, wherex+0.0001, wherey+0.0001)
                return [f for f in l] # TODO apply filter.