How to pass custom data in GeoJSON point?

المشرف العام

Administrator
طاقم الإدارة
I have an application, which creates a GeoJSON stream on the server, which is then rendered on the client (using CesiumJS). GeoJSON is created using GeoTools.

I want to pass some custom data to the client about a particular point. This custom data will determine, how the client renders that point.

I add points using this code:

protected void addPoint(final double lon, final double lat, final GeometryBuilder builder, final SimpleFeatureBuilder fbuilder, final List features) { final Point point = builder.point(lon, lat); fbuilder.add(point); final SimpleFeature feature = fbuilder.buildFeature(null); features.add(feature);}If I wanted to add a string property to GeoJSON, with, say, name id and value fooBar123.

How do I do it in Java (how can I modify the code above in order for id:fooBar123 to appear in the results GeoJSON string) ?



أكثر...
 
أعلى