Timeline for How to get the geometry type of an empty PostGIS table?
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 16, 2018 at 14:34 | comment | added | atlefren | Start a new question | |
Sep 15, 2018 at 12:02 | comment | added | giser | I may not make me clear enough, when I say I want to create view I do no mean for only one table. In my application I have to query almost 10 tables which contain point line and polyon, so I wonder if I can create a view contains all the tables together. | |
Sep 15, 2018 at 9:14 | comment | added | atlefren | Create view my_schema.building_point AS SELECT * FROM my_schema.building WHERE GeometryType(geom) = 'Point' ; etc | |
Sep 15, 2018 at 9:12 | comment | added | atlefren | Right. An analogy: declaring that a geom column is of type "geometry" is like designating a drawer for socks of any color. Checking what color of socks is in this drawer is impossible when it is empty. | |
Sep 15, 2018 at 1:46 | comment | added | giser |
And one more thing, if all the geometry column is set to geometry type for all the table, can I create a view contains all the tables which may contain points lines polyogn ?
|
|
Sep 15, 2018 at 1:45 | comment | added | giser |
SELECT GeometryType(geom) FROM my_schema.building LIMIT 1 like this as the OP post? It does not work if the table is empty.
|
|
Sep 13, 2018 at 11:06 | comment | added | atlefren | That means that your geometry column is set to geometry type "geometry" (i.e. it accepts all kinds of geometries). In this case you'll have to check each geometry induvidually using ST_GeometryType | |
Sep 12, 2018 at 4:26 | comment | added | giser |
The sql in the answer will return geometry for the type, while we can still not know if the geometry is point or line.
|
|
S Jul 18, 2015 at 12:52 | history | suggested | JJD | CC BY-SA 3.0 |
Improved formatting.
|
Jul 18, 2015 at 12:04 | review | Suggested edits | |||
S Jul 18, 2015 at 12:52 | |||||
Mar 10, 2014 at 20:49 | vote | accept | Tanner | ||
Mar 10, 2014 at 20:47 | history | answered | atlefren | CC BY-SA 3.0 |