Hi, i tried to check gml, and also checked the link you posted, but without any success.
I attached files which i use, logs for the post calls and the results for various outputFormat.
Would you be so nice and check the files, where exactly i should set the right gml? Or is it there some other problem?
Thanks a lot,
Tomas
 
 
Sent: Thursday, November 23, 2017 at 12:00 AM
From: "Ben Caradoc-Davies" <b...@transient.nz>
To: "Tomas L." <ges...@email.com>
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Mapping PostGis geometry to app schema
Tomas,

please check that you are using the same GML version everywhere in your
schema, your mapping, and that your WFS output format produces the same
GML version.

Mismatches between GML versions can cause strange problems in encoded
output because GeoServer will make a "best effort" attempt to encode
Java objects to XML even when they do not make sense. For example, if
you have a GML 3.1.1 application schema and request WFS 2.0 output with
the default output format (GML 3.2.1), some elements may be missing
because the geometry types for GML 3.1.1 and GML 3.2.1 are in different
namespaces and the encoder configuration for GML 3.2.1 lacks bindings
for GML 3.1.1 objects. GeoServer tries hard and encodes things like
xs:string that are present in both but cannot encode types with no
binding. It never makes sense to mix GML versions. See:
http://docs.geoserver.org/latest/en/user/data/app-schema/supported-gml-versions.html

What is the GML version of your application schema and mapping? (I guess
3.1.1 because of your use of _Feature).

What WFS version did you use to make the failing request? Use WFS 1.1.0
(which defaults to GML 3.1.1 output) or WFS 2.0.0 with outputFormat=GML3
to obtain GML 3.1.1 output.

Kind regards,
Ben.

