Dear Andrea and all, I'm trying to conclude that pull request but I'm stuck on tests and I can work over it only on sparetime so I'm wondering if someone can give some hint (links or examples) on how to test it.
I've planned to create a test simulating a datastore which has support for pregeneralization and finally check that the hint has been appended to the query. The problem is that I'm not able to create that datastore, I've tried to: - Moke the datastore - Moke the featuresource - Implement a new dummy featuresource - look to other implementations related to pregeneralized data with no success: when I try to verify and call Set<Key> hints = pregeneralizedLayer.getSimpleFeatureSource().getSupportedHints(); hints only contains the MamoryStore hints only... Here is one of the snippet I've produced with no success: private final static class PregenDataStore extends MemoryDataStore { + + + private final static class _FeatureSource extends MemoryFeatureSource { + +// MemoryFeatureSource delegate; + + public _FeatureSource(ContentEntry entry) { + super(entry); + + Set<Hints.Key> supportedHints = new HashSet<Hints.Key>(); + supportedHints.addAll(hints); + supportedHints.add(Hints.GEOMETRY_DISTANCE); + hints=Collections.unmodifiableSet(supportedHints); + } + + } + + _FeatureSource fs; + + /** + * Creates the new feature store. + * + */ + @SuppressWarnings("unchecked") + public PregenDataStore() throws IOException { + super(); + } + + @Override + public ContentFeatureSource getFeatureSource(String name) throws IOException { + + if (fs!=null) + return fs; + fs = spy(new _FeatureSource(name)); + + return fs; + } + } I'll appreciate if any of you (List) can share a better Idea to test it or a way to moke the supported hints. Regards, C. Il giorno mer 27 mag 2020 alle ore 12:14 carlo cancellieri < geo.ccancelli...@gmail.com> ha scritto: > Dear Andrea and ML, > > The vector tiles plugin should probably be modified, although I'm >> wondering why this was not done when it was written. >> > > I've just completed a first patch having a great speedup improvement of > performances and now GADM do not require anymore 5gb of ram to be rendered > (at level 0) and geoserver do not hangs anymore, I really like it. > > I will followup with some more details and measurements later but as you > may immagine the speedup is obvious and the improve of performance depends > mainly on the level of the simplification and the way we pregeneralize the > store. > > The speedup in generating tiles is just a direct consequence of that. > > >> Could be an oversight, but could have also been a conscious decision? >> Maybe something related to producing >> topologically valid geometries in output? And yet, the GEOMETRY_DISTANCE >> hint is specifically designed to return >> > > Well, good question, I'm looking for the author of that extension with no > luck, who's the maintainer? > > Looking at this part of the presentation > https://youtu.be/xdc67aZVO7E?t=530 it seems that those feature should be > implemented into that extension, not sure why they are not there. > > Anyhow looking at the examples on how to build the pregeneralized > geometries they are always generated using > ST_SimplifyPreserveTopology(geom,...) which helps keeping the topology, > even if onthefly simplification is not enabled. > > I'm blocked also by Atlassian Issue tracking login issue (PTDF-3856) so, I > can wait for a clarifications by the author/maintainer, then I will share > the implementation for your suggestions/comments and start adding tests for > the PR. > > Thank you all and regards, > Carlo > > > >> topologically valid geometries: >> >> /** >> * Asks a datastore having a vector pyramid (pre-generalized >> geometries) to return the geometry >> * version whose points have been generalized less than the specified >> distance (further >> * generalization might be performed by the client in memory). >> * >> * <p>The geometries returned are supposed to be topologically valid. >> */ >> public static final Key GEOMETRY_DISTANCE = new Key(Double.class); >> >> Well, you know where to look and have familiarity with the source code... >> PRs welcomed :-D >> >> Cheers >> Andrea >> >> On Thu, May 14, 2020 at 6:45 PM carlo cancellieri < >> geo.ccancelli...@gmail.com> wrote: >> >>> Dear list, >>> we're trying to configure a pregeneralized datastore to speedup the >>> vector tyles cache generation with no luck. >>> >>> Actually asking in layerpreview for a simple application/openlayer >>> everything works very well. >>> ------- >>> 14 May 20:45:36 DEBUG [renderer.lite] - Computed scale denominator: >>> 2.7922819993363017E8 >>> 14 May 20:45:36 DEBUG [renderer.lite] - creating rules for scale >>> denominator - 279,228,199.934 >>> 14 May 20:45:36 DEBUG [data.util] - CRSConverterFactory can be applied >>> from Strings to CRS only. >>> 14 May 20:45:36 DEBUG [data.util] - InterpolationConverterFactory can be >>> applied from Strings to Interpolation only. >>> 14 May 20:45:36 DEBUG [renderer.lite] - Processing 1 stylers for >>> n50:gadm36_0_3857_gen >>> 14 May 20:45:36 DEBUG [renderer.lite] - Expanding rendering area by 2 >>> pixels to consider stroke width >>> 14 May 20:45:36 WARN [operation.projection] - Possible use of "Popular >>> Visualisation Pseudo Mercator" projection outside its valid area. >>> Longitude 2147483287░00.0'W is out of range (▒180░). >>> 14 May 20:45:36 DEBUG [renderer.lite] - Querying layer >>> n50:gadm36_0_3857_gen with bbox: ReferencedEnvelope[-2.4862478922090434E7 : >>> 2.4862478922090434E7, -3.604277604743299E7 : 2.4315191650220517E7] >>> 14 May 20:45:36 TRACE [util.factory] - ENTRY (GeometryFactory, >>> JTS_GEOMETRY_FACTORY) >>> 14 May 20:45:36 TRACE [util.factory] - RETURN (GeometryFactory, >>> JTS_GEOMETRY_FACTORY): found implementation Optional. >>> 14 May 20:45:36 DEBUG [data.gen] - Hint geometry distance: >>> 62547.11678513289 >>> 14 May 20:45:36 DEBUG [data.gen] - Hint geometry distance: >>> 62547.11678513289 >>> 14 May 20:45:36 INFO [data.gen] - Using generalizsation: postgis_n50 >>> gadm36_0_3857 geom500 500.0 >>> 14 May 20:45:36 DEBUG [geotools.jdbc] - CREATE CONNECTION >>> 14 May 20:45:36 DEBUG [data.jdbc] - exporting PropertyName >>> 14 May 20:45:36 DEBUG [data.util] - CRSConverterFactory can be applied >>> from Strings to CRS only. >>> 14 May 20:45:36 DEBUG [data.util] - InterpolationConverterFactory can be >>> applied from Strings to Interpolation only. >>> 14 May 20:45:36 DEBUG [geotools.jdbc] - SELECT >>> "gid",ST_AsBinary("geom500") as "geom500" FROM "public"."gadm36_0_3857" >>> WHERE "geom" && ST_GeomFromWKB(?, 3857) >>> 14 May 20:45:36 DEBUG [geotools.jdbc] - 1 = POLYGON >>> ((-24862478.922090434 -19971868.88040857, 24862478.922090434 >>> -19971868.88040857, 24862478.922090434 19971868.880408563, >>> -24862478.922090434 19971868.880408563, -24862478.922090434 >>> -19971868.88040857)) >>> 14 May 20:45:48 DEBUG [geotools.jdbc] - CLOSE CONNECTION >>> ----- >>> >>> Once we try to ask for a mapbox vector tile (or geoJson) to WMS using >>> the layerpreview page, seems that the hint for the geometry distance is not >>> used as well. >>> >>> ---- >>> 14 May 20:49:34 DEBUG [geoserver.wms] - setting up map >>> 14 May 20:49:34 DEBUG [data.gen] - Hint for geometry simplification in >>> query, fallback to base feature >>> 14 May 20:49:34 DEBUG [data.gen] - No hint for geometry distance in >>> query, fallback to base feature >>> 14 May 20:49:34 DEBUG [data.gen] - Hint for geometry simplification in >>> query, fallback to base feature >>> 14 May 20:49:34 DEBUG [data.gen] - No hint for geometry distance in >>> query, fallback to base feature >>> 14 May 20:49:34 DEBUG [geotools.jdbc] - CREATE CONNECTION >>> 14 May 20:49:34 DEBUG [data.jdbc] - exporting PropertyName >>> 14 May 20:49:34 DEBUG [data.util] - CRSConverterFactory can be applied >>> from Strings to CRS only. >>> 14 May 20:49:34 DEBUG [data.util] - InterpolationConverterFactory can be >>> applied from Strings to Interpolation only. >>> 14 May 20:49:34 DEBUG [geotools.jdbc] - SELECT >>> "gid","gid_0","name_0",ST_AsBinary("geom") as "geom","fid" FROM >>> "public"."gadm36_0_3857" WHERE "geom" && ST_GeomFromWKB(?, 3857) >>> 14 May 20:49:34 DEBUG [geotools.jdbc] - 1 = POLYGON >>> ((-20100916.899652816 -30304381.79087722, 20100916.899652816 >>> -30304381.79087722, 20100916.899652816 18516704.85076622, >>> -20100916.899652816 18516704.85076622, -20100916.899652816 >>> -30304381.79087722)) >>> 14 May 20:52:01 DEBUG [geotools.jdbc] - CLOSE CONNECTION4 >>> ------ >>> >>> Is this behaviour related to this thread?: >>> >>> https://subscription.packtpub.com/book/application_development/9781783289615/1/ch01lvl1sec18/improving-performance-with-pregeneralized-features >>> >>> >>> If so, which is the best way to sort it out (use pregeneralized to >>> speedup the vector tyle generation)? >>> >>> Our table has 4 geometry columns for each feature, may we can try to >>> select them using an appropriate style? >>> >>> Thank you for your hints! >>> >>> C. >>> >>> -- >>> Mr. Carlo Cancellieri >>> *skype*: ccancellieri >>> *Twitter*: @cancellieric >>> *LinkedIn*: http://it.linkedin.com/in/ccancellieri/ >>> _______________________________________________ >>> Geoserver-users mailing list >>> >>> Please make sure you read the following two resources before posting to >>> this list: >>> - Earning your support instead of buying it, but Ian Turton: >>> http://www.ianturton.com/talks/foss4g.html#/ >>> - The GeoServer user list posting guidelines: >>> http://geoserver.org/comm/userlist-guidelines.html >>> >>> If you want to request a feature or an improvement, also see this: >>> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer >>> >>> >>> Geoserver-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/geoserver-users >>> >> >> >> -- >> >> Regards, Andrea Aime >> >> == GeoServer Professional Services from the experts! Visit >> http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf >> Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa >> (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 >> http://www.geo-solutions.it 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.* >> > > > -- > Mr. Carlo Cancellieri > *skype*: ccancellieri > *Twitter*: @cancellieric > *LinkedIn*: http://it.linkedin.com/in/ccancellieri/ > -- Mr. Carlo Cancellieri *skype*: ccancellieri *Twitter*: @cancellieric *LinkedIn*: http://it.linkedin.com/in/ccancellieri/
_______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users