Tomas,
your schema is invalid because it does not import a GML schema and might
be confusing the app-schema feature type builder, which needs a valid
schema to determine your GML version and build the types. Do you get any
app-schema complaints at startup time?
Your commented GML import lacks the require "xs:" namespace prefix.
Please uncomment it and change it to:
<xs:import namespace="http://www.opengis.net/gml"
schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
In case you have uncovered a WFS 1.0.0 bug, please also try making WFS
1.1.0 requests like:
http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=ct:AddressCoordinate
I could not see anything else wrong.
GML2 will always fail for app-schema types. GeoJSON support for
app-schema types was added in 2.12-beta and will be in 2.11.4:
https://osgeo-org.atlassian.net/browse/GEOS-8068
Kind regards,
Ben.
On 24/11/17 03:08, Tomas L. wrote:
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
--
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <http://transient.nz/>
New Zealand
------------------------------------------------------------------------------
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