| FOSSLC is a non-profit organization that specializes in technology and know-how to record conferences with excellent quality. Click on the icons below to view great videos from communities we are actively involved with: | ||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||
UCOSP - Integrating KML into SQL Stub function
So, this week I embarked on the journey to get my asKML function working end-to-end. At this moment, I've implemented the well known binary to kml conversion, and I've also made a stub SQL file asKML which simply returns the same as asBinary, but I wanted to get them working together. I ran into a little roadblock and I've been waiting on one of the Ingres developers to give me a hand, as I am a little stuck.
So, I tried doing a few things, but I haven't been able to get a build going with my changes. Here is what I did:
Firstly, I made the asKML function return geom_to_kml, instead of just geom_to_text, replicating the asText function. And in the call to geom_to_kml, I copied the functionality of asBinary, as you (Chuck) stated that there is stuff that I will need from asBinary if I am going from WKB to KML (which I am!). This was all fine, I built the project, and when executing asKML in the SQL statements, it returned WKB.
Afterwards, I added some of my code to try and convert WKB into KML. I didn't write any of the code for returning the value, I just added TRdisplay functions to print the results. The thing is, I'm still not sure where to actually grab the wkb... Based on the code I took a guess, but I could be wrong. This is what I added inside the geom_to_kml function:
/* Convert wkb into kml */
OGRErr eErr;
OGRGeometryH hGeom = NULL;
char *kml = NULL;
unsigned char *wkb_buffer = &dv_wkb.db_data;
if( eErr == OGRERR_NONE )
{
kml = OGR_G_ExportToKML( hGeom, "???I do not know what this is" );
OGR_G_DestroyGeometry( hGeom );
TRdisplay( "kml = %s\n", kml );
//CPLFree( kml );
}
else if( eErr == OGRERR_NOT_ENOUGH_DATA )
{
TRdisplay( "error2");
}
else if( eErr == OGRERR_UNSUPPORTED_GEOMETRY_TYPE )
{
TRdisplay( "error2" );
}
else if( eErr == OGRERR_CORRUPT_DATA )
{
TRdisplay( "error3" );
};
After adding this, I did a build, and ran into a build error. Here it is:
Extracting objects ...
ld -shared -melf_x86_64 -z noexecstack -L/lib64 -L/usr/lib64 -o /home/sjansepar/Ingres/build/lib/libframe.1.so *.o -lrt -lm -lc -lpthread -ldl -lcrypt
-rwxr-xr-x. 1 sjansepar sjansepar 1514314 Nov 11 18:56 /home/sjansepar/Ingres/build/lib/libframe.1.so
Cleaning up ....
Link /home/sjansepar/Ingres/build/sig/rpclean/rpclean
/home/sjansepar/Ingres/build/lib/libq.1.so: undefined reference to `OGR_G_DestroyGeometry'
/home/sjansepar/Ingres/build/lib/libq.1.so: undefined reference to `OGR_G_ExportToKML'
collect2: ld returned 1 exit status
I did include the library:
#include <ogr_api.h>
I may be missing a step through, maybe there is something I need to do for the build to use the libgdal...
I am also not sure If the following line is correct for accessing the binary data:
unsigned char *wkb_buffer = &dv_wkb.db_data;
wbk_buffer is suppose to be a pointer to a char, and I'm not sure that I am right here as to where I'm getting the binary data.
Thats where I'm at right now! Hopefully I'll get some help soon and I will make a bit more progress.
Shawn
- shawnjan's blog
- Login to post comments







