|
I’ve looked all around the Geotools website for an
example of doing a simple database insert on an indexed file. Can someone give me an example? I have a SQL table, for example: CREATE TABLE track ( trackid int8 NOT NULL, tstamp timestamp NOT NULL, coordinate geometry, CONSTRAINT enforce_dims_coordinate CHECK
(ndims(coordinate) = 2), CONSTRAINT enforce_geotype_coordinate CHECK
(geometrytype(coordinate) = 'POINT'::text OR coordinate IS NULL), CONSTRAINT enforce_srid_coordinate CHECK
(srid(coordinate) = 4326) ) I want to add a record, say for trackid = 1001. I try to use FeatureWriter to append the table (see below),
as per the example (http://docs.codehaus.org/display/GEOTOOLS/Data+Writing)
but the FeatureWriter doesn’t know about the index, that is,
setAttribute(0,..) is setting the timestamp, not the index. How does one append
an indexed table (or do an update for that matter)? FeatureWriter aWriter = dataStore.getFeatureWriterAppend(trackTable,
((FeatureStore) fsTrack).getTransaction()); Feature
f = aWriter.next(); f.setAttribute(0,
1001)); f.setAttribute(1,
System.currentTimeMillis()); f.setAttribute(2,
new Coordinate(10, 20)); aWriter.write(); aWriter.close();
|
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
