You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(23) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(8) |
Feb
(11) |
Mar
(14) |
Apr
(21) |
May
(43) |
Jun
(25) |
Jul
(19) |
Aug
(23) |
Sep
(26) |
Oct
(27) |
Nov
(46) |
Dec
(13) |
2004 |
Jan
(34) |
Feb
(20) |
Mar
(17) |
Apr
(18) |
May
(58) |
Jun
(64) |
Jul
(86) |
Aug
(50) |
Sep
(67) |
Oct
(124) |
Nov
(83) |
Dec
(159) |
2005 |
Jan
(127) |
Feb
(127) |
Mar
(133) |
Apr
(113) |
May
(113) |
Jun
(176) |
Jul
(182) |
Aug
(156) |
Sep
(138) |
Oct
(182) |
Nov
(148) |
Dec
(130) |
2006 |
Jan
(156) |
Feb
(158) |
Mar
(170) |
Apr
(114) |
May
(145) |
Jun
(135) |
Jul
(85) |
Aug
(163) |
Sep
(170) |
Oct
(180) |
Nov
(167) |
Dec
(124) |
2007 |
Jan
(133) |
Feb
(200) |
Mar
(193) |
Apr
(237) |
May
(154) |
Jun
(140) |
Jul
(199) |
Aug
(331) |
Sep
(123) |
Oct
(95) |
Nov
(125) |
Dec
(194) |
2008 |
Jan
(162) |
Feb
(148) |
Mar
(143) |
Apr
(207) |
May
(207) |
Jun
(231) |
Jul
(225) |
Aug
(178) |
Sep
(141) |
Oct
(201) |
Nov
(146) |
Dec
(124) |
2009 |
Jan
(232) |
Feb
(264) |
Mar
(213) |
Apr
(215) |
May
(153) |
Jun
(244) |
Jul
(71) |
Aug
(124) |
Sep
(247) |
Oct
(278) |
Nov
(155) |
Dec
(178) |
2010 |
Jan
(203) |
Feb
(133) |
Mar
(338) |
Apr
(226) |
May
(386) |
Jun
(385) |
Jul
(146) |
Aug
(162) |
Sep
(172) |
Oct
(72) |
Nov
(69) |
Dec
(96) |
2011 |
Jan
(63) |
Feb
(112) |
Mar
(235) |
Apr
(198) |
May
(260) |
Jun
(239) |
Jul
(309) |
Aug
(186) |
Sep
(140) |
Oct
(174) |
Nov
(105) |
Dec
(41) |
2012 |
Jan
(68) |
Feb
(132) |
Mar
(89) |
Apr
(61) |
May
(113) |
Jun
(129) |
Jul
(62) |
Aug
(144) |
Sep
(94) |
Oct
(116) |
Nov
(151) |
Dec
(57) |
2013 |
Jan
(101) |
Feb
(144) |
Mar
(93) |
Apr
(75) |
May
(67) |
Jun
(52) |
Jul
(64) |
Aug
(67) |
Sep
(65) |
Oct
(55) |
Nov
(26) |
Dec
(32) |
2014 |
Jan
(38) |
Feb
(40) |
Mar
(40) |
Apr
(43) |
May
(28) |
Jun
(50) |
Jul
(79) |
Aug
(90) |
Sep
(75) |
Oct
(45) |
Nov
(62) |
Dec
(49) |
2015 |
Jan
(40) |
Feb
(64) |
Mar
(80) |
Apr
(43) |
May
(49) |
Jun
(46) |
Jul
(23) |
Aug
(69) |
Sep
(49) |
Oct
(61) |
Nov
(43) |
Dec
(33) |
2016 |
Jan
(15) |
Feb
(63) |
Mar
(40) |
Apr
(56) |
May
(43) |
Jun
(35) |
Jul
(41) |
Aug
(35) |
Sep
(10) |
Oct
(41) |
Nov
(39) |
Dec
(37) |
2017 |
Jan
(57) |
Feb
(19) |
Mar
(36) |
Apr
(8) |
May
(19) |
Jun
(17) |
Jul
(9) |
Aug
(18) |
Sep
(19) |
Oct
(17) |
Nov
(4) |
Dec
(13) |
2018 |
Jan
(17) |
Feb
(15) |
Mar
(23) |
Apr
(22) |
May
(5) |
Jun
(3) |
Jul
(30) |
Aug
(10) |
Sep
(20) |
Oct
(12) |
Nov
(1) |
Dec
(9) |
2019 |
Jan
(13) |
Feb
(19) |
Mar
(34) |
Apr
(16) |
May
(14) |
Jun
(10) |
Jul
(21) |
Aug
(25) |
Sep
(22) |
Oct
(3) |
Nov
(10) |
Dec
(8) |
2020 |
Jan
|
Feb
(19) |
Mar
(3) |
Apr
(51) |
May
(5) |
Jun
(12) |
Jul
(16) |
Aug
(15) |
Sep
(7) |
Oct
(16) |
Nov
(24) |
Dec
(24) |
2021 |
Jan
(11) |
Feb
(27) |
Mar
(14) |
Apr
(14) |
May
(3) |
Jun
(11) |
Jul
(8) |
Aug
(8) |
Sep
(15) |
Oct
(24) |
Nov
(11) |
Dec
(2) |
2022 |
Jan
(6) |
Feb
(14) |
Mar
(1) |
Apr
(9) |
May
(4) |
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(17) |
Oct
(5) |
Nov
(15) |
Dec
(4) |
2023 |
Jan
(7) |
Feb
(16) |
Mar
(9) |
Apr
(13) |
May
(15) |
Jun
(7) |
Jul
(8) |
Aug
(3) |
Sep
(3) |
Oct
(13) |
Nov
(4) |
Dec
(8) |
2024 |
Jan
(9) |
Feb
(10) |
Mar
(6) |
Apr
(3) |
May
(7) |
Jun
(7) |
Jul
(7) |
Aug
(5) |
Sep
|
Oct
(6) |
Nov
(1) |
Dec
|
2025 |
Jan
(3) |
Feb
(1) |
Mar
(5) |
Apr
|
May
(1) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jody G. <jod...@gm...> - 2023-05-19 07:11:06
|
Yes, it remains down. Checking on the osgeo chat channel the DNS provider is aware of the issue and is working on it. There is speculation it may be a DOS attack as other domains on the same nameserver are fine ... I have been checking with https://isitup.org/osgeo.org :) -- Jody Garnett On Thu, May 18, 2023 at 1:19 PM Vince Marinelli via GeoTools-GT2-Users < geo...@li...> wrote: > I am unable to reach the osgeo.org domain. This is causing Maven builds > to fail for me with the error: > > ...org.geotools:gt-opengis:jar:24.6: Failed to read artifact descriptor > for org.geotools:gt-opengis:jar:24.6: The following artifacts could not be > resolved: org.geotools:gt-opengis:pom:24.6 (absent): Could not transfer > artifact org.geotools:gt-opengis:pom:24.6 from/to osgeo ( > https://repo.osgeo.org/repository/release/): repo.osgeo.org: Temporary > failure in name resolution: Unknown host repo.osgeo.org: Temporary > failure in name resolution... > > It appears that it has been for at least a few hours now. > > -- > *Vince Marinelli* > Principal Software Engineer > *Workiva Inc.* > > *eMail:* vin...@wo... > *Mobile:* (610) 220-6311 > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > |
From: Vince M. <vin...@wo...> - 2023-05-18 20:18:05
|
I am unable to reach the osgeo.org domain. This is causing Maven builds to fail for me with the error: ...org.geotools:gt-opengis:jar:24.6: Failed to read artifact descriptor for org.geotools:gt-opengis:jar:24.6: The following artifacts could not be resolved: org.geotools:gt-opengis:pom:24.6 (absent): Could not transfer artifact org.geotools:gt-opengis:pom:24.6 from/to osgeo ( https://repo.osgeo.org/repository/release/): repo.osgeo.org: Temporary failure in name resolution: Unknown host repo.osgeo.org: Temporary failure in name resolution... It appears that it has been for at least a few hours now. -- *Vince Marinelli* Principal Software Engineer *Workiva Inc.* *eMail:* vin...@wo... *Mobile:* (610) 220-6311 |
From: Ian T. <ijt...@gm...> - 2023-05-10 19:01:42
|
That sounds like a great addition, I have a feeling that I planned to go back and do that when I added mouse wheel support, but never got around to it. Ian On Wed, 10 May 2023, 00:37 Leif Gruenwoldt, <le...@gm...> wrote: > This is really cool Ian. > > My team use the geotools swing example in a couple of our projects, > it's great to see tutorials like this. This is really helpful. > > As an aside, I've been meaning to submit a pull request for the swing > example that improves the zoom tool to make it behave like Google Maps > (and most any other modern GIS). It makes the mouse wheel zoom in > relative to the cursor position in the window. > > > Leif > > > > On Mon, May 8, 2023 at 10:20 AM Ian Turton <ijt...@gm...> wrote: > > > > If you ever wondered how to add a tool to the GeoTools swing map then > I've written a short introduction to it. There is also a link to a small > project that provides a tool to draw lines on a map. > > > > See > https://blog.ianturton.com/geotools/2023/05/08/drawing-on-a-geotools-map.html > for all the gory details. > > > > cheers > > > > Ian > > > > -- > > Ian Turton > > _______________________________________________ > > GeoTools-GT2-Users mailing list > > Geo...@li... > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > |
From: Leif G. <le...@gm...> - 2023-05-09 23:37:27
|
This is really cool Ian. My team use the geotools swing example in a couple of our projects, it's great to see tutorials like this. This is really helpful. As an aside, I've been meaning to submit a pull request for the swing example that improves the zoom tool to make it behave like Google Maps (and most any other modern GIS). It makes the mouse wheel zoom in relative to the cursor position in the window. Leif On Mon, May 8, 2023 at 10:20 AM Ian Turton <ijt...@gm...> wrote: > > If you ever wondered how to add a tool to the GeoTools swing map then I've written a short introduction to it. There is also a link to a small project that provides a tool to draw lines on a map. > > See https://blog.ianturton.com/geotools/2023/05/08/drawing-on-a-geotools-map.html for all the gory details. > > cheers > > Ian > > -- > Ian Turton > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users |
From: Jody G. <jod...@gm...> - 2023-05-09 04:57:41
|
Hey thanks :) The docs can of course link to related resources at the end of the tutorials :) On Mon, May 8, 2023 at 7:20 AM Ian Turton <ijt...@gm...> wrote: > If you ever wondered how to add a tool to the GeoTools swing map then I've > written a short introduction to it. There is also a link to a small project > that provides a tool to draw lines on a map. > > See > https://blog.ianturton.com/geotools/2023/05/08/drawing-on-a-geotools-map.html > for all the gory details. > > cheers > > Ian > > -- > Ian Turton > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- -- Jody Garnett |
From: Ian T. <ijt...@gm...> - 2023-05-08 14:18:48
|
If you ever wondered how to add a tool to the GeoTools swing map then I've written a short introduction to it. There is also a link to a small project that provides a tool to draw lines on a map. See https://blog.ianturton.com/geotools/2023/05/08/drawing-on-a-geotools-map.html for all the gory details. cheers Ian -- Ian Turton |
From: Taavi I. <ta...@ea...> - 2023-05-03 08:52:28
|
Hi Found information about JDK support here: https://docs.geotools.org/latest/userguide/build/install/jdk.html "Java 8 - GeoTools 15.x up to and including GeoTools 28.x (OpenJDK and Oracle JRE tested)" So you could try to upgrade to GeoTools 28.x with Java 8. I've upgraded from 22.x quite recently with not too big application and there were roadblocks with few versions, so I suggest going one major release at the time. I also noticed that even minor versions could behave differently. I really depends on your application. Cheers, Taavi On Tue, May 2, 2023 at 7:38 PM Mieke Zwart <mie...@as...> wrote: > > Hello list, > > > > Unfortunately, I have to use an old version of Geotools, as my client is reliant on software that is build in java 8 and cannot upgrade. I think the latest version of Geotools that was working with java 8 is 20.5. > > Now I have the following problem and have not been able to find a solution in the last week, searching various forums and this mailing list. > > I have a WKT (or Geometry or SimpleFeature) and need to convert it to GML (to submit into a WFS insert transaction). > > I have tried using the encoder in different ways: > > Feeding it either a SimpleFeature, Geometry derived from SimpleFeature or Geometry derived from WKT. > Using GML._Geometry, GML.MultiPolygon or various other QNames to encode the feature/geometry. > > I get depending on the above, a variety of errors: > > If I try to encode a Geometry I usually get the error that gid property is missing: > > Exception in thread "main" java.lang.RuntimeException: Failed to get property: gid > > at org.geotools.xml.impl.GetPropertyExecutor.visit(GetPropertyExecutor.java:105) > > at org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:220) > > at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:186) > > at org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:47) > > at org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:32) > > at org.geotools.xml.Encoder.encode(Encoder.java:883) > > at org.geotools.xml.Encoder.encode(Encoder.java:584) > > at org.geotools.tutorial.App.main(App.java) > > Caused by: java.lang.ClassCastException: org.locationtech.jts.geom.MultiPolygon incompatible with com.vividsolutions.jts.geom.Geometry > > at org.geotools.gml3.bindings.AbstractGeometryTypeBinding.getProperty(AbstractGeometryTypeBinding.java:129) > > at org.geotools.xml.impl.GetPropertyExecutor.visit(GetPropertyExecutor.java:103) > > ... 7 more > > > > Code: > > String woPolygonWKT = "MULTIPOLYGON (((4 0, 2 2, 4 4, 6 2, 4 0)), ((2 1, 1.9807852804032304 0.8049096779838718, 1.9238795325112867 0.6173165676349102, 1.8314696123025453 0.4444297669803978, 1.7071067811865475 0.2928932188134525, 1.5555702330196022 0.1685303876974548, 1.3826834323650898 0.0761204674887133, 1.1950903220161284 0.0192147195967696, 1 0, 0.8049096779838718 0.0192147195967696, 0.6173165676349103 0.0761204674887133, 0.444429766980398 0.1685303876974547, 0.2928932188134525 0.2928932188134524, 0.1685303876974547 0.4444297669803978, 0.0761204674887132 0.6173165676349106, 0.0192147195967695 0.8049096779838723, 0 1.0000000000000007, 0.0192147195967698 1.1950903220161293, 0.0761204674887137 1.382683432365091, 0.1685303876974555 1.5555702330196035, 0.2928932188134536 1.7071067811865488, 0.4444297669803993 1.8314696123025462, 0.6173165676349122 1.9238795325112874, 0.8049096779838739 1.9807852804032309, 1.0000000000000024 2, 1.1950903220161309 1.98078528040323, 1.3826834323650925 1.9238795325112856, 1.5555702330196048 1.8314696123025436, 1.70710678118655 1.7071067811865452, 1.8314696123025471 1.5555702330195993, 1.9238795325112883 1.3826834323650863, 1.9807852804032313 1.1950903220161244, 2 1)))"; > > WKTReader wktR = new WKTReader(); > > Geometry geom2; > > try { > > geom2 = wktR.read(woPolygonWKT); > > System.out.println(geom2.toString()); > > //geom2.setSRID(4326); > > org.geotools.xml.Configuration configuration = new org.geotools.gml3.GMLConfiguration(); > > org.geotools.xml.Encoder encoder = new org.geotools.xml.Encoder( configuration ); > > ByteArrayOutputStream out = new ByteArrayOutputStream(); > > > > try { > > System.out.println("trying to encode"); > > encoder.encode(geom2, org.geotools.gml3.GML.MultiPolygon,out); > > } catch (IOException e) { > > // TODO Auto-generated catch block > > e.printStackTrace(); > > } > > System.out.println(out.toString()); > > } catch (ParseException e1) { > > // TODO Auto-generated catch block > > e1.printStackTrace(); > > } > > > > I have also tried: > public String convertSimpleFeatureToGML(SimpleFeature simpleFeature) { > > GMLConfiguration gmlConfiguration = new GMLConfiguration(true); > > Geometry geom = (Geometry) simpleFeature.getDefaultGeometry(); > > > > Encoder encoder = new Encoder(gmlConfiguration); > > ByteArrayOutputStream boas = new ByteArrayOutputStream(); > > try { > > encoder.encode(geom, GML.MultiPolygon, boas); > > return boas.toString(); > > } catch (IOException e) { > > e.printStackTrace(); > > return ""; > > } > > > > } > > And then calling this function with a simpleFeature that contains the multipolygon described above in the WKT. > > > > If anyone can help me, it would be greatly appreciated. > > > > Kind Regards / Met vriendelijke groet, > > Asset People B.V. > > > > Mieke Zwart > > > > M. +31 (0) 612 967 788 > > E. mie...@as... > > > > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users |
From: Ian T. <ijt...@gm...> - 2023-05-03 08:27:14
|
The message `org.locationtech.jts.geom.MultiPolygon incompatible with com.vividsolutions.jts.geom.Geometry` - suggests that you have two incompatible versions of JTS in your build. Ian On Tue, 2 May 2023 at 17:39, Mieke Zwart <mie...@as...> wrote: > Hello list, > > > > Unfortunately, I have to use an old version of Geotools, as my client is > reliant on software that is build in java 8 and cannot upgrade. I think the > latest version of Geotools that was working with java 8 is 20.5. > > Now I have the following problem and have not been able to find a solution > in the last week, searching various forums and this mailing list. > > I have a WKT (or Geometry or SimpleFeature) and need to convert it to GML > (to submit into a WFS insert transaction). > > I have tried using the encoder in different ways: > > - Feeding it either a SimpleFeature, Geometry derived from > SimpleFeature or Geometry derived from WKT. > - Using GML._Geometry, GML.MultiPolygon or various other QNames to > encode the feature/geometry. > > I get depending on the above, a variety of errors: > > If I try to encode a Geometry I usually get the error that gid property is > missing: > > Exception in thread "main" *java.lang.RuntimeException*: Failed to get > property: gid > > at org.geotools.xml.impl.GetPropertyExecutor.visit( > *GetPropertyExecutor.java:105*) > > at org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute( > *BindingWalker.java:220*) > > at org.geotools.xml.impl.BindingWalker.walk(*BindingWalker.java:186* > ) > > at org.geotools.xml.impl.BindingVisitorDispatch.walk( > *BindingVisitorDispatch.java:47*) > > at org.geotools.xml.impl.BindingVisitorDispatch.walk( > *BindingVisitorDispatch.java:32*) > > at org.geotools.xml.Encoder.encode(*Encoder.java:883*) > > at org.geotools.xml.Encoder.encode(*Encoder.java:584*) > > at org.geotools.tutorial.App.main(App.java) > > Caused by: *java.lang.ClassCastException*: > org.locationtech.jts.geom.MultiPolygon incompatible with > com.vividsolutions.jts.geom.Geometry > > at > org.geotools.gml3.bindings.AbstractGeometryTypeBinding.getProperty( > *AbstractGeometryTypeBinding.java:129*) > > at org.geotools.xml.impl.GetPropertyExecutor.visit( > *GetPropertyExecutor.java:103*) > > ... 7 more > > > > Code: > > String woPolygonWKT = "MULTIPOLYGON (((4 0, 2 2, 4 4, 6 2, 4 0)), ((2 1, > 1.9807852804032304 0.8049096779838718, 1.9238795325112867 > 0.6173165676349102, 1.8314696123025453 0.4444297669803978, > 1.7071067811865475 0.2928932188134525, 1.5555702330196022 > 0.1685303876974548, 1.3826834323650898 0.0761204674887133, > 1.1950903220161284 0.0192147195967696, 1 0, 0.8049096779838718 > 0.0192147195967696, 0.6173165676349103 0.0761204674887133, > 0.444429766980398 0.1685303876974547, 0.2928932188134525 > 0.2928932188134524, 0.1685303876974547 0.4444297669803978, > 0.0761204674887132 0.6173165676349106, 0.0192147195967695 > 0.8049096779838723, 0 1.0000000000000007, 0.0192147195967698 > 1.1950903220161293, 0.0761204674887137 1.382683432365091, > 0.1685303876974555 1.5555702330196035, 0.2928932188134536 > 1.7071067811865488, 0.4444297669803993 1.8314696123025462, > 0.6173165676349122 1.9238795325112874, 0.8049096779838739 > 1.9807852804032309, 1.0000000000000024 2, 1.1950903220161309 > 1.98078528040323, 1.3826834323650925 1.9238795325112856, 1.5555702330196048 > 1.8314696123025436, 1.70710678118655 1.7071067811865452, 1.8314696123025471 > 1.5555702330195993, 1.9238795325112883 1.3826834323650863, > 1.9807852804032313 1.1950903220161244, 2 1)))"; > > WKTReader wktR = *new* WKTReader(); > > Geometry geom2; > > *try* { > > geom2 = wktR.read(woPolygonWKT); > > System.*out*.println(geom2.toString()); > > //geom2.setSRID(4326); > > org.geotools.xml.Configuration configuration = *new* > org.geotools.gml3.GMLConfiguration(); > > org.geotools.xml.Encoder encoder = *new* > org.geotools.xml.Encoder( configuration ); > > ByteArrayOutputStream out = *new* ByteArrayOutputStream(); > > > > *try* { > > System.*out*.println("trying to encode"); > > encoder.encode(geom2, org.geotools.gml3.GML. > *MultiPolygon*,out); > > } *catch* (IOException e) { > > // *TODO* Auto-generated catch block > > e.printStackTrace(); > > } > > System.*out*.println(out.toString()); > > } *catch* (ParseException e1) { > > // *TODO* Auto-generated catch block > > e1.printStackTrace(); > > } > > > > I have also tried: > *public* String convertSimpleFeatureToGML(SimpleFeature > simpleFeature) { > > GMLConfiguration gmlConfiguration = *new* GMLConfiguration( > *true*); > > Geometry geom = (Geometry) simpleFeature.getDefaultGeometry(); > > > > Encoder encoder = *new* Encoder(gmlConfiguration); > > ByteArrayOutputStream boas = *new* ByteArrayOutputStream(); > > *try* { > > encoder.encode(geom, GML.*MultiPolygon*, boas); > > *return* boas.toString(); > > } *catch* (IOException e) { > > e.printStackTrace(); > > *return* ""; > > } > > > > } > > And then calling this function with a simpleFeature that contains the > multipolygon described above in the WKT. > > > > If anyone can help me, it would be greatly appreciated. > > > > Kind Regards / Met vriendelijke groet, > > *Asset People B.V.* > > > > *Mieke Zwart* > > > > M. +31 (0) 612 967 788 > > E. mie...@as... > > > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- Ian Turton |
From: Mieke Z. <mie...@as...> - 2023-05-02 16:37:27
|
Hello list, Unfortunately, I have to use an old version of Geotools, as my client is reliant on software that is build in java 8 and cannot upgrade. I think the latest version of Geotools that was working with java 8 is 20.5. Now I have the following problem and have not been able to find a solution in the last week, searching various forums and this mailing list. I have a WKT (or Geometry or SimpleFeature) and need to convert it to GML (to submit into a WFS insert transaction). I have tried using the encoder in different ways: * Feeding it either a SimpleFeature, Geometry derived from SimpleFeature or Geometry derived from WKT. * Using GML._Geometry, GML.MultiPolygon or various other QNames to encode the feature/geometry. I get depending on the above, a variety of errors: If I try to encode a Geometry I usually get the error that gid property is missing: Exception in thread "main" java.lang.RuntimeException: Failed to get property: gid at org.geotools.xml.impl.GetPropertyExecutor.visit(GetPropertyExecutor.java:105) at org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:220) at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:186) at org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:47) at org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:32) at org.geotools.xml.Encoder.encode(Encoder.java:883) at org.geotools.xml.Encoder.encode(Encoder.java:584) at org.geotools.tutorial.App.main(App.java) Caused by: java.lang.ClassCastException: org.locationtech.jts.geom.MultiPolygon incompatible with com.vividsolutions.jts.geom.Geometry at org.geotools.gml3.bindings.AbstractGeometryTypeBinding.getProperty(AbstractGeometryTypeBinding.java:129) at org.geotools.xml.impl.GetPropertyExecutor.visit(GetPropertyExecutor.java:103) ... 7 more Code: String woPolygonWKT = "MULTIPOLYGON (((4 0, 2 2, 4 4, 6 2, 4 0)), ((2 1, 1.9807852804032304 0.8049096779838718, 1.9238795325112867 0.6173165676349102, 1.8314696123025453 0.4444297669803978, 1.7071067811865475 0.2928932188134525, 1.5555702330196022 0.1685303876974548, 1.3826834323650898 0.0761204674887133, 1.1950903220161284 0.0192147195967696, 1 0, 0.8049096779838718 0.0192147195967696, 0.6173165676349103 0.0761204674887133, 0.444429766980398 0.1685303876974547, 0.2928932188134525 0.2928932188134524, 0.1685303876974547 0.4444297669803978, 0.0761204674887132 0.6173165676349106, 0.0192147195967695 0.8049096779838723, 0 1.0000000000000007, 0.0192147195967698 1.1950903220161293, 0.0761204674887137 1.382683432365091, 0.1685303876974555 1.5555702330196035, 0.2928932188134536 1.7071067811865488, 0.4444297669803993 1.8314696123025462, 0.6173165676349122 1.9238795325112874, 0.8049096779838739 1.9807852804032309, 1.0000000000000024 2, 1.1950903220161309 1.98078528040323, 1.3826834323650925 1.9238795325112856, 1.5555702330196048 1.8314696123025436, 1.70710678118655 1.7071067811865452, 1.8314696123025471 1.5555702330195993, 1.9238795325112883 1.3826834323650863, 1.9807852804032313 1.1950903220161244, 2 1)))"; WKTReader wktR = new WKTReader(); Geometry geom2; try { geom2 = wktR.read(woPolygonWKT); System.out.println(geom2.toString()); //geom2.setSRID(4326); org.geotools.xml.Configuration configuration = new org.geotools.gml3.GMLConfiguration(); org.geotools.xml.Encoder encoder = new org.geotools.xml.Encoder( configuration ); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { System.out.println("trying to encode"); encoder.encode(geom2, org.geotools.gml3.GML.MultiPolygon,out); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(out.toString()); } catch (ParseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } I have also tried: public String convertSimpleFeatureToGML(SimpleFeature simpleFeature) { GMLConfiguration gmlConfiguration = new GMLConfiguration(true); Geometry geom = (Geometry) simpleFeature.getDefaultGeometry(); Encoder encoder = new Encoder(gmlConfiguration); ByteArrayOutputStream boas = new ByteArrayOutputStream(); try { encoder.encode(geom, GML.MultiPolygon, boas); return boas.toString(); } catch (IOException e) { e.printStackTrace(); return ""; } } And then calling this function with a simpleFeature that contains the multipolygon described above in the WKT. If anyone can help me, it would be greatly appreciated. Kind Regards / Met vriendelijke groet, Asset People B.V. Mieke Zwart M. +31 (0) 612 967 788 E. mie...@as...<mailto:mie...@as...> |
From: Kalesse S. <Soe...@dw...> - 2023-04-26 08:02:05
|
Hello, I think this reported problem could be related tot he ticket https://osgeo-org.atlassian.net/browse/GEOT-6517. Best Regards Sören -----Ursprüngliche Nachricht----- Von: Jody Garnett <jod...@gm...> Gesendet: Freitag, 21. April 2023 20:58 An: ger...@gm... Cc: geo...@li...; geo...@li... Betreff: Re: [Geotools-gt2-users] Memory Leak in Streaming Parser The EMF / XSD parsing stuff does have some caches; but no I am not aware why this is happening for you. Can you use your IDE profiler or heap management tools to determine what objects are leaking? You should be able to call parse multiple times if you are reading from the same input stream... -- Jody Garnett On Fri, Apr 21, 2023 at 4:47 AM ger...@gm... <mailto:ger...@gm...> <ger...@gm... <mailto:ger...@gm...> > wrote: Hello togehter, my usecase is using method StreamingParser.parse() in a loop in my java application (ca. 5000 iterations). Unfortunately this leads to a huge memory leak. Also this memory can never be released by the garbage collector. It stays in the old gen heap forever. I use https://github.com/geotools/geotools/blob/main/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xsd/StreamingParser.java <https://ofcsg2dvf1.dwd.de/fmlurlsvc/?fewReq=:B:JVg8NzM3PCBwOzQoNiBvYjs2Nzw2NyB1b2FoZ3JzdGM7PmdjPzIwMWQ1ZDVlNzFjYzdlYzVlMWU0NT4yMDI2MWI+ZT42PmdiPyByOzcwPjQ3NjUwNzcgd29iOzU1Skw2RFdHNjcxMTM1KzU1Skw2RFdENjcxMTM1IHRldnI7VWljdGNoKE1namN1dWNGYnFiKGJjIGU7MzQgbmJqOzY=&url=https%3a%2f%2fgithub.com%2fgeotools%2fgeotools%2fblob%2fmain%2fmodules%2fextension%2fxsd%2fxsd-core%2fsrc%2fmain%2fjava%2forg%2fgeotools%2fxsd%2fStreamingParser.java> in this way: for(.....) { try { org.geotools.xsd.StreamingParser parser = new org.geotools.xsd.StreamingParser(gml, inputStream, Polygon.class); polygon = (Polygon) parser.parse(); } finally { inputStream.close(); } } Do you have any idea why that happens? Are you even able to fix it? I use the following maven dependency: <dependency> <groupId>org.geotools.xsd</groupId> <artifactId>gt-xsd-wfs</artifactId> <version>27.2</version> </dependency> Best regards, Gero _______________________________________________ GeoTools-GT2-Users mailing list Geo...@li... <mailto:Geo...@li...> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users <https://ofcsg2dvf1.dwd.de/fmlurlsvc/?fewReq=:B:JVg8NzM3PCBwOzQoNiBvYjs2Nzw2NyB1b2FoZ3JzdGM7ZTYyPmBgMzUzNDFgNGdkPmVnPzZlNjM3MWUyNWQ/PjQ0MGQwZzY2YiByOzcwPjQ3NjUwNzcgd29iOzU1Skw2RFdHNjcxMTM1KzU1Skw2RFdENjcxMTM1IHRldnI7VWljdGNoKE1namN1dWNGYnFiKGJjIGU7MzQgbmJqOzY=&url=https%3a%2f%2flists.sourceforge.net%2flists%2flistinfo%2fgeotools-gt2-users> |
From: Dennis G. <de...@ge...> - 2023-04-24 19:22:35
|
Hi Jody: Will try to create a reproducer if I can isolate. Might actually be a build tool issue as I just realized I do have a standalone project using similar imports and this same framework that does package to native just fine. In this current effort there are a lot of maven sub-modules so that might be where I'm hitting an issue. Dennis On Thu, Apr 20, 2023 at 7:09 PM Jody Garnett <jod...@gm...> wrote: > The classes you reference are from the java units module. Have a look if > that has changed for Java 17? > > On Thu, Apr 20, 2023 at 3:17 PM Dennis Gesker <de...@ge...> wrote: > >> Hello: >> >> I was attempting to port a few routines to Quarkus. When attempting to >> create a native package a number of errors are reported; >> BytecodeParserError, UnresolvedElementExcpetion, etc. >> >> These errors seem to be related to the packages >> >> tech.units.indriya.format, org.geotools.measure, org.geotools.util, org.geotools.referencing.wkt >> >> My maven dependencies are: >> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-main</artifactId> >> <version>29.0</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-opengis</artifactId> >> <version>29.0</version> >> </dependency> >> >> I'm using the >> quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 provided >> by the Quarkus project but also get the same errors using my local GraalVM >> installation. >> >> I've tried setting the classes reported to initialize at run time but >> this didn't work. >> >> Can geotools be used in Graalvm native-image applications? I didn't see >> anything in the FAQ. >> >> Thanks, >> Dennis >> _______________________________________________ >> GeoTools-GT2-Users mailing list >> Geo...@li... >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> > -- > -- > Jody Garnett > |
From: Jody G. <jod...@gm...> - 2023-04-21 18:59:08
|
The EMF / XSD parsing stuff does have some caches; but no I am not aware why this is happening for you. Can you use your IDE profiler or heap management tools to determine what objects are leaking? You should be able to call parse multiple times if you are reading from the same input stream... -- Jody Garnett On Fri, Apr 21, 2023 at 4:47 AM ger...@gm... <ger...@gm...> wrote: > Hello togehter, > > my usecase is using method StreamingParser.parse() in a loop in my java > application (ca. 5000 iterations). Unfortunately this leads to a huge > memory leak. Also this memory can never be released by the garbage > collector. It stays in the old gen heap forever. > > I use > > > https://github.com/geotools/geotools/blob/main/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xsd/StreamingParser.java > > > in this way: > > for(.....) { > > try { > > org.geotools.xsd.StreamingParser parser = new org.geotools.xsd.StreamingParser(gml, inputStream, Polygon.class); > > polygon = (Polygon) parser.parse(); > > } finally { > > inputStream.close(); > > } > > } > > > > Do you have any idea why that happens? Are you even able to fix it? > > > I use the following maven dependency: > > <dependency> > > <groupId>org.geotools.xsd</groupId> > > <artifactId>gt-xsd-wfs</artifactId> > > <version>27.2</version> > > </dependency> > > > > Best regards, > > Gero > > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > |
From: Matthijs L. <mat...@b3...> - 2023-04-21 15:17:48
|
If you're just looking to parse a GML geometry and not a complete "application schema", try using the very simple streaming parser: https://docs.geotools.org/stable/userguide/unsupported/gml-geometry-streaming.html It is a lot faster than the XSD based parser, especially if you use the Aalto or Woodstox XML parser. Matthijs On 21/04/2023 13.46, ger...@gm... wrote: >>> >>> Hello togehter, >>> >>> my usecase is using method StreamingParser.parse() in a loop in my >>> java application (ca. 5000 iterations). Unfortunately this leads to >>> a huge memory leak. Also this memory can never be released by the >>> garbage collector. It stays in the old gen heap forever. >>> >>> I use >>> >>> https://github.com/geotools/geotools/blob/main/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xsd/StreamingParser.java >>> >>> >>> in this way: >>> >>> for(.....) { >>> try { >>> org.geotools.xsd.StreamingParser parser = new org.geotools.xsd.StreamingParser(gml, inputStream, Polygon.class); >>> polygon = (Polygon) parser.parse(); >>> } finally { >>> inputStream.close(); >>> } >>> } >>> >>> >>> >>> Do you have any idea why that happens? Are you even able to fix it? >>> >>> >>> I use the following maven dependency: >>> >>> <dependency> >>> <groupId>org.geotools.xsd</groupId> >>> <artifactId>gt-xsd-wfs</artifactId> >>> <version>27.2</version> >>> </dependency> >>> >>> >>> >>> Best regards, >>> >>> Gero >>> > > > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users |
From: <ger...@gm...> - 2023-04-21 11:46:42
|
>> Hello togehter, >> >> my usecase is using method StreamingParser.parse() in a loop in my >> java application (ca. 5000 iterations). Unfortunately this leads to a >> huge memory leak. Also this memory can never be released by the >> garbage collector. It stays in the old gen heap forever. >> >> I use >> >> https://github.com/geotools/geotools/blob/main/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xsd/StreamingParser.java >> >> >> in this way: >> >> for(.....) { >> try { >> org.geotools.xsd.StreamingParser parser = new org.geotools.xsd.StreamingParser(gml, inputStream, Polygon.class); >> polygon = (Polygon) parser.parse(); >> } finally { >> inputStream.close(); >> } >> } >> >> >> >> Do you have any idea why that happens? Are you even able to fix it? >> >> >> I use the following maven dependency: >> >> <dependency> >> <groupId>org.geotools.xsd</groupId> >> <artifactId>gt-xsd-wfs</artifactId> >> <version>27.2</version> >> </dependency> >> >> >> >> Best regards, >> >> Gero >> |
From: Jody G. <jod...@gm...> - 2023-04-21 01:09:04
|
The classes you reference are from the java units module. Have a look if that has changed for Java 17? On Thu, Apr 20, 2023 at 3:17 PM Dennis Gesker <de...@ge...> wrote: > Hello: > > I was attempting to port a few routines to Quarkus. When attempting to > create a native package a number of errors are reported; > BytecodeParserError, UnresolvedElementExcpetion, etc. > > These errors seem to be related to the packages > > tech.units.indriya.format, org.geotools.measure, org.geotools.util, org.geotools.referencing.wkt > > My maven dependencies are: > > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-main</artifactId> > <version>29.0</version> > </dependency> > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-opengis</artifactId> > <version>29.0</version> > </dependency> > > I'm using the > quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 provided by > the Quarkus project but also get the same errors using my local GraalVM > installation. > > I've tried setting the classes reported to initialize at run time but this > didn't work. > > Can geotools be used in Graalvm native-image applications? I didn't see > anything in the FAQ. > > Thanks, > Dennis > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- -- Jody Garnett |
From: Dennis G. <de...@ge...> - 2023-04-20 22:15:45
|
Hello: I was attempting to port a few routines to Quarkus. When attempting to create a native package a number of errors are reported; BytecodeParserError, UnresolvedElementExcpetion, etc. These errors seem to be related to the packages tech.units.indriya.format, org.geotools.measure, org.geotools.util, org.geotools.referencing.wkt My maven dependencies are: <dependency> <groupId>org.geotools</groupId> <artifactId>gt-main</artifactId> <version>29.0</version> </dependency> <dependency> <groupId>org.geotools</groupId> <artifactId>gt-opengis</artifactId> <version>29.0</version> </dependency> I'm using the quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 provided by the Quarkus project but also get the same errors using my local GraalVM installation. I've tried setting the classes reported to initialize at run time but this didn't work. Can geotools be used in Graalvm native-image applications? I didn't see anything in the FAQ. Thanks, Dennis |
From: George Ma <cha...@gm...> - 2023-04-14 01:13:17
|
Hello everyone. I want to use Geotools to convert a geotiff file to another resolution. I find API document from geotools.org website like this: https://docs.geotools.org/stable/javadocs/org/geotools/coverage/processing/operation/Resample.html - *Resampling* The grid coverage can be resampled at a different cell resolution. Some implementations may be able to do resampling efficiently at any resolution. Also a non-rectilinear grid coverage can be accessed as rectilinear grid coverage with this operation. I can use the "resample" operation to reprojection like this: public static GridCoverage2D resample( final GridCoverage2D coverage, final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS, final GridGeometry2D gridGeometry, final Interpolation interpolation) throws WcsException { final ParameterValueGroup param = (ParameterValueGroup) PROCESSOR.getOperation("Resample"). getParameters(); param.parameter("Source").setValue(coverage); param.parameter("CoordinateReferenceSystem").setValue(targetCRS); param.parameter("GridGeometry").setValue(gridGeometry); param.parameter("InterpolationType").setValue(interpolation); return (GridCoverage2D) ((Resample) PROCESSOR.getOperation("Resample")).doOperation(param, hints); } How can I use "resample" operation to convert to another resolution?How to set the related parameter. Appreciate any clues. Best regards. Thank you very much. |
From: Bart A. <bar...@gm...> - 2023-04-13 07:35:13
|
Hi Jody, Thank you very much for trying to help me, and forgive me for not reporting back yet that i have found a working solution; In the gt-xsd-wfs module there is a unit test, "WFSFeatureCollectionEncodingTest" which provides a working example that fixed my problem, the one thing i missed is that apparently to do this with the org.geotools.xsd.Encoder class i need to wrap my FeatureCollection in a FeatureCollectionType wrapper. Now i had looked at the unit test several times already but assumed at first glance that this was encoding a DescribeFeatureType output because of the class name "FeatureCollectionType" of the main object it starts with. But when i run it i could see what was going on, the "FeatureCollectionType" class name is a bit confusing here. The working code i have now, which works well: var featureCollectionType = WfsFactory.eINSTANCE.createFeatureCollectionType(); featureCollectionType.getFeature().add(featureCollection); var configuration = new WFSConfiguration(); var encoder = new Encoder(configuration); encoder.getNamespaces().declarePrefix("myprefix", "http://myuri"); try (var output = FastBufferedOutputStream.create(response.getOutputStream())) { encoder.encode(featureCollectionType, WFS.FeatureCollection, output); } If you can find a working unit test with the GML class doing GML 3.2 encoding i would like to see it, i could not find it. I totally agree with your statement about OpenGIS consortium making things too complicated, i guess there are too many parties involved that all want to have their say in these standards, my experience is that usually the 1.0 standards are better than the 2.0 version etc. that follow. Unfortunately, ArcGIS will not accept GeoJSON from a WFS implementation, at least i was told so by ESRI. Now that it works, all is well that ends well, adding the JSON output literally took me 5 minutes using Geotools ! Best Regards, Bart Adriaanse Software developer at Deltares.nl On Wed, 12 Apr 2023 at 18:01, Jody Garnett <jod...@gm...> wrote: > Bart: > > One thing I could not see in your example is your schema? GML 3.2 is not > a document format - it is a choose your own adventure that you can use to > define your own document structure (for your simple features) as a schema > document. > > The GeoTools docs try to explain this and include examples for encoding > your simple feature type as an XSD document; and then using that XSD > document to configure a GMLConfiguration allowing your simple feature > collection to be written out to a document. > For WFS the XSD document comes from the DescribeFeatureType operation. > > I am afraid OGC makes things terribly complicated which is why a lot of > folks use GeoJSON when communicating with a WFS.... > Personally I think GML is a better format for archival or interchange > purposes where data integrity needs to be maintained and understood across > systems. > > In the example you provided the root element of the document was used as > WFS.FeatureCollection, and depends on "SampleFeature" being setup to extend > abstract feature. The WFS.FeatureCollection members are part of the > substitution group "AbstractFeature". > > The https://docs.geotools.org/stable/userguide/library/xml/geometry.html > snippet for writing out XSD was: > > SimpleFeatureType TYPE = DataUtilities.createType("location", > "geom:Point,name:String"); > > GML encode = new GML(Version.GML3); > encode.setBaseURL(new URL("http://localhost/")); > encode.setNamespace("location", "http://localhost/location.xsd"); > encode.encode(outputStream, TYPE); > > You can check your schema document when you have generated it to ensure > "SampleFeature" is setup in this manner so that the result can be encoded > as a WFS FeatureCollection. > > > -- > Jody Garnett > > > On Mon, Apr 3, 2023 at 4:11 AM Bart Adriaanse <bar...@gm...> > wrote: > >> Hi there, >> >> I have been struggling with this for some time, even after investigating >> the source code of both Geotools and GeoServer i cannot seem to get this to >> work. >> >> I have a extremely simple WFS 1.0 interface in an application and need to >> update this to WFS 2.0 but i am stuck at encoding a SimpleFeatureCollection >> to GML 3.2 >> >> I would be very grateful if someone who is very familiar with Geotools >> can find some time to see what is wrong with my code, here is a copy of the >> Junit test i am trying to get to work: >> >> import org.geotools.data.DataUtilities; >> import org.geotools.data.collection.ListFeatureCollection; >> import org.geotools.data.simple.SimpleFeatureCollection; >> import org.geotools.feature.simple.SimpleFeatureBuilder; >> import org.geotools.feature.simple.SimpleFeatureTypeBuilder; >> import org.geotools.gml3.v3_2.GML; >> import org.geotools.gml3.v3_2.GMLConfiguration; >> import org.geotools.wfs.WFS; >> import org.geotools.xsd.Encoder; >> import org.junit.Assert; >> import org.junit.Test; >> import org.locationtech.jts.geom.Coordinate; >> import org.locationtech.jts.geom.GeometryFactory; >> import org.locationtech.jts.geom.Point; >> import org.opengis.feature.simple.SimpleFeature; >> import org.opengis.feature.simple.SimpleFeatureType; >> >> import javax.xml.namespace.QName; >> import java.io.ByteArrayOutputStream; >> import java.io.IOException; >> import java.nio.charset.StandardCharsets; >> >> public class EncodeGML3_2Example { >> >> @Test >> public void encodeGML32() { >> try { >> // Create a SimpleFeatureType >> SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); >> typeBuilder.setName("SampleFeature"); >> typeBuilder.add("geom", Point.class); >> typeBuilder.add("name", String.class); >> SimpleFeatureType featureType = typeBuilder.buildFeatureType(); >> >> // Create and add features to SimpleFeatureCollection >> ListFeatureCollection featureList = new ListFeatureCollection(featureType >> ); >> SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder( >> featureType); >> GeometryFactory geometryFactory = new GeometryFactory(); >> Point point1 = geometryFactory.createPoint(new Coordinate(10, 10)); >> featureBuilder.add(point1); >> featureBuilder.add("Point 1"); >> SimpleFeature feature1 = featureBuilder.buildFeature("1"); >> Point point2 = geometryFactory.createPoint(new Coordinate(20, 20)); >> featureBuilder.add(point2); >> featureBuilder.add("Point 2"); >> SimpleFeature feature2 = featureBuilder.buildFeature("2"); >> featureList.add(feature1); >> featureList.add(feature2); >> SimpleFeatureCollection featureCollection = DataUtilities.collection( >> featureList); >> >> // Encode the SimpleFeatureCollection as GML 3.2 >> GMLConfiguration gmlConfig = new GMLConfiguration(true); >> Encoder encoder = new Encoder(gmlConfig); >> encoder.setSchemaLocation("http://www.opengis.net/gml", " >> http://schemas.opengis.net/gml/3.2.1/gml.xsd"); >> encoder.setNamespaceAware(true); >> encoder.setRootElementType(WFS.FeatureCollection); >> String gml = encoder.encodeAsString(featureCollection, GML. >> FeatureCollection); >> >> Assert.assertTrue(!gml.isEmpty()); >> >> } catch (Exception e) { >> e.printStackTrace(); >> } >> } >> >> } >> _______________________________________________ >> GeoTools-GT2-Users mailing list >> Geo...@li... >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> > |
From: Jody G. <jod...@gm...> - 2023-04-12 16:01:32
|
Bart: One thing I could not see in your example is your schema? GML 3.2 is not a document format - it is a choose your own adventure that you can use to define your own document structure (for your simple features) as a schema document. The GeoTools docs try to explain this and include examples for encoding your simple feature type as an XSD document; and then using that XSD document to configure a GMLConfiguration allowing your simple feature collection to be written out to a document. For WFS the XSD document comes from the DescribeFeatureType operation. I am afraid OGC makes things terribly complicated which is why a lot of folks use GeoJSON when communicating with a WFS.... Personally I think GML is a better format for archival or interchange purposes where data integrity needs to be maintained and understood across systems. In the example you provided the root element of the document was used as WFS.FeatureCollection, and depends on "SampleFeature" being setup to extend abstract feature. The WFS.FeatureCollection members are part of the substitution group "AbstractFeature". The https://docs.geotools.org/stable/userguide/library/xml/geometry.html snippet for writing out XSD was: SimpleFeatureType TYPE = DataUtilities.createType("location", "geom:Point,name:String"); GML encode = new GML(Version.GML3); encode.setBaseURL(new URL("http://localhost/")); encode.setNamespace("location", "http://localhost/location.xsd"); encode.encode(outputStream, TYPE); You can check your schema document when you have generated it to ensure "SampleFeature" is setup in this manner so that the result can be encoded as a WFS FeatureCollection. -- Jody Garnett On Mon, Apr 3, 2023 at 4:11 AM Bart Adriaanse <bar...@gm...> wrote: > Hi there, > > I have been struggling with this for some time, even after investigating > the source code of both Geotools and GeoServer i cannot seem to get this to > work. > > I have a extremely simple WFS 1.0 interface in an application and need to > update this to WFS 2.0 but i am stuck at encoding a SimpleFeatureCollection > to GML 3.2 > > I would be very grateful if someone who is very familiar with Geotools can > find some time to see what is wrong with my code, here is a copy of the > Junit test i am trying to get to work: > > import org.geotools.data.DataUtilities; > import org.geotools.data.collection.ListFeatureCollection; > import org.geotools.data.simple.SimpleFeatureCollection; > import org.geotools.feature.simple.SimpleFeatureBuilder; > import org.geotools.feature.simple.SimpleFeatureTypeBuilder; > import org.geotools.gml3.v3_2.GML; > import org.geotools.gml3.v3_2.GMLConfiguration; > import org.geotools.wfs.WFS; > import org.geotools.xsd.Encoder; > import org.junit.Assert; > import org.junit.Test; > import org.locationtech.jts.geom.Coordinate; > import org.locationtech.jts.geom.GeometryFactory; > import org.locationtech.jts.geom.Point; > import org.opengis.feature.simple.SimpleFeature; > import org.opengis.feature.simple.SimpleFeatureType; > > import javax.xml.namespace.QName; > import java.io.ByteArrayOutputStream; > import java.io.IOException; > import java.nio.charset.StandardCharsets; > > public class EncodeGML3_2Example { > > @Test > public void encodeGML32() { > try { > // Create a SimpleFeatureType > SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); > typeBuilder.setName("SampleFeature"); > typeBuilder.add("geom", Point.class); > typeBuilder.add("name", String.class); > SimpleFeatureType featureType = typeBuilder.buildFeatureType(); > > // Create and add features to SimpleFeatureCollection > ListFeatureCollection featureList = new ListFeatureCollection(featureType > ); > SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType > ); > GeometryFactory geometryFactory = new GeometryFactory(); > Point point1 = geometryFactory.createPoint(new Coordinate(10, 10)); > featureBuilder.add(point1); > featureBuilder.add("Point 1"); > SimpleFeature feature1 = featureBuilder.buildFeature("1"); > Point point2 = geometryFactory.createPoint(new Coordinate(20, 20)); > featureBuilder.add(point2); > featureBuilder.add("Point 2"); > SimpleFeature feature2 = featureBuilder.buildFeature("2"); > featureList.add(feature1); > featureList.add(feature2); > SimpleFeatureCollection featureCollection = DataUtilities.collection( > featureList); > > // Encode the SimpleFeatureCollection as GML 3.2 > GMLConfiguration gmlConfig = new GMLConfiguration(true); > Encoder encoder = new Encoder(gmlConfig); > encoder.setSchemaLocation("http://www.opengis.net/gml", " > http://schemas.opengis.net/gml/3.2.1/gml.xsd"); > encoder.setNamespaceAware(true); > encoder.setRootElementType(WFS.FeatureCollection); > String gml = encoder.encodeAsString(featureCollection, GML. > FeatureCollection); > > Assert.assertTrue(!gml.isEmpty()); > > } catch (Exception e) { > e.printStackTrace(); > } > } > > } > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > |
From: Jody G. <jod...@gm...> - 2023-04-12 15:35:16
|
Good morning Bart: I have not had an opportunity to assist, some of the code you are trying represents my attempt to get this working when it was initially written. I find that the best approach is to look at a geotools test-case which does what you want - and then step through with a debugger to see how the objects were setup and to review the structure of the objects (in this case a GMLConfiguration). I searched using: https://github.com/geotools/geotools/search?l=Java&q=3.2+gml+simplefeature+test And found: https://github.com/geotools/geotools/blob/main/modules/extension/xsd/xsd-gml3/src/test/java/org/geotools/gml3/GML3EncodingTest.java -- Jody Garnett On Mon, Apr 3, 2023 at 4:11 AM Bart Adriaanse <bar...@gm...> wrote: > Hi there, > > I have been struggling with this for some time, even after investigating > the source code of both Geotools and GeoServer i cannot seem to get this to > work. > > I have a extremely simple WFS 1.0 interface in an application and need to > update this to WFS 2.0 but i am stuck at encoding a SimpleFeatureCollection > to GML 3.2 > > I would be very grateful if someone who is very familiar with Geotools can > find some time to see what is wrong with my code, here is a copy of the > Junit test i am trying to get to work: > > import org.geotools.data.DataUtilities; > import org.geotools.data.collection.ListFeatureCollection; > import org.geotools.data.simple.SimpleFeatureCollection; > import org.geotools.feature.simple.SimpleFeatureBuilder; > import org.geotools.feature.simple.SimpleFeatureTypeBuilder; > import org.geotools.gml3.v3_2.GML; > import org.geotools.gml3.v3_2.GMLConfiguration; > import org.geotools.wfs.WFS; > import org.geotools.xsd.Encoder; > import org.junit.Assert; > import org.junit.Test; > import org.locationtech.jts.geom.Coordinate; > import org.locationtech.jts.geom.GeometryFactory; > import org.locationtech.jts.geom.Point; > import org.opengis.feature.simple.SimpleFeature; > import org.opengis.feature.simple.SimpleFeatureType; > > import javax.xml.namespace.QName; > import java.io.ByteArrayOutputStream; > import java.io.IOException; > import java.nio.charset.StandardCharsets; > > public class EncodeGML3_2Example { > > @Test > public void encodeGML32() { > try { > // Create a SimpleFeatureType > SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); > typeBuilder.setName("SampleFeature"); > typeBuilder.add("geom", Point.class); > typeBuilder.add("name", String.class); > SimpleFeatureType featureType = typeBuilder.buildFeatureType(); > > // Create and add features to SimpleFeatureCollection > ListFeatureCollection featureList = new ListFeatureCollection(featureType > ); > SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType > ); > GeometryFactory geometryFactory = new GeometryFactory(); > Point point1 = geometryFactory.createPoint(new Coordinate(10, 10)); > featureBuilder.add(point1); > featureBuilder.add("Point 1"); > SimpleFeature feature1 = featureBuilder.buildFeature("1"); > Point point2 = geometryFactory.createPoint(new Coordinate(20, 20)); > featureBuilder.add(point2); > featureBuilder.add("Point 2"); > SimpleFeature feature2 = featureBuilder.buildFeature("2"); > featureList.add(feature1); > featureList.add(feature2); > SimpleFeatureCollection featureCollection = DataUtilities.collection( > featureList); > > // Encode the SimpleFeatureCollection as GML 3.2 > GMLConfiguration gmlConfig = new GMLConfiguration(true); > Encoder encoder = new Encoder(gmlConfig); > encoder.setSchemaLocation("http://www.opengis.net/gml", " > http://schemas.opengis.net/gml/3.2.1/gml.xsd"); > encoder.setNamespaceAware(true); > encoder.setRootElementType(WFS.FeatureCollection); > String gml = encoder.encodeAsString(featureCollection, GML. > FeatureCollection); > > Assert.assertTrue(!gml.isEmpty()); > > } catch (Exception e) { > e.printStackTrace(); > } > } > > } > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > |
From: Bart A. <bar...@gm...> - 2023-04-03 11:14:16
|
Sorry i forget to mention, the resulting string is not completely empty, but it only contains an empty <gml:FeatureCollection> element On Mon, 3 Apr 2023 at 13:10, Bart Adriaanse <bar...@gm...> wrote: > Hi there, > > I have been struggling with this for some time, even after investigating > the source code of both Geotools and GeoServer i cannot seem to get this to > work. > > I have a extremely simple WFS 1.0 interface in an application and need to > update this to WFS 2.0 but i am stuck at encoding a SimpleFeatureCollection > to GML 3.2 > > I would be very grateful if someone who is very familiar with Geotools can > find some time to see what is wrong with my code, here is a copy of the > Junit test i am trying to get to work: > > import org.geotools.data.DataUtilities; > import org.geotools.data.collection.ListFeatureCollection; > import org.geotools.data.simple.SimpleFeatureCollection; > import org.geotools.feature.simple.SimpleFeatureBuilder; > import org.geotools.feature.simple.SimpleFeatureTypeBuilder; > import org.geotools.gml3.v3_2.GML; > import org.geotools.gml3.v3_2.GMLConfiguration; > import org.geotools.wfs.WFS; > import org.geotools.xsd.Encoder; > import org.junit.Assert; > import org.junit.Test; > import org.locationtech.jts.geom.Coordinate; > import org.locationtech.jts.geom.GeometryFactory; > import org.locationtech.jts.geom.Point; > import org.opengis.feature.simple.SimpleFeature; > import org.opengis.feature.simple.SimpleFeatureType; > > import javax.xml.namespace.QName; > import java.io.ByteArrayOutputStream; > import java.io.IOException; > import java.nio.charset.StandardCharsets; > > public class EncodeGML3_2Example { > > @Test > public void encodeGML32() { > try { > // Create a SimpleFeatureType > SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); > typeBuilder.setName("SampleFeature"); > typeBuilder.add("geom", Point.class); > typeBuilder.add("name", String.class); > SimpleFeatureType featureType = typeBuilder.buildFeatureType(); > > // Create and add features to SimpleFeatureCollection > ListFeatureCollection featureList = new ListFeatureCollection(featureType > ); > SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType > ); > GeometryFactory geometryFactory = new GeometryFactory(); > Point point1 = geometryFactory.createPoint(new Coordinate(10, 10)); > featureBuilder.add(point1); > featureBuilder.add("Point 1"); > SimpleFeature feature1 = featureBuilder.buildFeature("1"); > Point point2 = geometryFactory.createPoint(new Coordinate(20, 20)); > featureBuilder.add(point2); > featureBuilder.add("Point 2"); > SimpleFeature feature2 = featureBuilder.buildFeature("2"); > featureList.add(feature1); > featureList.add(feature2); > SimpleFeatureCollection featureCollection = DataUtilities.collection( > featureList); > > // Encode the SimpleFeatureCollection as GML 3.2 > GMLConfiguration gmlConfig = new GMLConfiguration(true); > Encoder encoder = new Encoder(gmlConfig); > encoder.setSchemaLocation("http://www.opengis.net/gml", " > http://schemas.opengis.net/gml/3.2.1/gml.xsd"); > encoder.setNamespaceAware(true); > encoder.setRootElementType(WFS.FeatureCollection); > String gml = encoder.encodeAsString(featureCollection, GML. > FeatureCollection); > > Assert.assertTrue(!gml.isEmpty()); > > } catch (Exception e) { > e.printStackTrace(); > } > } > > } > |
From: Bart A. <bar...@gm...> - 2023-04-03 11:10:44
|
Hi there, I have been struggling with this for some time, even after investigating the source code of both Geotools and GeoServer i cannot seem to get this to work. I have a extremely simple WFS 1.0 interface in an application and need to update this to WFS 2.0 but i am stuck at encoding a SimpleFeatureCollection to GML 3.2 I would be very grateful if someone who is very familiar with Geotools can find some time to see what is wrong with my code, here is a copy of the Junit test i am trying to get to work: import org.geotools.data.DataUtilities; import org.geotools.data.collection.ListFeatureCollection; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.geotools.gml3.v3_2.GML; import org.geotools.gml3.v3_2.GMLConfiguration; import org.geotools.wfs.WFS; import org.geotools.xsd.Encoder; import org.junit.Assert; import org.junit.Test; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; import javax.xml.namespace.QName; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; public class EncodeGML3_2Example { @Test public void encodeGML32() { try { // Create a SimpleFeatureType SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); typeBuilder.setName("SampleFeature"); typeBuilder.add("geom", Point.class); typeBuilder.add("name", String.class); SimpleFeatureType featureType = typeBuilder.buildFeatureType(); // Create and add features to SimpleFeatureCollection ListFeatureCollection featureList = new ListFeatureCollection(featureType); SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType); GeometryFactory geometryFactory = new GeometryFactory(); Point point1 = geometryFactory.createPoint(new Coordinate(10, 10)); featureBuilder.add(point1); featureBuilder.add("Point 1"); SimpleFeature feature1 = featureBuilder.buildFeature("1"); Point point2 = geometryFactory.createPoint(new Coordinate(20, 20)); featureBuilder.add(point2); featureBuilder.add("Point 2"); SimpleFeature feature2 = featureBuilder.buildFeature("2"); featureList.add(feature1); featureList.add(feature2); SimpleFeatureCollection featureCollection = DataUtilities.collection( featureList); // Encode the SimpleFeatureCollection as GML 3.2 GMLConfiguration gmlConfig = new GMLConfiguration(true); Encoder encoder = new Encoder(gmlConfig); encoder.setSchemaLocation("http://www.opengis.net/gml", " http://schemas.opengis.net/gml/3.2.1/gml.xsd"); encoder.setNamespaceAware(true); encoder.setRootElementType(WFS.FeatureCollection); String gml = encoder.encodeAsString(featureCollection, GML.FeatureCollection ); Assert.assertTrue(!gml.isEmpty()); } catch (Exception e) { e.printStackTrace(); } } } |
From: Jody G. <jod...@gm...> - 2023-03-27 03:28:30
|
The parsers are around (in gt-geojson-core), although if you are interested in supporting the geojson datastore you are welcome to volunteer to help out :) Jody On Sun, Mar 26, 2023 at 7:43 PM Wzzzzzzj via GeoTools-GT2-Users < geo...@li...> wrote: > > Hi: > > I have a project want to use jar of geotools to process data from > other service which provided is geojson, but now geojson plugin is not > supported. > Is there an officially recommended method for geojson parsing? > ------------------------------ > Wzzzzzzj > 101...@qq... > > <https://wx.mail.qq.com/home/index?t=readmail_businesscard_midpage&nocheck=true&name=Wzzzzzzj&icon=http%3A%2F%2Fthirdqq.qlogo.cn%2Fg%3Fb%3Dsdk%26k%3Du5b35JiaTyqLAVm4QypRb3w%26s%3D100%26t%3D1556466694%3Frand%3D1644503191&mail=1019306750%40qq.com&code=> > > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- -- Jody Garnett |
From: <101...@qq...> - 2023-03-27 02:42:20
|
Hi: I have a project want to use jar of geotools to process data from other service which provided is geojson, but now geojson plugin is not supported. Is there an officially recommended method for geojson parsing? Wzzzzzzj 101...@qq... |
From: Taavi I. <ta...@ea...> - 2023-03-22 12:05:29
|
Thank you Andrea. I could join the Jira and created the ticket about the issue: https://osgeo-org.atlassian.net/browse/GEOT-7335 Cheers! Taavi On Mon, Feb 13, 2023 at 12:48 PM Andrea Aime <and...@ge...> wrote: > > Hi Taavi, > hopefully I made some room, can you try registering again? > > Best regards > Andrea > > On Mon, Feb 13, 2023 at 9:02 AM Taavi Ilves <ta...@ea...> wrote: >> >> Hi. >> >> Can someone help to file the bug about it? I still can't join Geotools >> Jira, since it's license limit has exceeded. >> >> Cheers, >> Taavi Ilves >> >> On Fri, Feb 10, 2023 at 3:41 PM Roar Brænden <roa...@gm...> wrote: >> > >> > Hi, >> > >> > I would prefer an empty collection and schema. If that's possible. >> > First thing would be to make that Jira ticket. >> > >> > I tried to have a look at it, but ended up with a different bug. >> > >> > Regards, >> > Roar Brænden >> > >> > >> > >> > > 8. feb. 2023 kl. 12:03 skrev Taavi Ilves <ta...@ea...>: >> > > >> > > Thanks for the response. >> > > >> > > Yep, I also would prefer it failing early on over how it dies at the >> > > moment. Previously (pre-24.3 or something like that), it failed with >> > > NullPointerException. I didn't know about that 2008 spec was explicit >> > > about non-empty features array, that probably could be it. >> > > >> > > About "actionable bug" I thought that code that fails is under >> > > "unmaintained" directory so I didn't know what it means. And whether >> > > filing bug, which was my first reaction, would even make sense because >> > > it being unmaintained. I could propose change, but I'm not very >> > > familiar with Geotools inner architecture to understand where the fix >> > > belongs, would it still through error or give some other meaningful >> > > result? If someone could point me in right direction with small >> > > explanation, it would be helpful. >> > > >> > > Cheers, >> > > Taavi >> > > >> > > On Tue, Feb 7, 2023 at 9:11 PM mark <mc....@gm...> wrote: >> > >> >> > >> Op 06-02-2023 om 16:31 schreef Taavi Ilves: >> > >>> Hi >> > >>> >> > >>> I would have submitted the bug to JIRA, but I could not join it: "Your >> > >>> email address ***@***.*** doesn't have access because >> > >>> osgeo-org.atlassian.net has reached its license limit." >> > >>> >> > >>> Anyway, I'm not 100% sure if this had been actionable bug, since >> > >>> `geojson-store` is under `modules/unsupported`, but here is my issue. >> > >>> >> > >>> GeoJSONDataStore dies with StackOverflowError when given this geojson: >> > >>> >> > >>> ``` >> > >>> { >> > >>> "type": "FeatureCollection", >> > >>> "features": [] >> > >>> } >> > >>> ``` >> > >>> >> > >>> AFAIK this is totally legit according to >> > >>> https://www.rfc-editor.org/rfc/rfc7946#section-3.3 : >> > >>>> The value of "features" is a JSON array. Each element of the array is a Feature object as defined above. It is possible for this array to be empty. >> > >>> >> > >>> I reproduced with this GeoJSONDataStoreTest test (simplified test from >> > >>> testFeatures() from same file): >> > >>> ``` >> > >>> @Test >> > >>> public void testEmptyFeatures() throws IOException { >> > >>> URL url = TestData.url(GeoJSONDataStore.class, >> > >>> "empty-featureCollection.json"); >> > >>> >> > >>> GeoJSONDataStore fds = new GeoJSONDataStore(url); >> > >>> String type = fds.getNames().get(0).getLocalPart(); >> > >>> fds.getFeatureReader(new Query(type), null); >> > >>> } >> > >>> ``` >> > >>> >> > >>> Code changes and stacktrace is here as well: >> > >>> https://gist.github.com/ilvez/ff4325c0fe8bc67e7b3bb8c3795ca373 >> > >>> >> > >>> Cheers, >> > >>> Taavi >> > >>> >> > >> >> > >> it seems to be bouncing back and forth trying to determine the schema; >> > >> but that is never going to succeed without any feature so it continues >> > >> to try until exhaustion. >> > >> >> > >> the reader could short-circuit on an empty collection, but you'd end up >> > >> without a schema, which is pretty much useless in geotools... personally >> > >> I'd prefer to fail with an exception early instead. >> > >> >> > >> This could be because the original 2008 geojson spec did not allow an >> > >> empty array for features. >> > >> >> > >> not sure what you mean with "actionable bug"; this is a community >> > >> project, basically anyone can propose a solution for this bug >> > >> >> > >> -M >> > >> >> > >> >> > >> >> > >> _______________________________________________ >> > >> GeoTools-GT2-Users mailing list >> > >> Geo...@li... >> > >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> > > >> > > >> > > _______________________________________________ >> > > GeoTools-GT2-Users mailing list >> > > Geo...@li... >> > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> > >> >> >> _______________________________________________ >> GeoTools-GT2-Users mailing list >> Geo...@li... >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > > > -- > > Regards, > > Andrea Aime > > == > GeoServer Professional Services from the experts! > > Visit http://bit.ly/gs-services-us for more information. > == > > Ing. Andrea Aime > @geowolf > Technical Lead > > GeoSolutions Group > phone: +39 0584 962313 > > fax: +39 0584 1660272 > > mob: +39 339 8844549 > > > https://www.geosolutionsgroup.com/ > > http://twitter.com/geosolutions_it > > ------------------------------------------------------- > > > Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. > > This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail |