I am having something of nightmare setting this up. The documentation 
(33-snapshot) says GDAL 3.2  or OLDER. Puzzling? Downloading GDAL3.2 from 
gisinternals archive, I find gdalinfo –formats complaining about entrypoint for 
sqlite3 in the gdal302.dll after I set up all the path and environment 
variables  (and     OGRDataStoreFactory factory = new JniOGRDataStoreFactory(); 
dies with “java.lang.UnsatisfiedLinkError: C:\GDAL\gdal\java\gdalalljni.dll: 
The specified procedure could not be found” ). Is the documentation correct 
here?

From: Ian Turton <ijtur...@gmail.com>
Sent: Thursday, 16 May 2024 9:02 PM
To: Phil Scadden <p.scad...@gns.cri.nz>
Cc: geotools-gt2-users@lists.sourceforge.net
Subject: Re: [Geotools-gt2-users] getting from geometry in SimpleFeature to 
ESRI geometry



CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe:
That's probably my fault :-) GeoJSON parsing has moved to gt-geojson-core which 
along with the gt-geojson-store replaces the functionality in gt-geojson. The 
plan is at some point in the future to remove gt-geoson but currently GeoServer 
makes use of it (at least I think that was the problem) and I ran out of time 
and energy,

With gt-geoson-core you should be able to do something like this:


GeometryFactory gf = new GeometryFactory();
SimpleFeatureType type = DataUtilities.createType("test", 
"the_geom:Point:srid=4326");
SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
builder.add(gf.createPoint(new Coordinate(1.23456789, 0.123456789)));
SimpleFeature feature = builder.buildFeature(null);
ByteArrayOutputStream out = new ByteArrayOutputStream();
GeoJSONWriter writer = new GeoJSONWriter(out);
writer.setMaxDecimals(6);

writer.write(feature);

Ian


On Thu, 16 May 2024 at 05:56, Phil Scadden 
<p.scad...@gns.cri.nz<mailto:p.scad...@gns.cri.nz>> wrote:
Ultimately, what I am trying to do is read some features from a geopkg using 
geotools, fidding with contents of the feature and then writing the Feature to 
an ESRI FeatureServer using the REST API. Along the way, I have to get the 
geotools geometry converted to an ESRI Geometry class.
 The ESRI OGCGeometry 
(https://esri.github.io/geometry-api-java<https://esri.github.io/geometry-api-java%20can>
 can convert to ESRI geometry, but the fromGeoJson seems to be only method for 
creating a OGCGeometry.

What I am struggling with is getting a GeoJSON string out of geotools. I added 
gt-geojson module but can only see method for writing to file. Am I missing 
something blindingly obvious here? The documentation doesn’t seem up to date – 
pointing to methods that (eg GeoJSONWriter) that don’t exist (and pages 404 in 
the Javadoc).

Using 31.0

Also looking at option of using a WKT route instead.


________________________________________________
Ngā mihi, Nā Phil Scadden (he/him)
Te Raraunga me te Tātaritanga Mokowā Aronuku (Geospatial Data and Analysis)
GNS Science Te Pῡ Ao
13A Alma St, Renwick, 7204
New Zealand Ph +64 27 3463185

“Whāia te iti kahurangi ki te tūohu koe me he maunga teitei”

Notice: This email and any attachments are confidential and may not be used, 
published or redistributed without the prior written consent of the Institute 
of Geological and Nuclear Sciences Limited (GNS Science). If received in error 
please destroy and immediately notify GNS Science. Do not copy or disclose the 
contents.
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net<mailto:GeoTools-GT2-Users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


--
Ian Turton
Notice: This email and any attachments are confidential and may not be used, 
published or redistributed without the prior written consent of the Institute 
of Geological and Nuclear Sciences Limited (GNS Science). If received in error 
please destroy and immediately notify GNS Science. Do not copy or disclose the 
contents.
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to