[gdal-dev] OGR / Oracle problems
Clay, Bruce
bclay at ball.com
Fri Jan 4 16:23:15 EST 2008
I am running into 2 different problems in my program trying to count
fire reports from a MODIS database.
I have a database set up in Oracle 10g with 133 tables reported by
"select count(*) from sde.layers;" Only 3 of them appear to OGR when I
use the OCI driver. The source code to get the names is shown below.
public int GetTableList(DataSource dataSource, out ArrayList
tableList)
{
int status = -1;
tableList = null;
int numLayers = dataSource.GetLayerCount();
if (numLayers > 0)
{
tableList = new ArrayList();
if (tableList != null)
{
for (int layerIndex = 0; layerIndex < numLayers;
layerIndex++)
{
Layer layer =
dataSource.GetLayerByIndex(layerIndex);
FeatureDefn featureDef = layer.GetLayerDefn();
string layerName = featureDef.GetName();
tableList.Add(layerName);
}
if (tableList.Count > 0)
{
status = 0;
}
}
}
return (status);
}
It looks like OGR is only including the tables that are set up for
SDO_GEOMETRY. I say that because the same 3 tables show up if I issue
the following SQL
select * from USER_SDO_GEOM_METADATA ; All of the tables were
created with ArcCatalog but these three tables have been updated to
support use of SDO_GEOMETRY by adding metadata to Oracle.
The other problem I am encountering is that Date fields are not returned
along with other attribute fields. The code I use to get the field list
is shown below. All the field names are returned except for Date,
Geometry and the BLOB ESRI added for SE_ANNO_CAD_DATA. Geometry I can
of course can get with a direct call. And the BLOB I don't really care
about but it would be nice if the field definition showed up. The date
is a critical field to use for the data retrieval because I am looking
specific date time windows.
public int GetFieldList(DataSource dataSource, string tableName,
out
List<fieldInfoRec> fieldList)
{
int status = -1;
fieldList = new List<fieldInfoRec>();
if ((dataSource != null) && (tableName.Length > 0))
{
Layer layer = dataSource.GetLayerByName(tableName);
if (layer != null)
{
FeatureDefn featureDef = layer.GetLayerDefn();
int numFields = featureDef.GetFieldCount();
for (int fieldIndex = 0; fieldIndex < numFields;
fieldIndex++)
{
FieldDefn fieldDef =
featureDef.GetFieldDefn(fieldIndex);
if (fieldDef != null)
{
fieldInfoRec fieldInfo = new fieldInfoRec();
fieldInfo.fieldName = fieldDef.GetName();
fieldList.Add(fieldInfo);
}
}
if (fieldList.Count > 0)
{
status = 0;
}
}
}
else
{
mLastErrorMsg = "GetFieldList:Invalid parameters";
}
return (status);
}
Are these known issues? Is there a way to work around them?
Bruce
This message and any enclosures are intended only for the addressee. Please
notify the sender by email if you are not the intended recipient. If you are
not the intended recipient, you may not use, copy, disclose, or distribute this
message or its contents or enclosures to any other person and any such actions
may be unlawful. Ball reserves the right to monitor and review all messages
and enclosures sent to or from this email address.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080104/a2b601b3/attachment-0001.html
More information about the gdal-dev
mailing list