Check-in Differences
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From 7f691c1e017837c1 To 58849a0a8fd61b31

2014-01-02
00:33
Remove point_to_tile functionality - no longer required by spec, and broken.

Also add missing gpkgBinary.c file. check-in: 89cec81bcc user: bradh tags: trunk

2014-01-01
10:29
Expose gaiaFromGeoPackageGeometryBlob function and use it as a fallback if we can't parse as spatialite geometry.

Also adds test. check-in: 7f691c1e01 user: bradh tags: trunk

06:24
Implement GeomFromGPB() and test cases. check-in: 58849a0a8f user: bradh tags: trunk
01:39
Add geopackage output geometry support (AsGPB() SQL function), based on existing WKB output. check-in: d26839b4fd user: bradh tags: trunk

Changes to src/gaiageo/gg_wkb.c.

    55     55   #include "config.h"
    56     56   #endif
    57     57   
    58     58   #include <spatialite/sqlite.h>
    59     59   
    60     60   #include <spatialite/gaiageo.h>
    61     61   
    62         -#ifdef ENABLE_GEOPACKAGE
    63         -#include <spatialite/geopackage.h>
    64         -#endif
    65         -
    66     62   static void
    67     63   ParseWkbPoint (gaiaGeomCollPtr geo)
    68     64   {
    69     65   /* decodes a POINT from WKB */
    70     66       double x;
    71     67       double y;
    72     68       if (geo->size < geo->offset + 16)
................................................................................
  1078   1074   gaiaFromSpatiaLiteBlobWkb (const unsigned char *blob, unsigned int size)
  1079   1075   {
  1080   1076   /* decoding from SpatiaLite BLOB to GEOMETRY */
  1081   1077       int type;
  1082   1078       int little_endian;
  1083   1079       int endian_arch = gaiaEndianArch ();
  1084   1080       gaiaGeomCollPtr geo = NULL;
  1085         -#ifdef ENABLE_GEOPACKAGE
  1086         -    if (size < 24)
  1087         -        return NULL;		/* cannot be spatialite or geopackage blob */
  1088         -    if (*(blob + 0) != GAIA_MARK_START)
  1089         -    {
  1090         -        /* Try geopackage binary, since it is not a standard spatialite blob */
  1091         -	return gaiaFromGeoPackageGeometryBlob(blob, size);
  1092         -    }
  1093         -    if (size < 45)
  1094         -	return NULL;		/* cannot be an internal BLOB WKB geometry */
  1095         -#else
  1096   1081       if (size < 45)
  1097   1082   	return NULL;		/* cannot be an internal BLOB WKB geometry */
  1098   1083       if (*(blob + 0) != GAIA_MARK_START)
  1099   1084   	return NULL;		/* failed to recognize START signature */
  1100         -#endif	
  1101   1085       if (*(blob + (size - 1)) != GAIA_MARK_END)
  1102   1086   	return NULL;		/* failed to recognize END signature */
  1103   1087       if (*(blob + 38) != GAIA_MARK_MBR)
  1104   1088   	return NULL;		/* failed to recognize MBR signature */
  1105   1089       if (*(blob + 1) == GAIA_LITTLE_ENDIAN)
  1106   1090   	little_endian = 1;
  1107   1091       else if (*(blob + 1) == GAIA_BIG_ENDIAN)

Changes to src/headers/spatialite/geopackage.h.

    59     59   #include "sqlite.h"
    60     60   
    61     61   #ifdef __cplusplus
    62     62   extern "C"
    63     63   {
    64     64   #endif
    65     65   
    66         -#include <spatialite/gaiageo.h>
    67     66   
    68     67   /* Internal geopackage SQL function implementation */
    69     68       GEOPACKAGE_DECLARE void fnct_gpkgCreateBaseTables (sqlite3_context *
    70     69   						       context, int argc,
    71     70   						       sqlite3_value ** argv);
    72     71       GEOPACKAGE_DECLARE void fnct_gpkgCreateTilesTable (sqlite3_context *
    73     72   						       context, int argc,
................................................................................
   123    122   							  sqlite3_value ** argv);   
   124    123       GEOPACKAGE_DECLARE void fnct_ToGPB (sqlite3_context * context, int argc,
   125    124   					sqlite3_value ** argv);
   126    125       GEOPACKAGE_DECLARE void fnct_GeomFromGPB (sqlite3_context * context,
   127    126   					      int argc,
   128    127   					      sqlite3_value ** argv);
   129    128   
   130         -    GEOPACKAGE_DECLARE gaiaGeomCollPtr gaiaFromGeoPackageGeometryBlob (const unsigned char *gpb,
   131         -								    unsigned int gpb_len);
   132         -
   133    129   /* Markers for unused arguments / variable */
   134    130   #if __GNUC__
   135    131   #define UNUSED __attribute__ ((__unused__))
   136    132   #else
   137    133   #define UNUSED
   138    134   #endif
   139    135   
   140    136   #ifdef __cplusplus
   141    137   }
   142    138   #endif
   143    139   
   144    140   #endif

Deleted test/sql_stmt_geopackage_tests/implicitgeopackagebinary1.testcase.

     1         -implicit geopackage binary 1
     2         -:memory: #use in-memory database
     3         -SELECT Hex(CastToLineString(AsGPB(GeomFromText("LINESTRING(136 -35, 134 -33, 135 -32)", 4326))))
     4         -1 # rows (not including the header row)
     5         -1 # columns
     6         -Hex(CastToLineString(AsGPB(GeomFromText("LINESTRING(136 -35, 134 -33, 135 -32)", 4326))))
     7         -0001E61000000000000000C0604000000000008041C0000000000000614000000000000040C07C0200000003000000000000000000614000000000008041C00000000000C0604000000000008040C00000000000E0604000000000000040C0FE