So I added in logging and if I set the schema as following:
fooStr:String,fooDate:Date,barStr:String:index=full,fooDouble:Double,
barDouble:Double,uuid:String,*fooPoly:Polygon:srid=4326
And then in the code I take a string of point pairs in the example
format of:
POLYGON((-120 45, -120 50, -125 50, -125 45, -120 45))
(so I used the polygon from the test class you referenced)
And then I printed out the attribute value of fooPoly and it is set as
the string above.
And I printed out the value of fooDate which was of format similar
to:
Mon Jul 04 06:30:27 GMT 2016 when I printed it out.
But when I try to insert the feature I get stack trace on 1.2.3 that
looks similar to the following:
Java.lang.NullPointerException
at
org.locationtech.geomesa.utils.geohas.GeohashUtils$.getInternationalD
ateLineSafeGeometry(GeohashUtils.scala:766)
at
org.locationtech.geomesa.utils.geohash.GeohashUtils$.decomposeGeometr
y(GeohashUtils.scala:790)
at
org.locationtech.geomesa.accumulo.index.STIndexEncoder.encode(STIndex
Entry.scala:50)
at
org.locationtech.geomesa.accumulo.data.tables.SpatioTemporalTabl$$ano
nfun$writer$1.applly(SpatioTEmporalTable.scala:40)
…
Also I had set the following things previously for my feature:
SimpleFeatureType.getUserData().put(Constants.SF_PROPERTY_START_TIME,
“fooDate”);
feature.getUserData().put(Hints.USE_PROVIDED_FID, true);
feature.getUserData().put(Hints.PROVIDED_FID, “uuidFieldValue”);
If I changed it back to the schema inserting a Point field, i.e.:
fooStr:String,fooDate:Date,barStr:String:index=full,fooDouble:Double,
barDouble:Double,uuid:String,*fooPoint:Point:srid=4326
And then in the code I take a lon and lat and generate a point
POINT(-120 45)
Then it inserts fine.
Any idea what may be causing that exception?
Thanks,
Diane
From: geomesa-users-bounces@xxxxxxxxxxxxxxxx [mailto:geomesa-users-bo
unces@xxxxxxxxxxxxxxxx] On Behalf Of Emilio Lahr-Vivaz
Sent: Friday, July 01, 2016 3:17 PM
To: geomesa-users@xxxxxxxxxxxxxxxx
Subject: Re: [geomesa-users] ingesting and exposing polygon data, is
this supported?
Hi Diane,
What behavior are you observing?
What you're doing should work fine, and we have lots of unit tests
that use polygon shapes. They're written in scala, but for example:
https://github.com/locationtech/geomesa/blob/master/geomesa-accumulo/
geomesa-accumulo-
datastore/src/test/scala/org/locationtech/geomesa/accumulo/data/Accum
uloDataStoreFilterTest.scala
(in this test the binding is a generic geometry - you should stick
with Polygon if that is your shape)
One way to check that the geometry is being set correctly is to print
out the attribute from the simple feature after setting it. Usually
geotools will convert it to the correct type, and if it can't do so
the attribute will be null, e.g.
SimpleFeature feature = featureBuilder.build();
System.out.println(feature.getAttribute(polyFieldName));
I also find this website useful for checking WKT syntax:
http://arthur-e.github.io/Wicket/sandbox-gmaps3.html
Thanks,
Emilio
On 07/01/2016 02:58 PM, Diane Griffith wrote:
I am trying to debug if I ingested polygon data correctly. I’d like
to ingest a polygon and expose it via geomesa/geoserver.
Is there a trick to this as I am not sure it actually created the
indexes expected.
I was going to have the regular point data and then have a separate
data set that had the associated polygons to turn them on and off.
I defined a field of *polygonField:Polygon:srid=4326 in the schema. I
then created a polygon via geotools out of arrays of points to insert
with the feature data.
(i.e. one way I tried was using the following classes:
WKTReader reader = new WKTReader(geometryFactory); String
coordinates=”///arrays of point values///”
StrinBuffer polyStringBuffer=new
StringBuffer(“POLYGON((“).append(coordinates).append(“))”);
Polygon polygon = (Polygon) reader.read(polyStringBuffer.toString());
featureBuilder.set(polyFieldName, polygon);
…)
I had tried a coorindates array as well and using LinearRing and then
using that to create the Polygon.
Did I need to mess with any underlying indexes or am I out of luck of
ingesting them in via geomesa and exposing them through geoserver.
So in this case I don’t put in the associated point with the polygon,
is that a potential problem area? If there is a good example to
better understand how to do something similar I’d love to review it.
Thanks,
Diane
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://www.locationtech.org/mailman/listinfo/geomesa-users
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://www.locationtech.org/mailman/listinfo/geomesa-users