Opened 19 years ago
Last modified 19 years ago
#902 closed defect (fixed)
missing geometry field in postgis query
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | Markus Neteler |
Description
gdal-1.2.6 In using grass-6.0.0 could not load postgis (through ogr) layer due to missing geomtry field. Q? In file: ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp function: ReadTableDefinition() line: approx 239 ... else if( EQUAL(oField.GetNameRef(),"WKB_GEOMETRY") ) { bHasWkb = TRUE; if( EQUAL(pszType,"OID") ) bWkbAsOid = TRUE; continue; } Is this ----->> pszGeomColumn = CPLStrdup( oField.GetNameRef()); missing? It appears that if we have a WKB_GEOMETRY field then pszGeomColumn is undefined which is used in many other parts to assemble results.
Change History (4)
comment:2 by , 19 years ago
(In reply to comment #1) Frank, I set up Grass debug, and gdal(ogr) debug output and it definitely went thru this routine. I have since made the change adding the suggested line and then grass loaded all the geometries. Though this may beak some other functionality that I know nothing about. It just seemed odd that even though a geometry column was present its reference kept, even though other code seemed to act on the type of geom data that was in the column. I have to admit that I am just becoming familiar with grass, ogr and postgis, so I expect to make mistakes and can be easily mistaken. Though this one worked and thought that rather than giving a fix just put it as a suggestion. I had thougt that it was quite possible that grass 6 was using some other path in the interface as well. John
comment:3 by , 19 years ago
John, I have committed your change, but I'm still not sure why it is getting into the logic in question. The previous if statement checking the type and determining that it is "geometry" should have identified the geometry field if it is using PostGIS types. I am wondering if it is possible that the geometry field was created with a more specific geometry type and that is the issue. Would you mind adding a line like: fprintf( stderr, "Field=%s, type=%s", oField.GetNameRef(), pszType ); In the "WKB_GEOMETRY" case so we can see what type this field is, and run that? If there are more specific geometry types that can now appear as column types I may need to alter the previous cases logic.
Note:
See TracTickets
for help on using tickets.