我在使用spatialite时想要查询表中的geometry字段
void LnyxMapToCsmapConverter::GetGeometryPoints(sqlite3_stmt *stmt, int index, std::vector<Point3d> &points) {
u_char *pBolb = (u_char *)sqlite3_column_blob(stmt, index);
if (pBolb != nullptr) {
int count = sqlite3_column_bytes(stmt, index);
gaiaGeomCollPtr geo = nullptr;
geo = gaiaFromSpatiaLiteBlobWkb(pBolb,count);
if (geo != nullptr) {
if (geo->DimensionModel == GAIA_XY_Z) {
int geoType = gaiaGeometryType(geo);
if (geoType == GAIA_POINTZ) {
gaiaPointPtr p = geo->FirstPoint;
if (p != nullptr) {
if (p->DimensionModel == GAIA_XY_Z) {
Point3d pt;
pt.set_x(p->X);
pt.set_y(p->Y);
pt.set_z(p->Z);
points.emplace_back(pt);
}
p = p->Next;
}
}
这是一部分代码,pblob指针无法获取值,到底用什么方法可以查询geometry字段