Stefano,

Thanks so much! This one works!

Wen


From: Stefano Costa [mailto:stefano.co...@geo-solutions.it]
Sent: Wednesday, September 16, 2015 2:14 PM
To: Yin, Wentao (IS) (Contr)
Cc: geoserver-users
Subject: Re: EXT :Re: [Geoserver-users] BBOX filter on chained features

Hi Wen,
did you try with the mapping configuration I attached to a previous e-mail?

In case you didn't get the mail because of the attachment, I'll copy-paste the 
relevant sections in the body of this mail.

gsml_GeologicUnit.xml:

        <FeatureTypeMapping>
            <sourceDataStore>datastore</sourceDataStore>
            <sourceType>gsml_GeologicUnit</sourceType>
            <targetElement>gsml:GeologicUnit</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>
                        gsml:GeologicUnit
                    </targetAttribute>
                    <idExpression>
                        <OCQL>ID</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gml:description
                      </targetAttribute>
                    <sourceExpression>
                        <OCQL>DESCRIPTION</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gml:name[1]
                      </targetAttribute>
                    <sourceExpression>
                        <OCQL>NAME</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>codeSpace</name>
                        
<value>'urn:x-test:classifierScheme:TestAuthority:GeologicUnitName'</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gml:name[2]
                      </targetAttribute>
                    <sourceExpression>
                        <OCQL>CODE</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>codeSpace</name>
                        
<value>'urn:x-test:classifierScheme:TestAuthority:GeologicUnitCode'</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gml:name[3]
                      </targetAttribute>
                    <sourceExpression>
                        <OCQL>URN</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>codeSpace</name>
                        
<value>'urn:x-test:classifierScheme:TestAuthority:GeologicUnitId'</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gsml:occurrence
                    </targetAttribute>
                    <sourceExpression>
                        <OCQL>URN</OCQL>
                        <linkElement>gsml:MappedFeature</linkElement>
                        <linkField>FEATURE_LINK</linkField>
                    </sourceExpression>
                    <isMultiple>true</isMultiple>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>

gsml_MappedFeature.xml:

        <FeatureTypeMapping>
            <sourceDataStore>datastore</sourceDataStore>
            <sourceType>gsml_MappedFeature</sourceType>
            <targetElement>gsml:MappedFeature</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>
                        gsml:MappedFeature
                    </targetAttribute>
                    <idExpression>
                        <OCQL>ID</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gml:name[1]
                      </targetAttribute>
                    <sourceExpression>
                        <OCQL>NAME</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gml:name[2]
                      </targetAttribute>
                    <sourceExpression>
                        <OCQL>GU_URN</OCQL>
                    </sourceExpression>
                </AttributeMapping>
          <AttributeMapping>
                    <targetAttribute>
                        FEATURE_LINK
                      </targetAttribute>
                    <sourceExpression>
                        <OCQL>GU_URN</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gsml:specification
                    </targetAttribute>
                    <ClientProperty>
                        <name>xlink:href</name>
                        <value>GU_URN</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gsml:shape
                      </targetAttribute>
                    <sourceExpression>
                        <OCQL>SHAPE</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    
<targetAttribute>gsml:observationMethod/gsml:CGI_TermValue/gsml:value</targetAttribute>
                    <sourceExpression>
                        <OCQL>'urn:ogc:def:nil:OGC:missing'</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>codeSpace</name>
                        <value>'urn:ietf:rfc:2141'</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>gsml:positionalAccuracy</targetAttribute>
                    
<targetAttributeNode>gsml:CGI_TermValuePropertyType</targetAttributeNode>
                </AttributeMapping>
                <AttributeMapping>
                    
<targetAttribute>gsml:positionalAccuracy/gsml:CGI_TermValue/gsml:value</targetAttribute>
                    <sourceExpression>
                        <OCQL>'urn:ogc:def:nil:OGC:missing'</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>codeSpace</name>
                        <value>'urn:ietf:rfc:2141'</value>
                    </ClientProperty>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>

What did the trick for me was to chain the two features using the special 
FEATURE_LINK attribute instead of gml:name (see highlighted sections).

I just tested the two requests below and they work for me:

WFS 2.0 with GML 3.1 output:

<?xml version="1.0" encoding="UTF-8"?>
<GetFeature service="WFS" version="2.0.0"
    outputFormat="gml3"
    xmlns="http://www.opengis.net/wfs/2.0";
    xmlns:gsml="urn:cgi:xmlns:CGI:GeoSciML:2.0"
    xmlns:gml="http://www.opengis.net/gml/3.2";
    xmlns:fes="http://www.opengis.net/fes/2.0";>
  <Query typeNames="gsml:GeologicUnit" >
    <fes:Filter>
      <fes:BBOX>
        
<fes:ValueReference>gsml:occurrence/gsml:MappedFeature/gsml:shape</fes:ValueReference>
     <gml:Envelope>
          <gml:lowerCorner>143.49 -39</gml:lowerCorner>-->
          <gml:upperCorner>143.50 -38</gml:upperCorner>-->
        </gml:Envelope>
      </fes:BBOX>
    </fes:Filter>
  </Query>
</GetFeature>

WFS 1.1:

