I am using geodjango with postgis.
I defined a model with
shape = models.PolygonField('Border', spatial_index=True, srid=4326, geography=True)
I am trying to read the resulting postgis db with geoserver - get an error "points of linearring do not form a closed linestring"
for a few (not all) of my entries.
I construct my own geometries, and I specifically duplicate the first point onto the last.
The constructor I am using is
import django.contrib.gis.geos.polygon as geos"
swath.shape = geos.Polygon(polyfile)
I tried a query :-
"SELECT filename FROM "Satellite_swaths" WHERE NOT ST_IsValid(GeomFromWKB(ST_AsBinary(shape)))"
Which returned quite a few errors, but when I look at those in the (great!) admin interface
I see a lot of these are dateline issues, probably getting confused by the geog -> geom conversion.
but even if I delete those I get the "...closed linestring" error from geoserver.
I am trying to do a check before inserting it into the db -
swath.shape.GEOSGeometry.valid()
but geodjango doesn't seem to know this is a geography object.
AttributeError: 'Polygon' object has no attribute 'GEOSGeometry'
when I look at the db with qgis, they look like geometry types, not geography types - maybe a qgis limitation ?
Is there something I can use there to tell geodjango it is a geography type ?
Any advice ?
Cheers, Andy!