Mumble... so there is no other way out? I guess my only way out is to use some XSLT post processing on the GML generation chain to switch from gml:Point to gml:DirectPosition then...
Cheers Andrea On Tue, Oct 5, 2010 at 6:01 AM, <[email protected]> wrote: > Yes, NVCL Borehole mapping uses DirectPosition for it's gml:Envelope mapping, > e.g. > > <AttributeMapping> > > <targetAttribute>gsml:indexData/gsml:BoreholeDetails/gsml:coredInterval/gml:Envelope</targetAttribute> > <ClientProperty> > <name>axisLabels</name> > <value>'core envelope'</value> > </ClientProperty> > <ClientProperty> > <name>srsDimension</name> > <value>'1'</value> > </ClientProperty> > <ClientProperty> > <name>srsName</name> > <value>strConcat('#',SHAPE_ID)</value> > </ClientProperty> > <ClientProperty> > <name>uomLabels</name> > <value>'m'</value> > </ClientProperty> > </AttributeMapping> > <AttributeMapping> > > <targetAttribute>gsml:indexData/gsml:BoreholeDetails/gsml:coredInterval/gml:Envelope/gml:lowerCorner</targetAttribute> > <sourceExpression> > <OCQL>CORED_START_DEPTH</OCQL> > </sourceExpression> > </AttributeMapping> > <AttributeMapping> > > <targetAttribute>gsml:indexData/gsml:BoreholeDetails/gsml:coredInterval/gml:Envelope/gml:upperCorner</targetAttribute> > <sourceExpression> > <OCQL>CORED_END_DEPTH</OCQL> > </sourceExpression> > </AttributeMapping> > > If the DirectPosition is treated as geometry, it will break our mapping. But > there again, from geoserver point of view, it should be a geometry. However > from the geoserver user point of view, a complex type give us the flexibility > of specifying 1D envelope which is not supported by geoserver at the moment. > > > -----Original Message----- > From: Caradoc-Davies, Ben (CESRE, Kensington) > Sent: Tuesday, 5 October 2010 11:30 AM > To: Tan, Florence (CESRE, Kensington); Warren, Peter (CESRE, North Ryde) > Cc: Fraser, Ryan (CESRE, Kensington); Angreani, Rini (CESRE, Kensington); > Atkinson, Rob (CLW, Lucas Heights) > Subject: Fwd: Re: [Geotools-devel] Binding DirectPosition with app-schema > > Does NVCL use DirectPosition? If so, now would be an excellent time > respond to this email (on-list). > > > -------- Original Message -------- > Subject: Re: [Geotools-devel] Binding DirectPosition with app-schema > Date: Tue, 05 Oct 2010 11:28:44 +0800 > From: Ben Caradoc-Davies <[email protected]> > To: Justin Deoliveira <[email protected]> > CC: Andrea Aime <[email protected]>, Geotools-Devel list > <[email protected]>, Rob Atkinson > <[email protected]>, Florence Tan <[email protected]> > > I am concerned that this would undo one of the things we fixed in GEOT-2505: > http://jira.codehaus.org/browse/GEOT-2505 > > This might break a bunch of use cases. I'll check with the users. > > On 05/10/10 04:35, Justin Deoliveira wrote: >> That makes sense. That GMLSchema contains autogenerated types for all gml >> schema types and gets customized in a need by need basis, as with the >> regular geometry types. +1 here but I think you may want to wait for Ben or >> Rini to weigh in before proceeding. >> >> 2c. >> >> -Justin >> >> On Mon, Oct 4, 2010 at 11:51 AM, Andrea >> Aime<[email protected]<mailto:[email protected]>> >> wrote: >> On Mon, Oct 4, 2010 at 7:26 PM, Andrea Aime >> <[email protected]<mailto:[email protected]>> wrote: >>> Hi, >>> I'm trying to use app-schema with a target schema that, unfortunately, >>> uses a DirectPosition as >>> the feature "geometry". I don't have any control over the schema so I >>> have to try and make it work >>> anyways. >>> >>> What I get overall is that my points are turned into their WKT >>> representation when the >>> GML encoding happens. Which is not what I want. >>> >>> Looking a bit more deeply I see that the attribute is correctly bound >>> to DirectPosition: >>> ComplexTypeImpl http://www.opengis.net/gml:DirectPositionType extends >>> doubleList(axisLabels:NCNameList,srsDimension:positiveInteger,srsName:anyURI,uomLabels:NCNameList) >>> but nowhere in the code there is an attempt to use converters to turn >>> the JTS Point into a DirectPosition. >>> >>> Now, I tracked down the issue to XPath.convertValue: >>> >>> private Object convertValue(final AttributeDescriptor descriptor, >>> final Object value) { >>> final AttributeType type = descriptor.getType(); >>> Class<?> binding = type.getBinding(); >>> >>> if (type instanceof ComplexType&& binding == Collection.class) { >>> if (!(value instanceof Collection)&& >>> isSimpleContentType(type)) { >>> ArrayList<Property> list = new ArrayList<Property>(); >>> if (value == null&& !descriptor.isNillable()) { >>> return list; >>> } >>> list.add(buildSimpleContent(type, value)); >>> return list; >>> } >>> } >>> if (binding == String.class&& value instanceof Collection) { >>> // if it's a single value in a collection, strip the square >>> brackets >>> String collectionString = value.toString(); >>> return collectionString.substring(1, collectionString.length() >>> - 1); >>> } >>> return FF.literal(value).evaluate(value, binding); >>> } >>> >>> type is a complex type, but binding for some reason is exactly >>> Collection.class, >>> which results in the wrong code path being chosen (the right one, imho, >>> would >>> be the usage of the last line, FF.literal(value).evaluate(value, binding), >>> which >>> could be expressed also as Converters.convert(value, binding)). >>> >>> Now... does anybody know why the binding ends up being a collection instead >>> of org.opengis.geometry.DirectPosition? >>> I still haven't quite tracked down where the bindings are built... >> >> Ok, tracked it down. >> The GMLSchema class contains the definitions of many gml foundation types, >> for point the definition is: >> >> >> public static final AttributeType POINTTYPE_TYPE = build_POINTTYPE_TYPE(); >> >> private static AttributeType build_POINTTYPE_TYPE() { >> AttributeType builtType; >> builtType = new AttributeTypeImpl( >> new NameImpl("http://www.opengis.net/gml","PointType"), >> com.vividsolutions.jts.geom.Point.class, false, >> false, Collections.<Filter>emptyList(), >> ABSTRACTGEOMETRICPRIMITIVETYPE_TYPE, null >> ); >> return builtType; >> } >> >> Notice the direct binding to Point.class. >> But for DirectPosition it is: >> >> public static final ComplexType DIRECTPOSITIONTYPE_TYPE = >> build_DIRECTPOSITIONTYPE_TYPE(); >> >> private static ComplexType build_DIRECTPOSITIONTYPE_TYPE() { >> ComplexType builtType; >> List<PropertyDescriptor> schema = new >> ArrayList<PropertyDescriptor>(); >> schema.add( >> new AttributeDescriptorImpl( >> NCNAMELIST_TYPE, new >> NameImpl("http://www.opengis.net/gml","axisLabels"), 0, 1, true, null >> ) >> ); >> schema.add( >> new AttributeDescriptorImpl( >> XSSchema.POSITIVEINTEGER_TYPE, new >> NameImpl("http://www.opengis.net/gml","srsDimension"), 0, 1, true, >> null >> ) >> ); >> schema.add( >> new AttributeDescriptorImpl( >> XSSchema.ANYURI_TYPE, new >> NameImpl("http://www.opengis.net/gml","srsName"), 0, 1, true, null >> ) >> ); >> schema.add( >> new AttributeDescriptorImpl( >> NCNAMELIST_TYPE, new >> NameImpl("http://www.opengis.net/gml","uomLabels"), 0, 1, true, null >> ) >> ); >> builtType = new ComplexTypeImpl( >> new >> NameImpl("http://www.opengis.net/gml","DirectPositionType"), schema, >> false, >> false, Collections.<Filter>emptyList(), DOUBLELIST_TYPE, null >> ); >> return builtType; >> } >> >> That is, it's built as a complex type, and all complex types bind to >> Collection.class (that's inside the >> ComplexTypeImpl constructor). >> >> The change I'm tempted to perform is to make the direct position bound >> to a opengis DirectPosition >> instead. It would contain the ordinates and the crs, but not the other >> attributes... >> And then make a converter between Point and DirectPosition... the >> DirectPositionTypeBinding >> is actually already there and should work >> >> Thoughts? >> >> Cheers >> Andrea >> >> >> ----------------------------------------------------- >> Ing. Andrea Aime >> Senior Software Engineer >> >> GeoSolutions S.A.S. >> Via Poggio alle Viti 1187 >> 55054 Massarosa (LU) >> Italy >> >> phone: +39 0584962313 >> fax: +39 0584962313 >> >> http://www.geo-solutions.it >> http://geo-solutions.blogspot.com/ >> http://www.linkedin.com/in/andreaaime >> http://twitter.com/geowolf >> >> ----------------------------------------------------- >> >> ------------------------------------------------------------------------------ >> Virtualization is moving to the mainstream and overtaking non-virtualized >> environment for deploying applications. Does it make network security >> easier or more difficult to achieve? Read this whitepaper to separate the >> two and get a better understanding. >> http://p.sf.net/sfu/hp-phase2-d2d >> _______________________________________________ >> Geotools-devel mailing list >> [email protected]<mailto:[email protected]> >> https://lists.sourceforge.net/lists/listinfo/geotools-devel >> >> >> >> -- >> Justin Deoliveira >> OpenGeo - http://opengeo.org >> Enterprise support for open source geospatial. >> >> > > > -- > Ben Caradoc-Davies <[email protected]> > Software Engineering Team Leader > CSIRO Earth Science and Resource Engineering > Australian Resources Research Centre > > -- > Ben Caradoc-Davies <[email protected]> > Software Engineering Team Leader > CSIRO Earth Science and Resource Engineering > Australian Resources Research Centre > > -- ----------------------------------------------------- Ing. Andrea Aime Senior Software Engineer GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584962313 fax: +39 0584962313 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ----------------------------------------------------- ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
