Hi Andrea,

Thanks for your thoughts and background information. After some testing, I can confirm that Array Type columns from the PostGIS data source are handled as expected (geoserver 2.21.1). But it wasn't clear to me from the documentation that this is only possible when directly feature templating a layer of a PostGIS data source. Just to sum up the present capabilities:

 * Layer based on PostGIS datastore: Array Type data are handled
   correctly by Feature Templating, no access to related tables
 * Layer based on App Schema datastore: Related tables can be accessed
   by Feature Templating, but Array Type data are not handled (error)

Let's see how this develops. Thanks again Nuno & Andrea for answering my questions.

Best, Henning


On 2022-09-13 09:38, Andrea Aime wrote:
Hi,
array support is working properly in the context of the STAC API usage of features templating, which in turn uses a customized data store producing, among others, properties of type array, and then feature templates are applied
to generate STAC Items.
This is on the main branch, although some level of support is available on 2.21.x too (don't remember exactly what got backported and what did not).

In your case, what are you doing? Using features templating directly against a PostGIS data source, to customize the output of a WFS or OGC API Features? I don't think we ever tried that, it may work, or not.

In terms of getting it to work, you'll have to find either programming time or a bag of money, or wait for someone else to stumble into the same problem, and act on it. If you want to investigate the code on your side and have questions, please ask on the list, always happy to get another developer up to speed (within reason of course, all the activity on this list is volunteer based).

Cheers
Andrea


On Tue, Sep 13, 2022 at 8:55 AM Henning Lorenz <henning.lor...@geo.uu.se> wrote:

    Hi Nuno,

    Thinking about your reply, I can't bring it in line with the
    documentation and my observations, because I don't create array
    attributes with App Schema:

      * A column with Array Type is defined in PostgreSQL, i.e. the
        database query returns an array to Geoserver
      * The Feature Templating documentation that I linked earlier
        clearly refers to Array Type in databases (i.e. the situation
        in my case, if I do not completely misunderstand)
      * Feature Templating produces a "[Ljava.lang.String;@..."
        <mailto:[Ljava.lang.String;@...> error
      * My web searches suggest that a "[Ljava.lang.String;@..."
        <mailto:[Ljava.lang.String;@...> error indicates that an array
        is passed to a function that expects string only, which
        suggests that App Schema correctly passes on the Array Type
        data to Feature Templating, but Feature templating doesn't
        understand it in contradiction to the documentation.

    A first step would be to decide whether I am unable to interpret
    the documentation correctly. Then to think what resources are
    needed for full array support and how to get them (I'd like to
    have a bag of money for this, but I don't ...).

    Best wishes,

    Henning


    On 2022-09-13 00:11, Nuno Oliveira wrote:
    Hi Henning,
    that's a good point, if my memory serves me well, if an array
    reaches features-templating it will work as described (this is
    used for some advanced integrations with features-templating),
    but I don't think that App-Schema and Smart Data Loader can
    produce array attributes.

    So summarizing:

      * Features-templating support arrays,
      * but you cannot produce array attributes with App-Schema or
        Smart Data Loader,
      * hence you can't use arrays unless you create them
        programmatically.

    @Marco Volpini <mailto:marco.volp...@geosolutionsgroup.com> did I
    miss something?

    Kind regards,
    Nuno Oliveira




    On Fri, Sep 9, 2022 at 12:27 PM Henning Lorenz
    <henning.lor...@geo.uu.se> wrote:

        Dear Nuno,

        Thanks for the quick reply. However, for the Feature
        Templating plugin, it contradicts the documentation where
        Array Type support for json output is explicitly mentioned:
        
https://docs.geoserver.org/stable/en/user/community/features-templating/directives.html#array-based-properties-json-based-templates-only

        Is the documentation wrong and needs to be updated?

        Best wishes,

        Henning


        On 2022-09-09 11:42, Nuno Oliveira wrote:
        Dear Henning,
        those modules do not support array column types, this would
        be a nice feature to have.

        A pull request contributing it would be very welcomed, you
        may also want to check the GeoServer Support
        <https://geoserver.org/support/> in case you want to fund it.

        Kind regards,
        Nuno Oliveira

        On Fri, Sep 9, 2022 at 10:13 AM Henning Lorenz
        <henning.lor...@geo.uu.se> wrote:

            geoserver 2.21, app schema/smart data loader/ogc
            api/feature templating plugins (Tomcat 9 on Ubuntu
            22.04; openjdk 11.0.16)

            Hello,

            I appreciate any help on the following two (related?)
            problems (further explained below):

             1. The "Smart Data Loader" plugin fails in case Array
                Type is present in one of the tables (error unknown
                data type)
             2. The "Feature Templating" plugin does not handle data
                from columns with Array Type correctly
                ("[Ljava.lang.String;@..."
                <mailto:[Ljava.lang.String;@...>)

            Of particular importance to me is to solve problem 2, as
            this directly affects geoserver output.

            Many thanks in advance,

            Henning

            -----

            Problem 1:

              * I create two tables, one without and one without a
                column of Array Type (called here "noarray_table"
                and "array_table"; only for explanation instead of
                my more complex setup):

                        CREATE TABLE test.noarray_table (
                            id SERIAL PRIMARY KEY,
                            geometry geometry(point, 4326),
                            attribute1 varchar,
                            attribute2 varchar
                        );

                        CREATE TABLE test.array_table (
                            id SERIAL PRIMARY KEY,
                            geometry geometry(point, 4326),
                            attribute1 varchar,
                            attribute2 varchar[]
                        );

              * After adding some data, I create a PostGIS data
                store for database that contains the tables.
              * When this is done, I add a new data store and select
                "Smart Data Loader".
                  o When I select the noarray_table as root entity,
                    I get the expected preview and can add the data
                    store.
                  o However, when I select the array_table, I get an
                    error message over the entire page. As far as I
                    can tell, the critical line is "Caused by:
                    java.lang.RuntimeException: Attribute type
                    '_varchar' is unknown.". _varchar is the same as
                    varchar[] as far as I can tell.

            Is this a bug or does Smart Data Loader not support
            Array Types ("missing feature")?


            Problem 2:

            The Feature Templating plugin explicitly supports Array
            Types
            (see
            
https://docs.geoserver.org/stable/en/user/community/features-templating/directives.html#array-based-properties-json-based-templates-only)

              * With the Smart Data Loader, I create an app schema
                mapping and schema of tables without Array Type
              * I configure feature templating and I get valid output.
              * However, one of the columns should actually be of
                array type. Thus, I replace this varchar-column by a
                varchar[]-column, including type casting of the
                content.
                  o According to the documentation, I expect that
                    the Array Type of the column is recognised by
                    the plugin and the data are expanded accordingly.
                  o However, I see "[Ljava.lang.String;@..."
                    <mailto:[Ljava.lang.String;@...> instead of
                    data. According to what I could find out, this
                    indicates the presence of array data where no
                    array data are expected.

            This leaves two options:

            A) It is not sufficient to just change the Data Type in
            the database, something in the configuration has to be
            changed as well (App Schema mapping file, schema -
            although Array Type is not supported for XML according
            to the documentation, which would suggest that this is
            not the case).

            B) The Feature Templating plugin doesn't work as
            expected, i.e. it's a bug.










            När du har kontakt med oss på Uppsala universitet med
            e-post så innebär det att vi behandlar dina
            personuppgifter. För att läsa mer om hur vi gör det kan
            du läsa här:
            http://www.uu.se/om-uu/dataskydd-personuppgifter/

            E-mailing Uppsala University means that we will process
            your personal data. For more information on how this is
            performed, please read here:
            http://www.uu.se/en/about-uu/data-protection-policy
            _______________________________________________
            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

            If you want to request a feature or an improvement, also
            see this:
            
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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



--
        Regards,

        Nuno Oliveira

        ==GeoServer Professional Services from the experts!

        Visit http://bit.ly/gs-services-us
        <http://bit.ly/gs-services-us>for more information.==Nuno
        Miguel Carvalho Oliveira@nmcoliveiraTechnical Lead / Project
        Manager

        GeoSolutions Groupphone: +39 0584 962313fax:      +39 0584
        1660272https://www.geosolutionsgroup.com/
        <https://www.geosolutionsgroup.com/>http://twitter.com/geosolutions_it
        
<http://twitter.com/geosolutions_it>-------------------------------------------------------

        Con riferimento alla normativa sul trattamento dei dati
        personali (Reg. UE 2016/679 - Regolamento generale sulla
        protezione dei dati “GDPR”), si precisa che ogni circostanza
        inerente alla presente email (il suo contenuto, gli
        eventuali allegati, etc.) è un dato la cui conoscenza è
        riservata al/i solo/i destinatario/i indicati dallo
        scrivente. Se il messaggio Le è giunto per errore, è
        tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
        sarei comunque grato se potesse darmene notizia.This email
        is intended only for the person or entity to which it is
        addressed and may contain information that is privileged,
        confidential or otherwise protected from disclosure. We
        remind that - as provided by European Regulation 2016/679
        “GDPR” - copying, dissemination or use of this e-mail or the
        information herein by anyone other than the intended
        recipient is prohibited. If you have received this email by
        mistake, please notify us immediately by telephone or e-mail.

-- Henning Lorenz
        The Swedish Scientific Drilling Program (www.ssdp.se  
<http://www.ssdp.se>), scientific coordinator
        EPOS-Sweden (Swedish participation in EPOS-ERIC;www.epos-se.se  
<http://www.epos-se.se>), infrastructure manager
Uppsala University
        Department of Earth Sciences
        Villavägen 16
        752 36 Uppsala
        Sweden
        mobile: +46 (0) 701 679 320
        e-mail:henning.lor...@geo.uu.se
GnuPG-key:
        http://pgp.mit.edu:11371/pks/lookup?search=0x484D3AF03B32FD38&op=index  
<http://pgp.mit.edu:11371/pks/lookup?search=0x484D3AF03B32FD38&op=index>

        _______________________________________________
        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

        If you want to request a feature or an improvement, also see
        this:
        
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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



--
    Regards,

    Nuno Oliveira

    ==GeoServer Professional Services from the experts!

    Visit http://bit.ly/gs-services-us
    <http://bit.ly/gs-services-us>for more information.==Nuno Miguel
    Carvalho Oliveira@nmcoliveiraTechnical Lead / Project Manager

    GeoSolutions Groupphone: +39 0584 962313fax:      +39 0584
    1660272https://www.geosolutionsgroup.com/
    <https://www.geosolutionsgroup.com/>http://twitter.com/geosolutions_it
    
<http://twitter.com/geosolutions_it>-------------------------------------------------------

    Con riferimento alla normativa sul trattamento dei dati personali
    (Reg. UE 2016/679 - Regolamento generale sulla protezione dei
    dati “GDPR”), si precisa che ogni circostanza inerente alla
    presente email (il suo contenuto, gli eventuali allegati, etc.) è
    un dato la cui conoscenza è riservata al/i solo/i destinatario/i
    indicati dallo scrivente. Se il messaggio Le è giunto per errore,
    è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
    sarei comunque grato se potesse darmene notizia.This email is
    intended only for the person or entity to which it is addressed
    and may contain information that is privileged, confidential or
    otherwise protected from disclosure. We remind that - as provided
    by European Regulation 2016/679 “GDPR” - copying, dissemination
    or use of this e-mail or the information herein by anyone other
    than the intended recipient is prohibited. If you have received
    this email by mistake, please notify us immediately by telephone
    or e-mail.

-- Henning Lorenz
    The Swedish Scientific Drilling Program (www.ssdp.se  
<http://www.ssdp.se>), scientific coordinator
    EPOS-Sweden (Swedish participation in EPOS-ERIC;www.epos-se.se  
<http://www.epos-se.se>), infrastructure manager
Uppsala University
    Department of Earth Sciences
    Villavägen 16
    752 36 Uppsala
    Sweden
    mobile: +46 (0) 701 679 320
    e-mail:henning.lor...@geo.uu.se
GnuPG-key:
    http://pgp.mit.edu:11371/pks/lookup?search=0x484D3AF03B32FD38&op=index  
<http://pgp.mit.edu:11371/pks/lookup?search=0x484D3AF03B32FD38&op=index>

    _______________________________________________
    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

    If you want to request a feature or an improvement, also see this:
    
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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



--

Regards,

Andrea Aime

==GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us <http://bit.ly/gs-services-us>for more information.==Ing. Andrea Aime @geowolfTechnical Lead

GeoSolutions Groupphone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  339 8844549


https://www.geosolutionsgroup.com/ <https://www.geosolutionsgroup.com/>

http://twitter.com/geosolutions_it <http://twitter.com/geosolutions_it>

-------------------------------------------------------


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail

--
Henning Lorenz
The Swedish Scientific Drilling Program (www.ssdp.se), scientific coordinator
EPOS-Sweden (Swedish participation in EPOS-ERIC;www.epos-se.se), infrastructure 
manager
Uppsala University
Department of Earth Sciences
Villavägen 16
752 36 Uppsala
Sweden
mobile: +46 (0) 701 679 320
e-mail:henning.lor...@geo.uu.se
GnuPG-key:
http://pgp.mit.edu:11371/pks/lookup?search=0x484D3AF03B32FD38&op=index
_______________________________________________
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

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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

Reply via email to