[gdal-dev] SQL results truncated
Clay, Bruce
bclay at ball.com
Wed Nov 4 17:07:44 EST 2009
I found a work around to the problem - posting here in case someone else
runs into the problem
I changed the initial select * to separate the attributes and cast them
as real
Example: Select cast(LAT2 as real), cast(lon2 as real), cast(confidence
as real), cast(intensity as real), date_time from (
I don't know where in the overall package the attributes were converted
to integer but this method at least lets the SQL code work
GetField as string does not work in this case but that does not really
surprise me since the resulting data does not come from a table rather
it is processed data.
It just means we have to be very careful of the fieldIndex alignment
Bruce
________________________________
From: gdal-dev-bounces at lists.osgeo.org
[mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Clay, Bruce
Sent: Wednesday, November 04, 2009 12:25 PM
To: gdal-dev at lists.osgeo.org
Subject: [gdal-dev] SQL results truncated
It seems like I encountered this problem before but I can not find any
information about it now.
If I run a SQ script like the following
Select * from
(Select MIN_LAT - (round((MIN_LAT - LATITUDE) / (MAX_LAT - MIN_LAT) *
1728.497600)) * 0.000579 LAT2,
MAX_LON - (round((LONGITUDE - MAX_LON) / (MIN_LON - MAX_LON) *
1814.921600)) * 0.000551 LON2,
Round(sum(TRACK_SIZE) / 1.000000) CONFIDENCE,
max(B_TEMP) Intensity,
min(TO_CHAR(DATE_TIME, 'MM-DD-YYYY HH24:MI:SS')) DATE_TIME
FROM
WACDS.MODIS_ACTIVE_FIRE WHERE
LATITUDE BETWEEN MIN_LAT AND MAX_LAT AND
LONGITUDE BETWEEN MIN_LON AND MAX_LON AND
DATE_TIME BETWEEN TO_DATE('03/01/2007 00:00:00' , 'MM-DD-YYYY
HH24:MI:SS') AND
TO_DATE('04/30/2007 23:59:59' , 'MM-DD-YYYY
HH24:MI:SS') AND
CONFIDENCE > 1.000000
GROUP BY
round((MIN_LAT - LATITUDE) / (MAX_LAT - MIN_LAT) * 1728.497600),
round((LONGITUDE - MAX_LON) / (MIN_LON - MAX_LON) *
1814.921600))
where
(CONFIDENCE * 1.000000) > 1.000000
ORDER BY DATE_TIME
From sqlPal I get LAT2 and LON2 data back as doubles
If I run it through OGR ExecuteSql the LAT2 and LON2 data comes back as
integers and can not be used to plot the data
OGRFieldDefn *fieldDef = featureDef->GetFieldDefn(fieldIndex);
if (fieldDef != NULL)
{
fieldType = fieldDef->GetType();
}
Returns type integer
And both
const char *latStr = (char *)feature->GetFieldAsString("LAT2");
double latitude = feature->GetFieldAsDouble("LAT2");
return(only the whole portion of what I see in sqlPal.
Does anyone see / know what might be going wrong?
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.
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/20091104/0b8ec62d/attachment-0001.html
More information about the gdal-dev
mailing list