GeoAlchemy2 0.6.2__tar.gz → 0.6.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/CHANGES.txt +10 -0
  2. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3/GeoAlchemy2.egg-info}/PKG-INFO +1 -1
  3. {GeoAlchemy2-0.6.2/GeoAlchemy2.egg-info → GeoAlchemy2-0.6.3}/PKG-INFO +1 -1
  4. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/geoalchemy2/__init__.py +18 -10
  5. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/geoalchemy2/comparator.py +1 -1
  6. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/geoalchemy2/functions.py +310 -21
  7. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/geoalchemy2/types.py +26 -19
  8. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/setup.py +1 -1
  9. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/COPYING.rst +0 -0
  10. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/GeoAlchemy2.egg-info/SOURCES.txt +0 -0
  11. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/GeoAlchemy2.egg-info/dependency_links.txt +0 -0
  12. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/GeoAlchemy2.egg-info/entry_points.txt +0 -0
  13. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/GeoAlchemy2.egg-info/not-zip-safe +0 -0
  14. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/GeoAlchemy2.egg-info/requires.txt +0 -0
  15. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/GeoAlchemy2.egg-info/top_level.txt +0 -0
  16. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/MANIFEST.in +0 -0
  17. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/README.rst +0 -0
  18. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/RELEASE.rst +0 -0
  19. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/TEST.rst +0 -0
  20. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/geoalchemy2/compat.py +0 -0
  21. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/geoalchemy2/elements.py +0 -0
  22. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/geoalchemy2/exc.py +0 -0
  23. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/geoalchemy2/shape.py +0 -0
  24. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/requirements-rtd.txt +0 -0
  25. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/requirements.txt +0 -0
  26. {GeoAlchemy2-0.6.2 → GeoAlchemy2-0.6.3}/setup.cfg +0 -0
@@ -1,6 +1,16 @@
1
1
  GeoAlchemy 2 Changelog
2
2
  ======================
3
3
 
