Hi Beau,
Initially, I wanted to say that #1 is the intended behavior. I
wanted to check things out before responding, and unfortunately,
it has taken me a bit longer than I expected.
The first thing to point out is how GeoTools handles feature IDs.
Since several folks could be writing to a FeatureStore, you have
to state your feature ids should be used for a given feature being
written to the database. For example...
feature.getUserData.put(Hints.USE_PROVIDED_FID, true)
(I might have the exact syntax off since I'm bouncing between
Scala and Java.) Without that hint, GeoMesa will pick a random
UUID for the feature id.
Just to make sure that #1 isn't (currently) possible, I tried
writing two distinct with the same id, and I ended up with two
records with the same FID.
As for the other two approaches, in the current implementation,
looking up features by ID involves a table scan and hence
generally is a bad idea. We do have some work in progress which
will make such queries faster/sane. The last note on along these
lines is to point out that to support this fully, we'll likely
need to implement/override the DataStore's function called
getFeatureWriter.
I mention that because this is the GeoTools way of doing #2. At
the minute, we are using an abstract implementation of this, and
it should work correctly. The filtering is done entirely on the
client side, so it'll be slow. If your data is small (say, a few
thousand records), this sort of thing might be tenable.
I hope that helps clarify the matter; let me know if you have
other questions.
Jim
On 06/18/2014 04:37 PM, Beau Lalonde wrote:
Jim,
Others,
If
we do use the same ID, can we count on the previous value
getting “overwritten”/replaced?
In
other words, if I actually intend to overwrite/replace a
feature with a specific ID (if it exists, otherwise create a
new feature), which of the following is the best option:
1. Act
as if I am adding the feature, counting on any existing
feature with the same ID to be overwritten/replaced
2. Query
GeoMesa for the existence of a feature with the specific ID,
modify feature if it exists, add feature if it doesn’t exist
3. Blindly
attempt to remove the feature with the specific ID, add a
new feature with the same ID
Any
suggestions for a recommended approach would be helpful.
Thanks,
Beau
Hi Adnan,
Great question! Geomesa uses the feature id as a unique
identifier. It sounds like you might using the id field to
identify/name a thing which is moving/changing shape/varying
attributes through time. If that's the use case, I'd
suggest putting that information which identifies the object
into a different field like 'name' or 'identifier'.
As for documentation, I'd suggest checking out
http://geomesa.github.io/ and looking through the
tutorials. We've integrated with GeoTools, so I'd also
point to their documentation about DataStores/FeatureStores
(http://docs.geotools.org/latest/userguide/library/api/datastore.html
and http://docs.geotools.org/stable/userguide/library/data/featuresource.html).*
Let us know what others questions we can help with,
Jim
* In particular, I believe that you would see the same
behavior with (most) other GeoTools FeatureStores.
On 06/18/2014 06:14 AM, Adnan Yaqoob wrote:
Hello Everybody,
I am new to Geomesa and trying its
API. I have a question, how can I store features with
same id and geometry with different time stamp and
attributes values. I tried to write feature with same id
with different attributes and it was overwriting
previous feature. I am stuck on this point, please help
me understand.
Is there any documentation for
Geomesa API?
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
http://www.locationtech.org/mailman/listinfo/geomesa-users
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
http://www.locationtech.org/mailman/listinfo/geomesa-users
|