<?xml version="1.0" encoding="utf-8"?>
<wfs:GetFeature service="WFS" version="1.1.0"
  xmlns:gsml="urn:cgi:xmlns:CGI:GeoSciML:2.0"
  xmlns:wfs="http://www.opengis.net/wfs";
  xmlns:ogc="http://www.opengis.net/ogc";
  xmlns:gml="http://www.opengis.net/gml";>
  <wfs:Query typeName="gsml:GeologicUnit">
    <ogc:Filter>
      <ogc:Intersects>
     
<ogc:PropertyName>gsml:occurrence/gsml:MappedFeature/gsml:shape</ogc:PropertyName>
     <gml:Envelope>
      <gml:lowerCorner>143.49 -39</gml:lowerCorner>
      <gml:upperCorner>143.50 -38</gml:upperCorner>
     </gml:Envelope>
      </ogc:Intersects>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

Hope this helps.

On Wed, Sep 16, 2015 at 7:38 PM, Yin, Wentao (IS) (Contr) 
<wentao....@ngc.com<mailto:wentao....@ngc.com>> wrote:
Stefano,

I tried geometry filters on nested features on both WFS1.1 and WFS2.0, no 
record returned. But it does return records if the filter is applied to  
MappedFeature directly.

Is there any working sample available?

Thanks,
Wen

---------------------------------
WFS 2.0

<?xml version="1.0" encoding="UTF-8"?>
<wfs:GetFeature service="WFS" version="2.0.0"  
xmlns:gsml="urn:cgi:xmlns:CGI:GeoSciML:2.0"
          xmlns:gml="http://www.opengis.net/gml/3.2";
    xmlns:wfs="http://www.opengis.net/wfs/2.0"; 
xmlns:fes="http://www.opengis.net/fes/2.0";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://www.opengis.net/gml/3.2 
http://schemas.opengis.net/gml/3.2.1/gml.xsd http://www.opengis.net/wfs/2.0

http://schemas.opengis.net/wfs/2.0/wfs.xsd";>

  <wfs:Query typeNames="gsml:GeologicUnit">
   <fes:Filter>

            <fes:BBOX>
            <fes:ValueReference>
                              
gsml:occurrence/gsml:MappedFeature/gsml:shape</fes:ValueReference>

                        <gml:Envelope>
                                <gml:lowerCorner>-100 -100</gml:lowerCorner>
                                <gml:upperCorner>3000 3000</gml:upperCorner>
                        </gml:Envelope>
           </fes:BBOX>

      </fes:Filter>
  </wfs:Query>
  </wfs:GetFeature>

-----------------------------
WFS 1.1

<wfs:GetFeature service="WFS" version="1.1.0"
  xmlns:gsml="urn:cgi:xmlns:CGI:GeoSciML:2.0"
  xmlns:wfs="http://www.opengis.net/wfs";
  xmlns:ogc="http://www.opengis.net/ogc";
  xmlns:gml="http://www.opengis.net/gml";>
  <wfs:Query typeName="gsml:GeologicUnit">
        <ogc:Filter>
                <ogc:Intersects>
                        
<ogc:PropertyName>gsml:occurrence/gsml:MappedFeature/gsml:shape</ogc:PropertyName>
                        <gml:Envelope>
                                <gml:lowerCorner>143.49 -39</gml:lowerCorner>
                                <gml:upperCorner>143.50 -38</gml:upperCorner>
                        </gml:Envelope>
                </ogc:Intersects>
        </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>



From: Stefano Costa 
[mailto:stefano.co...@geo-solutions.it<mailto:stefano.co...@geo-solutions.it>]
Sent: Monday, September 14, 2015 3:39 PM
To: Yin, Wentao (IS) (Contr)
Cc: geoserver-users
Subject: Re: EXT :Re: [Geoserver-users] BBOX filter on chained features

Hi Wen,
please stay on the ML.

Your mapping looks a bit strange (at least to me):

1) You're mapping a geometry (aixm:Surface) as a feature

2) You're mapping the horizontalProjection property as a multi-valued property 
(<isMultiple>true</isMultiple>), but it's not

3) I was expecting a foreign key column in the GPS table, pointing to the G 
table: where is it? Is it true that g.id<http://g.id> = gps.id<http://gps.id>, 
as your mapping suggests? So gps.id<http://gps.id> is both primary key of the 
gps table and foreing key referencing g.id<http://g.id>?

4) What type are the geometries stored in gps.longlat? The name of the column 
suggests you have points in there, but you're mapping it to a gml:LinearRing

5) This 
thread<http://osgeo-org.1560.x6.nabble.com/App-schema-How-to-map-Oracle-Geometry-into-GML-td4984781.html>
 seems to confirm my doubts about types extending the base GML types (e.g. 
aixm:SurfaceType, which extends gml:SurfaceType): GeoServer uses statically 
defined Java bindings for all geometry types, so it is not comfortable with 
user-defined geometry types


On Mon, Sep 14, 2015 at 2:46 PM, Yin, Wentao (IS) (Contr) 
<wentao....@ngc.com<mailto:wentao....@ngc.com>> wrote:
Thanks, Stefano,
I can do BBOX query on surface if I make it a feature, but always got the error 
when query on it as a nested feature.
 ….









--

Best regards,

Stefano Costa



==

GeoServer Professional Services from the experts! Visit

http://goo.gl/it488V for more information.

==

Dott. Stefano Costa

Senior Software Engineer



GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054  Massarosa (LU)

Italy

phone: +39 0584 962313

fax:     +39 0584 1660272



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.


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to