- Timestamp:
- 01/05/11 12:17:19 (17 months ago)
- Location:
- framework/server/trunk/mapfish
- Files:
-
- 6 modified
-
protocol.py (modified) (2 diffs)
-
sqlalchemygeom.py (modified) (1 diff)
-
tests/test_mysql.py (modified) (3 diffs)
-
tests/test_oracle.py (modified) (4 diffs)
-
tests/test_postgis.py (modified) (2 diffs)
-
tests/test_spatialite.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
framework/server/trunk/mapfish/protocol.py
r3659 r3715 279 279 ret = FeatureCollection( 280 280 [self._filter_attrs(o.toFeature(), request) \ 281 for o in objs if o.geometry is not None])281 for o in objs]) 282 282 return ret 283 283 … … 311 311 response.status = 201 312 312 if len(objects) > 0: 313 features = [o.toFeature() for o in objects \ 314 if o.geometry is not None] 313 features = [o.toFeature() for o in objects] 315 314 return FeatureCollection(features) 316 315 return -
framework/server/trunk/mapfish/sqlalchemygeom.py
r3659 r3715 212 212 # we already have the geometry as Shapely geometry (when updating/inserting) 213 213 geometry = self.geometry.shape 214 el se:214 elif hasattr(self.geometry, 'geom_wkb') and self.geometry.geom_wkb is not None: 215 215 # create a Shapely geometry from the WKB geometry returned from the database 216 216 geometry = loads(str(self.geometry.geom_wkb)) 217 else: 218 geometry = None 217 219 218 220 return Feature(id=self.fid, 219 221 geometry=geometry, 220 222 properties=attributes, 221 bbox= geometry.bounds)223 bbox=None if geometry is None else geometry.bounds) 222 224 223 225 -
framework/server/trunk/mapfish/tests/test_mysql.py
r3659 r3715 60 60 spot_id = Column(Integer, primary_key=True) 61 61 spot_height = Column(Numeric(precision=10, scale=2, asdecimal=False)) 62 spot_location = GeometryColumn(Point(2 ))62 spot_location = GeometryColumn(Point(2, spatial_index=False), nullable=True) 63 63 64 64 GeometryDDL(Spot.__table__) … … 91 91 Spot(spot_height=783.55, spot_location='POINT(38 34)'), 92 92 Spot(spot_height=3454.67, spot_location='POINT(-134 45)'), 93 Spot(spot_height=6454.23, spot_location= 'POINT(-135 56)')93 Spot(spot_height=6454.23, spot_location=None) 94 94 ]) 95 95 … … 337 337 eq_(feature.geometry.coordinates, (0.0, 0.0)) 338 338 eq_(feature.properties["spot_height"], 420.39999999999998) 339 340 341 def test_protocol_read_one_null(self): 342 """Return one null feature""" 343 proto = Protocol(session, Spot) 344 345 feature = proto.read(FakeRequest({}), id=9) 346 ok_(feature is not None) 347 ok_(isinstance(feature, Feature)) 348 eq_(feature.id, 9) 349 # make use of __geo_interface__ property since 'geometry' 350 # value is not the same in various versions of geojson lib 351 ok_(feature.__geo_interface__['geometry'] is None) 352 ok_(feature.__geo_interface__['bbox'] is None) 339 353 340 354 -
framework/server/trunk/mapfish/tests/test_oracle.py
r3659 r3715 37 37 38 38 from geoalchemy import (Point, Polygon, GeometryColumn, GeometryDDL) 39 from geoalchemy.oracle import ORACLE_NULL_GEOMETRY 39 40 40 41 from mapfish.sqlalchemygeom import GeometryTableMixIn … … 107 108 Spot(spot_height=783.55, spot_location='POINT(38 34)'), 108 109 Spot(spot_height=3454.67, spot_location='POINT(-134 45)'), 109 Spot(spot_height=6454.23, spot_location= 'POINT(-135 56)')110 Spot(spot_height=6454.23, spot_location=ORACLE_NULL_GEOMETRY) 110 111 ]) 111 112 … … 295 296 296 297 filter = create_default_filter(request, Spot, additional_params={'params': 'unit=KM'}) 297 eq_(proto.count(request, filter=filter), ' 9')298 eq_(proto.count(request, filter=filter), '8') 298 299 299 300 … … 367 368 368 369 370 def test_protocol_read_one_null(self): 371 """Return one null feature""" 372 proto = Protocol(session, Spot) 373 374 feature = proto.read(FakeRequest({}), id=9) 375 ok_(feature is not None) 376 ok_(isinstance(feature, Feature)) 377 eq_(feature.id, 9) 378 # make use of __geo_interface__ property since 'geometry' 379 # value is not the same in various versions of geojson lib 380 ok_(feature.__geo_interface__['geometry'] is None) 381 ok_(feature.__geo_interface__['bbox'] is None) 382 383 369 384 @raises(HTTPNotFound) 370 385 def test_protocol_read_one_fails(self): -
framework/server/trunk/mapfish/tests/test_postgis.py
r3659 r3715 91 91 Spot(spot_height=783.55, spot_location='POINT(38 34)'), 92 92 Spot(spot_height=3454.67, spot_location='POINT(-134 45)'), 93 Spot(spot_height=6454.23, spot_location= 'POINT(-135 56)')93 Spot(spot_height=6454.23, spot_location=None) 94 94 ]) 95 95 … … 329 329 eq_(feature.geometry.coordinates, (0.0, 0.0)) 330 330 eq_(feature.properties["spot_height"], 420.39999999999998) 331 332 333 def test_protocol_read_one_null(self): 334 """Return one null feature""" 335 proto = Protocol(session, Spot) 336 337 feature = proto.read(FakeRequest({}), id=9) 338 ok_(feature is not None) 339 ok_(isinstance(feature, Feature)) 340 eq_(feature.id, 9) 341 # make use of __geo_interface__ property since 'geometry' 342 # value is not the same in various versions of geojson lib 343 ok_(feature.__geo_interface__['geometry'] is None) 344 ok_(feature.__geo_interface__['bbox'] is None) 331 345 332 346 -
framework/server/trunk/mapfish/tests/test_spatialite.py
r3659 r3715 110 110 Spot(spot_height=783.55, spot_location='POINT(38 34)'), 111 111 Spot(spot_height=3454.67, spot_location='POINT(-134 45)'), 112 Spot(spot_height=6454.23, spot_location= 'POINT(-135 56)')112 Spot(spot_height=6454.23, spot_location=None) 113 113 ]) 114 114 … … 349 349 eq_(feature.properties["spot_height"], 420.39999999999998) 350 350 proto = Protocol(session, Spot) 351 352 353 def test_protocol_read_one_null(self): 354 """Return one null feature""" 355 proto = Protocol(session, Spot) 356 357 feature = proto.read(FakeRequest({}), id=9) 358 ok_(feature is not None) 359 ok_(isinstance(feature, Feature)) 360 eq_(feature.id, 9) 361 # make use of __geo_interface__ property since 'geometry' 362 # value is not the same in various versions of geojson lib 363 ok_(feature.__geo_interface__['geometry'] is None) 364 ok_(feature.__geo_interface__['bbox'] is None) 351 365 352 366
