On Tue, Jun 9, 2015 at 12:09 AM, Elliott Bradshaw <[email protected]> wrote:
> Hi all, > > Firstly, I just want to say that I really like GeoTools/GeoServer. The > extensibility is fantastic, and it's pretty fun to develop against. > > > I'm working on a geotools datastore implementation for a project. I've > heeded the GT recommendation of using ContentDataStore, since > AbstractDataStore has been deprecated. I'm running into an issue though. > I'm injecting query hints in a GSProcess via invertQuery(...) in order to > communicate to my datastore that I want to do a rendering transformation, > and I'm trying to offload the heavy lifting for this transform to an > external system. I've seen a similar technique used in other projects. > > I've found that invertQuery is getting a Query.ALL as the targetQuery, > regardless of what I pass in a CQL statement/bounding box. This comes from > RenderedImageMapOutputFormat, which kicks off the transform with the > following call: > > > Object result = helper.applyRenderingTransformation(transformation, > layer.getFeatureSource(), > layer.getQuery(), Query.ALL, readGG, > coverageCRS, interpolationHints); > Since I can't add Hints to a Query.ALL, I'm wrapping it in a new Query for > now as a workaround. I'm wondering if I'm doing something wrong to get to > this point though, since I know that Hints are being added in this method > in other systems. Is this expected behavior? If so, is there a more > elegant way to do this kind of thing? > That's the way you're supposed to do it, return a different query object, not alter the one that is being passed in. If wanted you to modify the input query, we would not have added a return Query, changing the one we pass as an input would have been suffiicient ;-) The code above looks old though... right now we are doing something different: https://github.com/geotools/geotools/blob/master/modules/library/render/src/main/java/org/geotools/renderer/lite/StreamingRenderer.java#L2065 > > My second issue is coming from ContentDataStore. The > SimpleFeatureCollection is gotten by calling > ContentFeatureSource.getFeatures(query). This method is final in > ContentFeatureSource. It creates a ContentFeatureCollection, which derives > the feature type from the feature source. From what I can tell, this makes > it impossible to return a collection with a different feature type than the > ContentFeatureSource normally builds by default. > > This is by design, if you are building a feature collection that has a different feature type (as in, completely different) you're then breaking the API contract, I'm surprised the client can work at all with that scenario. It's different if they client is asking for less properties of course, in that case you can tell ContentFeatureSource that you can do retyping (there is a method you can override, lot of "canXYZ" methods in there that you can override to declare a specific capability in your implementation). Cheers Andrea -- == 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 Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. -------------------------------------------------------
------------------------------------------------------------------------------
_______________________________________________ GeoTools-Devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
