Thank you for the reply andrew.  I was assuming because the geometry data
type was supported in the SQL Interface that I could do the following using
the SQL interface but it seems to just drop the geometry column from the
table when I try to insert:

Ignite ignite = Ignition.start(igniteConfiguration());
sequence = ignite.atomicSequence("MM_EVENT_SEQ", 1, true);

// create the cache
CacheConfiguration<?, ?> cacheConfig = new
CacheConfiguration<>(CACHE_NAME).setSqlSchema(SCHEMA_NAME);
cache = ignite.getOrCreateCache(cacheConfig);
    
// Create the SPATIAL table
cache.query(new SqlFieldsQuery("DROP TABLE IF EXISTS MM_EVENT")).getAll();
    // create the tables with SQL DDL
    cache.query(new SqlFieldsQuery(
      "CREATE TABLE IF NOT EXISTS MYGEOMCACHE ( "
        + "id bigint,ts timestamp, geom GEOMETRY "
        + "PRIMARY KEY (id)) WITH \"template=partitioned,backups=1\""))
      .getAll();

// setup SQL Query to insert Geometry
SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO MYGEOMCACHE (id,ts,
geom) values (?, ?, ?)");

// setup WKT -> Geometry reader
final PrecisionModel precision = new PrecisionModel();
final GeometryFactory geometryFactory = new GeometryFactory(precision,
4326);
WKTReader r = new WKTReader(geometryFactory);

// now create the geometry
Geometry geo = r.read("POINT(" + vdNDR.get("longitude") + " " +
vdNDR.get("latitude") + ")");

cache.query(qry.setArgs(
      BigInteger.valueOf(sequence.incrementAndGet()), 
      new Timestamp((long) vdNDR.get("reportTimestamp") * 1000),
      geo);





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to