def process_result(self, value, type): value = self.process_wkb(value) wkb_element = WKBSpatialElement(value, type.srid, type.name) if type.kwargs.has_key("diminfo"): # also set the DIMINFO data so that in can be used in function calls, see DimInfoFunction() if not type.kwargs.has_key("diminfo_sql"): # cache the SQLAlchemy text literal type.kwargs["diminfo_sql"] = text(type.kwargs["diminfo"]) wkb_element.DIMINFO = type.kwargs["diminfo_sql"] return OraclePersistentSpatialElement(wkb_element)
def test_render_reproject(self): session = FakeSession() spot_fieldset = FieldSet(Spot, session=session) spot_fieldset.the_geom.set(options=[('map_srid', 900913)]) spot = Spot() spot.id = 1 spot.the_geom = PersistentSpatialElement(PersistentSpatialElement(WKBSpatialElement('010'))); spot_fieldset = spot_fieldset.bind(spot) spot_fieldset.render() ok_(isinstance(session.scalar_args[0], functions.wkt), 'The geometry was not queried as WKT'); ok_(isinstance(session.scalar_args[0].arguments[0], functions.transform), 'The geometry was not reprojected');
def test_render(self): session = FakeSession() spot_fieldset = FieldSet(Spot, session=session) spot = Spot() spot.id = 1 spot.the_geom = PersistentSpatialElement(PersistentSpatialElement(WKBSpatialElement('010'))); spot_fieldset = spot_fieldset.bind(spot) form = spot_fieldset.render() ok_("geoformalchemy.init_map(" in form, 'Template was not rendered') ok_("'Point'," in form, 'OpenLayers geometry was not mapped correctly ') ok_("false," in form, 'Geometry should not be a collection') ok_(isinstance(session.scalar_args[0], functions.wkt), 'The geometry was not queried as WKT');
def process_result(self, value, type): return MSPersistentSpatialElement(WKBSpatialElement(value, type.srid))
def process_result(self, value, type): if type.wkt_internal: return PGPersistentSpatialElement( WKTSpatialElement(value, type.srid)) return PGPersistentSpatialElement(WKBSpatialElement(value, type.srid))