On 22/11/17 21:31, Tomas L. wrote:
> Hi, im so sorry, but everything enclosed in tag <raw></raw> disappeared :-(
> @Ben Caradoc-Davies: Simple feature works correctly, postgis column is lowercase
> ('singlegeom'), but view is 'camel'.
> In geometry_column i can see:
> "f_table_name" = geoCoordinateWithSrid
> "f_geometry_column" = singlegeom
> "coord_dimension" = 2
> "srid" = 3857
> "type" = POINT
> Here is content of files, which was not visible in my first mail:
> schema.xsd:
> <xs:element name="AddressCoordinate" type="ct:AddressCoordinateType"
> substitutionGroup="gml:_Feature" />
> <xs:complexType name="AddressCoordinateType">
> <xs:complexContent>
> <xs:extension base="gml:AbstractFeatureType">
> <xs:sequence>
> <xs:element name="AddressId" type="xs:string" />
> <xs:element name="Geom" type="gml:PointPropertyType"
> maxOccurs="1" minOccurs="0" nillable="true" />
> <!--<xs:element name="Geom" type="gml:MultiPointPropertyType"
> maxOccurs="1" minOccurs="0" nillable="true" />-->
> <!--<xs:element name="Geom" type="gml:GeometryPropertyType"
> maxOccurs="1" minOccurs="0" nillable="true" />-->
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> App schema mapping is defined as:
> <targetTypes>
> <FeatureType>
> <schemaUri>source.xsd</schemaUri>
> </FeatureType>
> </targetTypes>
> <typeMappings>
> <FeatureTypeMapping>
> <sourceDataStore>datastore</sourceDataStore>
> <sourceType>geoCoordinateWithSrid</sourceType>
> <targetElement>ct:AddressCoordinate</targetElement>
> <attributeMappings>
> <AttributeMapping>
> <targetAttribute>ct:AddressId</targetAttribute>
> <sourceExpression>
> <OCQL>AddressId</OCQL>
> </sourceExpression>
> <encodeIfEmpty>true</encodeIfEmpty>
> </AttributeMapping>
> <AttributeMapping>
> <targetAttribute>ct:Geom</targetAttribute>
> <sourceExpression>
> <OCQL>singlegeom</OCQL>
> </sourceExpression>
> <encodeIfEmpty>true</encodeIfEmpty>
> </AttributeMapping>
> </attributeMappings>
> </FeatureTypeMapping>
> </typeMappings>
> But when a call WFS service, there is empty Geom element in the result:
> <ct:AddressCoordinate gml:id="geoCoordinateWithSrid.fid-1919b616_15fe079d669_-7ff9">
> <ct:AddressId>f0e307f0-2e76-4172-8f20-a6e70c99943b</ct:AddressId>
> <ct:Geom/>
> </ct:AddressCoordinate>
> Thanks a lot,
> Tomas
> *Sent:* Wednesday, November 22, 2017 at 2:39 AM
> *From:* "Ben Caradoc-Davies" <b...@transient.nz>
> *To:* geseus <ges...@email.com>, geoserver-users@lists.sourceforge.net
> *Subject:* Re: [Geoserver-users] Mapping PostGis geometry to app schema
> Tomas,
>
> I see no mapping or database schema in your email (no images or text).
>
> postgis geometry types are supported in app-schema the same as for
> simple features.
>
> Your postgis column name must be lowercase in the app-schema mapping file.
> http://docs.geoserver.org/latest/en/user/data/app-schema/mapping-file.html#database-identifiers
>
> Are you able to publish the source view as a GeoTools simple feature
> type? Did you remember to register the column type in geometry_columns
> in the postgis database?
> http://docs.geoserver.org/latest/en/user/data/database/postgis.html#publishing-a-postgis-view
>
> Kind regards,
> Ben.
>
> On 22/11/17 10:45, geseus wrote:
> > Hi,
> > is it possible to use geometry type from PostGis in app schema?
> >
> > I have view in postgre db:
> >
> >
> > Then i have schema:
> >
> >
> >
> > App schema mapping is defined as:
> >
> >
> >
> > But when a call WFS service, there is empty Geom element in the result:
> >
> >
> > So, how can i map postGis geometry type to element in app schema?
> >
> > Thanks a lot,
> > Tomas
> >
> >
> >
> >
> >
> > --
> > Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html
> >
> > ------------------------------------------------------------------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > 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
> >
> > Geoserver-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/geoserver-users
> >
>
> --
> Ben Caradoc-Davies <b...@transient.nz>
> Director
> Transient Software Limited <http://transient.nz/>
> New Zealand
>

--
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

Attachment: csv_log.log
Description: Binary data

Attachment: ct_addressCoordinate.xml
Description: XML document

Attachment: datastore.xml
Description: XML document

Attachment: featuretype.xml
Description: XML document

Attachment: gml2_log.log
Description: Binary data

Attachment: gml3_log.log
Description: Binary data

Attachment: layer.xml
Description: XML document

Attachment: post_request.xml
Description: XML document

outputFormat="GML2":
<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
                     xmlns:ows="http://www.opengis.net/ows"; 
                                         
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
                                         version="1.0.0" 
                                         
xsi:schemaLocation="http://www.opengis.net/ows 
http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd";>
    <ows:Exception exceptionCode="NoApplicableCode">
        <ows:ExceptionText>java.lang.ClassCastException: 
org.geotools.feature.type.ComplexFeatureTypeImpl cannot be cast to 
org.opengis.feature.simple.SimpleFeatureType 
org.geotools.feature.type.ComplexFeatureTypeImpl cannot be cast to 
org.opengis.feature.simple.SimpleFeatureType</ows:ExceptionText>
    </ows:Exception>
</ows:ExceptionReport>

outputFormat="GML3":
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"; 
                       xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
                                           xmlns:ct="http://geoserver.org/ct"; 
                                           
xmlns:gml="http://www.opengis.net/gml"; 
                                           
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
                                           numberOfFeatures="2" 
                                           timeStamp="2017-11-23T13:24:50.065Z" 
                                           
xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd http://geoserver.org/ct 
file:/c:/GeoServer/2.11.2/data_dir/workspaces/ct/ct_addressCoordinate/source.xsd">
    <gml:boundedBy>
        <gml:Envelope srsDimension="2" 
srsName="http://www.opengis.net/gml/srs/epsg.xml#3857";>
            <gml:lowerCorner>60.169026 24.9391928</gml:lowerCorner>
            <gml:upperCorner>60.169817 24.940212</gml:upperCorner>
        </gml:Envelope>
    </gml:boundedBy>
    <gml:featureMember>
        <ct:AddressCoordinate 
gml:id="geoCoordinateWithSrid.fid--2be2a4e_15fe83b67bc_-7ff0">
            <ct:AddressId>f0e307f0-2e76-4172-8f20-a6e70c99943b</ct:AddressId>
            <ct:Geom/>
        </ct:AddressCoordinate>
    </gml:featureMember>
    <gml:featureMember>
        <ct:AddressCoordinate 
gml:id="geoCoordinateWithSrid.fid--2be2a4e_15fe83b67bc_-7fef">
            <ct:AddressId>f0e307f0-2e76-4172-8f20-a6e70c99943b</ct:AddressId>
            <ct:Geom/>
        </ct:AddressCoordinate>
    </gml:featureMember>
</wfs:FeatureCollection>

outputFormat="JSON":
<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:ows="http://www.opengis.net/ows"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0.0" 
xsi:schemaLocation="http://www.opengis.net/ows 
http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd";>
    <ows:Exception exceptionCode="NoApplicableCode">
        <ows:ExceptionText>java.lang.ClassCastException: 
org.geotools.feature.FeatureImpl cannot be cast to 
org.opengis.feature.simple.SimpleFeature
org.geotools.feature.FeatureImpl cannot be cast to 
org.opengis.feature.simple.SimpleFeature</ows:ExceptionText>
    </ows:Exception>
</ows:ExceptionReport>

outputFormat="CSV":
gml:id,ct:AddressId,ct:Geom
geoCoordinateWithSrid.fid--2be2a4e_15fe83b67bc_-7fed,f0e307f0-2e76-4172-8f20-a6e70c99943b,POINT
 (60.169026 24.940212)
geoCoordinateWithSrid.fid--2be2a4e_15fe83b67bc_-7fec,f0e307f0-2e76-4172-8f20-a6e70c99943b,POINT
 (60.169817 24.9391928)

Attachment: source.xsd
Description: XML document

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to