I am trying to reverse engineer a consultants work. They are using a postgis spatial view as a source layer in MapServer:
LAYER
NAME 'Parcels2009'
CONNECTIONTYPE postgis
DATA "
parcel_geometry FROM (
SELECT id, year, parcel_working_title, appropriation_title, legal_citation, link_to_accomplishment_plan, project_type, acres, county, township, range, section, description, easement_ohf, fee_ohf, x, y, parcel_geometry
FROM map_view_final
WHERE year = '2009'
) AS foo USING UNIQUE id USING srid=4326
"
I can view the table in postgres:
And following this question I can add the layer into QGIS:
But the layer has no data/empty attribute table. If I add the layer with the "Spatial Type" set to 'NoGeometry' it will load the table just fine.
I suspect the issue is with my geometry column.
When I try to the following pgsql2shp command I get the following error:
pgsql2shp -f parcels -h localhost -u ####-P #### #### "SELECT * FROM map_view_final where parcel_geometry is not null"
Initializing...
Done (postgis major version: 2).
Output shape: Null Shape
Dumping: XUnknown WKB type (7) for record 0
I should note that I have similar issue trying to use ArcGIS to accomplish my task:
In the end I just need a shapefile to QC the data and for use in a separate project.
SELECT ST_GeometryType(parcel_geometry), count(*) FROM map_view_final GROUP BY ST_GeometryType(parcel_geometry);
Are they all polygons or are there some geometrycollections in there? Also, what version of PostGIS are you running? 1.x or 2.x? You can executeselect PostGIS_full_version();
to details on your setup if you're unsure.