4
+ 0.6.3
5
+ -----
6
+
7
+ * Add some missing functions @adrien-berchet (#224)
8
+ * Do not register functions.GenericFunction for sqlalchemy>=1.3.4 @adrien-berchet (#226)
9
+ * Redefine the geometry_type/dimension consistency checks @elemoine (#228)
10
+ * Correct a spelling mistake @EdwardBetts (#229)
11
+ * Do not assume the "public" schema @elemoine (#231)
12
+ * Add all geometry constructors @adrien-berchet (#232)
13
+
4
14
  0.6.2
5
15
  -----
6
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: GeoAlchemy2
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: Using SQLAlchemy with Spatial Databases
5
5
  Home-page: http://geoalchemy.org/
6
6
  Author: Eric Lemoine
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: GeoAlchemy2
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: Using SQLAlchemy with Spatial Databases
5
5
  Home-page: http://geoalchemy.org/
6
6
  Author: Eric Lemoine
@@ -59,7 +59,6 @@ def _setup_ddl_event_listeners():
59
59
 
60
60
  if event == 'before-drop':
61
61
  # Drop the managed Geometry columns
62
- table_schema = table.schema or 'public'
63
62
  for c in gis_cols:
64
63
  if bind.dialect.name == 'sqlite':
65
64
  drop_func = 'DiscardGeometryColumn'
@@ -78,7 +77,6 @@ def _setup_ddl_event_listeners():
78
77
  # Restore original column list including managed Geometry columns
79
78
  table.columns = table.info.pop('_saved_columns')
80
79
 
81
- table_schema = table.schema or 'public'
82
80
  for c in table.c:
83
81
  # Add the managed Geometry columns with AddGeometryColumn()
84
82
  if isinstance(c.type, Geometry) and c.type.management is True:
@@ -105,10 +103,15 @@ def _setup_ddl_event_listeners():
105
103
  stmt = stmt.execution_options(autocommit=True)
106
104
  bind.execute(stmt)
107
105
  elif bind.dialect.name == 'postgresql':
108
- bind.execute('CREATE INDEX "idx_%s_%s" ON "%s"."%s" '
109
- 'USING GIST ("%s")' %
110
- (table.name, c.name, table_schema,
111
- table.name, c.name))
106
+ if table.schema:
107
+ bind.execute('CREATE INDEX "idx_%s_%s" ON "%s"."%s" '
108
+ 'USING GIST ("%s")' %
109
+ (table.name, c.name, table.schema,
110
+ table.name, c.name))
111
+ else:
112
+ bind.execute('CREATE INDEX "idx_%s_%s" ON "%s" '
113
+ 'USING GIST ("%s")' %
114
+ (table.name, c.name, table.name, c.name))
112
115
  else:
113
116
  raise ArgumentError('dialect {} is not supported'.format(bind.dialect.name))
114
117
 
@@ -117,10 +120,15 @@ def _setup_ddl_event_listeners():
117
120
  # Note the use of ST_ConvexHull since most raster operators are
118
121
  # based on the convex hull of the rasters.
119
122
  if isinstance(c.type, Raster) and c.type.spatial_index is True:
120
- bind.execute('CREATE INDEX "idx_%s_%s" ON "%s"."%s" '
121
- 'USING GIST (ST_ConvexHull("%s"))' %
122
- (table.name, c.name, table_schema,
123
- table.name, c.name))
123
+ if table.schema:
124
+ bind.execute('CREATE INDEX "idx_%s_%s" ON "%s"."%s" '
125
+ 'USING GIST (ST_ConvexHull("%s"))' %
126
+ (table.name, c.name, table.schema,
127
+ table.name, c.name))
128
+ else:
129
+ bind.execute('CREATE INDEX "idx_%s_%s" ON "%s" '
130
+ 'USING GIST (ST_ConvexHull("%s"))' %
131
+ (table.name, c.name, table.name, c.name))
124
132
 
125
133
  elif event == 'after-drop':
126
134
  # Restore original column list including managed Geometry columns
@@ -86,7 +86,7 @@ class BaseComparator(UserDefinedType.Comparator):
86
86
  # This is not to mess up with SQLAlchemy's use of
87
87
  # hasattr/getattr on Column objects.
88
88
 
89
- if not name.startswith('ST_'):
89
+ if not name.lower().startswith('st_'):
90
90
  raise AttributeError
91
91
 
92
92
  # We create our own _FunctionGenerator here, and use it in place of
@@ -84,6 +84,10 @@ class GenericFunction(functions.GenericFunction):
84
84
  type = Geometry
85
85
  """
86
86
 
87
+ # Set _register to False in order not to register this class in
88
+ # sqlalchemy.sql.functions._registry. Only its children will be registered.
89
+ _register = False
90
+
87
91
  def __init__(self, *args, **kwargs):
88
92
  expr = kwargs.pop('expr', None)
89
93
  if expr is not None:
@@ -96,15 +100,180 @@ class GenericFunction(functions.GenericFunction):
96
100
 
97
101
 
98
102
  _FUNCTIONS = [
103
+ #
104
+ # Geometry Constructors
105
+ #
106
+
107
+ ('ST_BdPolyFromText', types.Geometry,
108
+ 'Construct a Polygon given an arbitrary collection of closed linestrings'
109
+ 'as a MultiLineString Well-Known text representation.'),
110
+
111
+ ('ST_BdMPolyFromText', types.Geometry,
112
+ 'Construct a MultiPolygon given an arbitrary collection of closed '
113
+ 'linestrings as a MultiLineString text representation Well-Known text '
114
+ 'representation.'),
115
+
116
+ ('ST_Box2dFromGeoHash', types.Geometry,
117
+ 'Return a BOX2D from a GeoHash string.'),
118
+
119
+ ('ST_GeogFromText', types.Geography,
120
+ 'Return a specified geography value from Well-Known Text representation '
121
+ 'or extended (WKT).'),
122
+
123
+ ('ST_GeographyFromText', types.Geography,
124
+ 'Return a specified geography value from Well-Known Text representation '
125
+ 'or extended (WKT).'),
126
+
127
+ ('ST_GeogFromWKB', types.Geography,
128
+ 'Creates a geography instance from a Well-Known Binary geometry '
129
+ 'representation (WKB) or extended Well Known Binary (EWKB).'),
130
+
131
+ ('ST_GeomFromTWKB', types.Geometry,
132
+ 'Creates a geometry instance from a TWKB ("Tiny Well-Known Binary") '
133
+ 'geometry representation.'),
134
+
135
+ ('ST_GeomCollFromText', types.Geometry,
136
+ 'Makes a collection Geometry from collection WKT with the given SRID. If '
137
+ 'SRID is not given, it defaults to 0.'),
138
+
139
+ ('ST_GeomFromEWKB', types.Geometry,
140
+ 'Return a specified ST_Geometry value from Extended Well-Known Binary '
141
+ 'representation (EWKB).'),
142
+
143
+ ('ST_GeomFromEWKT', types.Geometry,
144
+ 'Return a specified ST_Geometry value from Extended Well-Known Text '
145
+ 'representation (EWKT).'),
146
+
147
+ ('ST_GeometryFromText', types.Geometry,
148
+ 'Return a specified ST_Geometry value from Well-Known Text representation'
149
+ ' (WKT). This is an alias name for ST_GeomFromText'),
150
+
151
+ ('ST_GeomFromGeoHash', types.Geometry,
152
+ 'Return a geometry from a GeoHash string.'),
153
+
154
+ ('ST_GeomFromGML', types.Geometry,
155
+ 'Takes as input GML representation of geometry and outputs a PostGIS '
156
+ 'geometry object'),
157
+
158
+ ('ST_GeomFromGeoJSON', types.Geometry,
159
+ 'Takes as input a geojson representation of a geometry and outputs a '
160
+ 'PostGIS geometry object'),
161
+
162
+ ('ST_GeomFromKML', types.Geometry,
163
+ 'Takes as input KML representation of geometry and outputs a PostGIS '
164
+ 'geometry object'),
165
+
166
+ ('ST_GMLToSQL', types.Geometry,
167
+ 'Return a specified ST_Geometry value from GML representation. This is an'
168
+ ' alias name for ST_GeomFromGML'),
169
+
170
+ ('ST_GeomFromText', types.Geometry,
171
+ 'Return a specified ST_Geometry value from Well-Known Text representation'
172
+ ' (WKT).'),
173
+
174
+ ('ST_GeomFromWKB', types.Geometry,
175
+ 'Creates a geometry instance from a Well-Known Binary geometry '
176
+ 'representation (WKB) and optional SRID.'),
177
+
178
+ ('ST_LineFromEncodedPolyline', types.Geometry,
179
+ 'Creates a LineString from an Encoded Polyline.'),
180
+
181
+ ('ST_LineFromMultiPoint', types.Geometry,
182
+ 'Creates a LineString from a MultiPoint geometry.'),
183
+
184
+ ('ST_LineFromText', types.Geometry,
185
+ 'Makes a Geometry from WKT representation with the given SRID. If SRID is'
186
+ ' not given, it defaults to 0.'),
187
+
188
+ ('ST_LineFromWKB', types.Geometry,
189
+ 'Makes a LINESTRING from WKB with the given SRID'),
190
+
191
+ ('ST_LinestringFromWKB', types.Geometry,
192
+ 'Makes a geometry from WKB with the given SRID.'),
193
+
194
+ ('ST_MakeBox2D', types.Geometry,
195
+ 'Creates a BOX2D defined by the given point geometries.'),
196
+
197
+ ('ST_3DMakeBox', types.Geometry,
198
+ 'Creates a BOX3D defined by the given 3d point geometries.'),
199
+
200
+ ('ST_MakeLine', types.Geometry,
201
+ 'Creates a Linestring from point, multipoint, or line geometries.'),
202
+
203
+ ('ST_MakeEnvelope', types.Geometry,
204
+ 'Creates a rectangular Polygon formed from the given minimums and '
205
+ 'maximums. Input values must be in SRS specified by the SRID.'),
206
+
207
+ ('ST_MakePolygon', types.Geometry,
208
+ 'Creates a Polygon formed by the given shell. Input geometries must be '
209
+ 'closed LINESTRINGS.'),
210
+
211
+ ('ST_MakePoint', types.Geometry,
212
+ 'Creates a 2D, 3DZ or 4D point geometry.'),
213
+
214
+ ('ST_MakePointM', types.Geometry,
215
+ 'Creates a point geometry with an x y and m coordinate.'),
216
+
217
+ ('ST_MLineFromText', types.Geometry,
218
+ 'Return a specified ST_MultiLineString value from WKT representation.'),
219
+
220
+ ('ST_MPointFromText', types.Geometry,
221
+ 'Makes a Geometry from WKT with the given SRID. If SRID is not given, it '
222
+ 'defaults to 0.'),
223
+
224
+ ('ST_MPolyFromText', types.Geometry,
225
+ 'Makes a MultiPolygon Geometry from WKT with the given SRID. If SRID is '
226
+ 'not given, it defaults to 0.'),
227
+
228
+ ('ST_Point', types.Geometry,
229
+ 'Returns an ST_Point with the given coordinate values. OGC alias for '
230
+ 'ST_MakePoint.'),
231
+
232
+ ('ST_PointFromGeoHash', types.Geometry,
233
+ 'Return a point from a GeoHash string.'),
234
+
235
+ ('ST_PointFromText', types.Geometry,
236
+ 'Makes a point Geometry from WKT with the given SRID. If SRID is not '
237
+ 'given, it defaults to unknown.'),
238
+
239
+ ('ST_PointFromWKB', types.Geometry,
240
+ 'Makes a geometry from WKB with the given SRID'),
241
+
242
+ ('ST_Polygon', types.Geometry,
243
+ 'Returns a polygon built from the specified linestring and SRID.'),
244
+
245
+ ('ST_PolygonFromText', types.Geometry,
246
+ 'Makes a Geometry from WKT with the given SRID. If SRID is not given, it '
247
+ 'defaults to 0.'),
248
+
249
+ ('ST_WKBToSQL', types.Geometry,
250
+ 'Return a specified ST_Geometry value from Well-Known Binary '
251
+ 'representation (WKB). This is an alias name for ST_GeomFromWKB that '
252
+ 'takes no srid'),
253
+
254
+ ('ST_WKTToSQL', types.Geometry,
255
+ 'Return a specified ST_Geometry value from Well-Known Text representation'
256
+ ' (WKT). This is an alias name for ST_GeomFromText'),
257
+
99
258
  #
100
259
  # Geometry Accessors
101
260
  #
102
261
 
262
+ ('ST_Boundary', types.Geometry,
263
+ 'Returns the closure of the combinatorial boundary of this Geometry.'),
264
+
265
+ ('ST_BoundingDiagonal', types.Geometry,
266
+ 'Returns the diagonal of the supplied geometry\'s bounding box.'),
267
+
268
+ ('ST_EndPoint', types.Geometry,
269
+ 'Returns the last point of a ``LINESTRING`` or ``CIRCULARLINESTRING`` '
270
+ 'geometry as a ``POINT``.'),
271
+
103
272
  ('ST_Envelope', types.Geometry,
104
273
  'Returns a geometry representing the double precision (float8) bounding'
105
274
  'box of the supplied geometry.'),
106
275
 
107
- ('ST_GeometryN', None,
276
+ ('ST_GeometryN', types.Geometry,
108
277
  'Return the 1-based Nth geometry if the geometry is a '
109
278
  '``GEOMETRYCOLLECTION``, ``(MULTI)POINT``, ``(MULTI)LINESTRING``, '
110
279
  '``MULTICURVE`` or ``(MULTI)POLYGON``, ``POLYHEDRALSURFACE`` Otherwise, '
@@ -113,16 +282,38 @@ _FUNCTIONS = [
113
282
  ('ST_GeometryType', None,
114
283
  'Return the geometry type of the ``ST_Geometry`` value.'),
115
284
 
285
+ ('ST_InteriorRingN', types.Geometry,
286
+ 'Return the Nth interior linestring ring of the polygon geometry. Return '
287
+ '``NULL`` if the geometry is not a polygon or the given N is out of '
288
+ 'range.'),
289
+
116
290
  ('ST_IsValid', None,
117
291
  'Returns ``True`` if the ``ST_Geometry`` is well formed.'),
118
292
 
119
293
  ('ST_NPoints', None,
120
294
  'Return the number of points (vertices) in a geometry.'),
121
295
 
296
+ ('ST_PatchN', types.Geometry,
297
+ 'Return the 1-based Nth geometry (face) if the geometry is a '
298
+ '``POLYHEDRALSURFACE``, ``POLYHEDRALSURFACEM``. Otherwise, return '
299
+ '``NULL``.'),
300
+
301
+ ('ST_PointN', types.Geometry,
302
+ 'Return the Nth point in the first LineString or circular LineString in '
303
+ 'the geometry. Negative values are counted backwards from the end of the '
304
+ 'LineString. Returns ``NULL`` if there is no linestring in the geometry.'
305
+ ),
306
+
307
+ ('ST_Points', types.Geometry,
308
+ 'Returns a MultiPoint containing all of the coordinates of a geometry.'),
309
+
122
310
  ('ST_SRID', None,
123
311
  'Returns the spatial reference identifier for the ``ST_Geometry`` as '
124
312
  'defined in ``spatial_ref_sys`` table.'),
125
313
 
314
+ ('ST_StartPoint', types.Geometry,
315
+ 'Returns the first point of a ``LINESTRING`` geometry as a ``POINT``.'),
316
+
126
317
  ('ST_X', None,
127
318
  'Return the X coordinate of the point, or ``None`` if not available. '
128
319
  'Input must be a point.'),
@@ -139,10 +330,124 @@ _FUNCTIONS = [
139
330
  # Geometry Editors
140
331
  #
141
332
 
333
+ ('ST_AddPoint', types.Geometry,
334
+ 'Add a point to a LineString.'),
335
+
336
+ ('ST_Affine', types.Geometry,
337
+ 'Apply a 3d affine transformation to a geometry.'),
338
+
339
+ ('ST_CollectionExtract', types.Geometry,
340
+ 'Given a (multi)geometry, return a (multi)geometry consisting only of '
341
+ 'elements of the specified type.'),
342
+
343
+ ('ST_CollectionHomogenize', types.Geometry,
344
+ 'Given a geometry collection, return the "simplest" representation of '
345
+ 'the contents.'),
346
+
347
+ ('ST_ExteriorRing', types.Geometry,
348
+ 'Returns a line string representing the exterior ring of the ``POLYGON`` '
349
+ 'geometry. Return ``NULL`` if the geometry is not a polygon. Will not '
350
+ 'work with ``MULTIPOLYGON``.'),
351
+
352
+ ('ST_Force2D', types.Geometry,
353
+ 'Force the geometries into a "2-dimensional mode".'),
354
+
355
+ ('ST_Force3D', types.Geometry,
356
+ ('Force the geometries into XYZ mode. This is an alias for ``ST_Force3DZ``.',
357
+ 'ST_Force_3D')),
358
+
359
+ ('ST_Force3DM', types.Geometry,
360
+ ('Force the geometries into XYM mode.', 'ST_Force_3DM')),
361
+
362
+ ('ST_Force3DZ', types.Geometry,
363
+ ('Force the geometries into XYZ mode.', 'ST_Force_3DZ')),
364
+
365
+ ('ST_Force4D', types.Geometry,
366
+ ('Force the geometries into XYZM mode.', 'ST_Force_4D')),
367
+
368
+ ('ST_ForceCollection', types.Geometry,
369
+ ('Convert the geometry into a ``GEOMETRYCOLLECTION``.',
370
+ 'ST_Force_Collection')),
371
+
372
+ ('ST_ForceCurve', types.Geometry,
373
+ 'Upcast a geometry into its curved type, if applicable.'),
374
+
375
+ ('ST_ForcePolygonCCW', types.Geometry,
376
+ 'Orients all exterior rings counter-clockwise and all interior rings '
377
+ 'clockwise.'),
378
+
379
+ ('ST_ForcePolygonCW', types.Geometry,
380
+ 'Orients all exterior rings clockwise and all interior rings '
381
+ 'counter-clockwise.'),
382
+
383
+ ('ST_ForceRHR', types.Geometry,
384
+ 'Force the orientation of the vertices in a polygon to follow the '
385
+ 'Right-Hand-Rule.'),
386
+
387
+ ('ST_ForceSFS', types.Geometry,
388
+ 'Force the geometries to use SFS 1.1 geometry types only.'),
389
+
390
+ ('ST_M', None,
391
+ 'Return the M coordinate of the point, or ``NULL`` if not available. '
392
+ 'Input must be a point.'),
393
+
394
+ ('ST_Multi', types.Geometry,
395
+ 'Return the geometry as a ``MULTI*`` geometry.'),
396
+
397
+ ('ST_Normalize', types.Geometry,
398
+ 'Return the geometry in its canonical form.'),
399
+
400
+ ('ST_QuantizeCoordinates', types.Geometry,
401
+ 'Sets least significant bits of coordinates to zero.'),
402
+
403
+ ('ST_RemovePoint', types.Geometry,
404
+ 'Remove point from a linestring.'),
405
+
406
+ ('ST_Reverse', types.Geometry,
407
+ 'Return the geometry with vertex order reversed.'),
408
+
409
+ ('ST_Rotate', types.Geometry,
410
+ 'Rotate a geometry rotRadians counter-clockwise about an origin.'),
411
+
412
+ ('ST_RotateX', types.Geometry,
413
+ 'Rotate a geometry rotRadians about the X axis.'),
414
+
415
+ ('ST_RotateY', types.Geometry,
416
+ 'Rotate a geometry rotRadians about the Y axis.'),
417
+
418
+ ('ST_RotateZ', types.Geometry,
419
+ 'Rotate a geometry rotRadians about the Z axis.'),
420
+
421
+ ('ST_Scale', types.Geometry,
422
+ 'Scale a geometry by given factors.'),
423
+
424
+ ('ST_Segmentize', types.Geometry,
425
+ 'Return a modified geometry/geography having no segment longer than the '
426
+ 'given distance.'),
427
+
428
+ ('ST_SetPoint', types.Geometry,
429
+ 'Replace point of a linestring with a given point.'),
430
+
431
+ ('ST_SetSRID', types.Geometry,
432
+ 'Set the SRID on a geometry to a particular integer value.'),
433
+
434
+ ('ST_Snap', types.Geometry,
435
+ 'Snap segments and vertices of input geometry to vertices of a reference '
436
+ 'geometry.'),
437
+
438
+ ('ST_SnapToGrid', types.Geometry,
439
+ 'Snap all points of the input geometry to a regular grid.'),
440
+
142
441
  ('ST_Transform', types.Geometry,
143
442
  'Return a new geometry with its coordinates transformed to the SRID '
144
443
  'referenced by the integer parameter.'),
145
444
 
445
+ ('ST_Translate', types.Geometry,
446
+ 'Translate a geometry by given offsets.'),
447
+
448
+ ('ST_TransScale', types.Geometry,
449
+ 'Translate a geometry by given factors and offsets.'),
450
+
146
451
  #
147
452
  # Geometry Outputs
148
453
  #
@@ -338,34 +643,18 @@ _FUNCTIONS = [
338
643
  'If \'start\' and \'end\' have the same value this is equivalent '
339
644
  'to ST_LineInterpolatePoint.'),
340
645
 
341
- ('ST_Union', types.Geometry,
342
- 'Returns a geometry that represents the point set union of the '
343
- 'Geometries.'),
344
-
345
646
  ('ST_Simplify', types.Geometry,
346
647
  'Returns a "simplified" version of the given geometry using the '
347
648
  'Douglas-Peucker algorithm.'),
348
649
 
650
+ ('ST_Union', types.Geometry,
651
+ 'Returns a geometry that represents the point set union of the '
652
+ 'Geometries.'),
653
+
349
654
  #
350
655
  # Raster Constructors
351
656
  #
352
657
 
353
- ('ST_GeomFromText', types.Geometry,
354
- 'Constructs a PostGIS ST_Geometry object from the OGC Well-Known text '
355
- 'representation.'),
356
-
357
- ('ST_GeomFromEWKT', types.Geometry,
358
- 'Constructs a PostGIS ST_Geometry object from the OGC Extended Well-Known '
359
- 'text (EWKT) representation.'),
360
-
361
- ('ST_GeomFromEWKB', types.Geometry,
362
- 'Constructs a PostGIS ST_Geometry object from the OGC Extended Well-Known '
363
- 'binary (EWKB) representation.'),
364
-
365
- ('ST_GeogFromText', types.Geography,
366
- 'Returns a geography object from the well-known text or extended well-known '
367
- 'representation.'),
368
-
369
658
  ('ST_AsRaster', types.Raster,
370
659
  ('Converts a PostGIS geometry to a PostGIS raster.', 'RT_ST_AsRaster')),
371
660
 
@@ -76,9 +76,19 @@ class _GISType(UserDefinedType):
76
76
 
77
77
  The dimension of the geometry. Default is ``2``.
78
78
 
79
- When set to ``3`` then the "geometry_type" is constrained to terminate
80
- on either ``"Z"`` or ``"M"``. When set to ``4`` then the
81
- "geometry_type" must terminate with ``"ZM"``.
79
+ With ``management`` set to ``True``, that is when ``AddGeometryColumn`` is used
80
+ to add the geometry column, there are two constraints:
81
+
82
+ * The ``geometry_type`` must not end with ``"ZM"``. This is due to PostGIS'
83
+ ``AddGeometryColumn`` failing with ZM geometry types. Instead the "simple"
84
+ geometry type (e.g. POINT rather POINTZM) should be used with ``dimension``
85
+ set to ``4``.
86
+ * When the ``geometry_type`` ends with ``"Z"`` or ``"M"`` then ``dimension``
87
+ must be set to ``3``.
88
+
89
+ With ``management`` set to ``False`` (the default) ``dimension`` is not
90
+ taken into account, and the actual dimension is fully defined with the
91
+ ``geometry_type``.
82
92
 
83
93
  ``spatial_index``
84
94
 
@@ -181,19 +191,19 @@ class _GISType(UserDefinedType):
181
191
  raise ArgumentError('srid must be convertible to an integer')
182
192
  if geometry_type:
183
193
  geometry_type = geometry_type.upper()
184
-
185
- if ((dimension == 4 and not geometry_type.endswith('ZM'))
186
- or (dimension == 3
187
- and not (geometry_type.endswith('Z')
188
- or (geometry_type.endswith('M')
189
- and not geometry_type.endswith('ZM'))))
190
- or (dimension == 2
191
- and (geometry_type.endswith('ZM')
192
- or geometry_type.endswith('Z')
193
- or geometry_type.endswith('M')))):
194
- raise ArgumentError(
195
- 'invalid geometry_type {!r} for dimension {}'.format(
196
- geometry_type, dimension))
194
+ if management:
195
+ if geometry_type.endswith('ZM'):
196
+ # PostGIS' AddGeometryColumn does not work with ZM geometry types. Instead
197
+ # the simple geometry type (e.g. POINT rather POINTZM) should be used with
198
+ # dimension set to 4
199
+ raise ArgumentError(
200
+ 'with management=True use geometry_type={!r} and '
201
+ 'dimension=4 for {!r} geometries'.format(geometry_type[:-2], geometry_type))
202
+ elif geometry_type[-1] in ('Z', 'M') and dimension != 3:
203
+ # If a Z or M geometry type is used then dimension must be set to 3
204
+ raise ArgumentError(
205
+ 'with management=True dimension must be 3 for '
206
+ '{!r} geometries'.format(geometry_type))
197
207
  else:
198
208
  if management:
199
209
  raise ArgumentError('geometry_type set to None not compatible '
@@ -201,9 +211,6 @@ class _GISType(UserDefinedType):
201
211
  if srid > 0:
202
212
  warnings.warn('srid not enforced when geometry_type is None')
203
213
 
204
- if dimension > 2:
205
- raise ArgumentError('geometry type set to None not compatible '
206
- 'with dimension > 2')
207
214
  if use_typmod and not management:
208
215
  warnings.warn('use_typmod ignored when management is False')
209
216
  return geometry_type, srid
@@ -1,7 +1,7 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
 
4
- version = '0.6.2'
4
+ version = '0.6.3'
5
5
 
6
6
  setup(
7
7
  name='GeoAlchemy2',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes