180 |
"""Return the name of the table in the database""" |
"""Return the name of the table in the database""" |
181 |
return self.tablename |
return self.tablename |
182 |
|
|
183 |
|
def Title(self): |
184 |
|
"""Return the title of the table. |
185 |
|
|
186 |
|
The title is currently fixed and equal to the tablename |
187 |
|
""" |
188 |
|
return self.tablename |
189 |
|
|
190 |
def Dependencies(self): |
def Dependencies(self): |
191 |
"""Return an empty tuple because a PostGISTable depends on nothing else |
"""Return an empty tuple because a PostGISTable depends on nothing else |
192 |
""" |
""" |
294 |
|
|
295 |
|
|
296 |
shapetype_map = {"POLYGON": SHAPETYPE_POLYGON, |
shapetype_map = {"POLYGON": SHAPETYPE_POLYGON, |
297 |
|
"MULTIPOLYGON": SHAPETYPE_POLYGON, |
298 |
"MULTILINESTRING": SHAPETYPE_ARC, |
"MULTILINESTRING": SHAPETYPE_ARC, |
299 |
"POINT": SHAPETYPE_POINT} |
"POINT": SHAPETYPE_POINT} |
300 |
|
|
374 |
cursor.close() |
cursor.close() |
375 |
return PostGISShape(shapeid, wkt) |
return PostGISShape(shapeid, wkt) |
376 |
|
|
377 |
|
def AllShapes(self): |
378 |
|
cursor = self.db.cursor() |
379 |
|
cursor.execute("SELECT gid, AsText(%s) FROM %s ORDER BY gid" |
380 |
|
% (self.geometry_column, self.tablename)) |
381 |
|
while 1: |
382 |
|
result = cursor.fetchone() |
383 |
|
if result is None: |
384 |
|
return |
385 |
|
yield PostGISShape(result[0], result[1]) |
386 |
|
|
387 |
|
|
388 |
def ShapesInRegion(self, bbox): |
def ShapesInRegion(self, bbox): |
389 |
"""Generate all shapes overlapping the region given by bbox.""" |
"""Generate all shapes overlapping the region given by bbox.""" |
390 |
# IMPORTANT:This will work for PostGIS < 0.8 |
# IMPORTANT:This will work for PostGIS < 0.8 |
400 |
while 1: |
while 1: |
401 |
result = cursor.fetchone() |
result = cursor.fetchone() |
402 |
if result is None: |
if result is None: |
403 |
raise StopIteration |
return |
404 |
yield PostGISShape(result[0], result[1]) |
yield PostGISShape(result[0], result[1]) |