First of all thanks,
I tried to solve a specific problem with geoalchemy and ran into some problems,
with geoalchemy2 these have all disappeared. :)
I work with posgres 8.4, postgis 1.5, python 2.7, inside the pyramid
framework.
some observations (the SQL code was copied out of pgadmin):
For me it is very important that i can just define a column as
Geometry/Geography,
without the constraint to a specific Feature Type. a) because i have to import
lots of data from shapefiles which can consist of Polygons + MultiPolygons or
Lines + MultiLines, so being restricted to a specific feature type would be
inconvenient for me. In the future there will also be an import form KML which
can be a mix of all Types.
with geoalchemy i could define a column:
Column(name, Geometry(dim))
which resulted in the sql:
++++++++++++++++++++
CREATE TABLE seas
(
"name" character varying(100),
id character varying(16) NOT NULL,
gazetteer integer,
geom geometry,
CONSTRAINT seas_pkey PRIMARY KEY (id),
CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),
CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 4326)
)
WITH (
OIDS=FALSE
);
CREATE INDEX idx_seas_geom
ON seas
USING gist
(geom);
-----------------------------------------------
The same defintion with geoalchemy2 throws the exception:
+++++++++++
ProgrammingError: (ProgrammingError) type modifier is not allowed for
type "geometry"
LINE 6: geom geometry(GEOMETRY,4326)
^
'\nCREATE TABLE seas2 (\n\tname VARCHAR(100), \n\tid VARCHAR(16),
\n\tgazetteer INTEGER, \n\tgeom geometry(GEOMETRY,4326)\n)\n\n' {}
----------------
It would be nice to have the geoalchemy behavior back.
If I define the geometry as:
Column(name, Geography(srid=4326, dimension=dim))
the table creation succeeds as:
++++++++++++++++++++++++
CREATE TABLE seas2
(
"name" character varying(100),
id character varying(16),
gazetteer integer,
geom geography(4326)
)
WITH (
OIDS=FALSE
);
------------------------------------------
Q: Is it by design that no spatial index gets created for geography columns?
BTW I love the to_shape, from_shape functions, a great time and effort saver!
--
Best Regards,
Christian Ledermann
Nairobi - Kenya
Mobile :
+254 702978914
<*)))>{
If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.
1) Don’t drive species to extinction
2) Don’t destroy a habitat that species rely on.
3) Don’t change the climate in ways that will result in the above.
}<(((*>