Hello there,

now, I've managed to setup a community module project with Maven, created and Eclipse project, which I additionally linked to project 'gs-wfs', so I can make changes to the existing GeoJSON producer Andrea mentioned.

After linking my new project 'gs-compactjson' to project 'gs-web-app', I can start and debug my module from Eclipse. Really cool...

Currently the new CompactJSON module only adds to new outputFormats:

application/json; format=compact
text/javascript; format=compact

These formats are now listed in WFS GetCapabilities response. That all actually worked when I first start GeoServer with my new module from Eclipse.

In order to subclass GeoJSONGetFeatureResponse properly, some changes are required for this class. I've added a new protected constructor to be used by subclasses only. This additionally takes the value of the jsonp variable and the LOGGER of the subclass.

/**
  * Constructor to be used by subclasses.
  *
  * @param outputFormat The well-known name of the format, not
                        <code>null</code>
  * @param jsonp <code>true</code> if specified format uses JSONP
  * @param logger the logger created by the subclass
  */
protected GeoJSONGetFeatureResponse(GeoServer gs, String format,
  boolean jsonp, Logger logger) {
    super(gs, format);
    this.jsonp = jsonp;
    this.LOGGER = logger != null ? logger
       : org.geotools.util.logging.Logging.getLogger(this.getClass());
}

Also, I've changed the LOGGER variable from private to protected, in order to use it from the subclass.

Can you agree?

I will now start implementing the compact JSON format for Simple Features.

All my changes and the new project are in my local Git repository so later, I could create a CR (or two) with both the changes made to the GeoJSONGetFeatureResponse class and the new CompatJSON module.

Cheers
Carsten

On Tue, Sep 13, 2022 at 2:20 PM Andrea Aime wrote:
Agreed, it should start as a community module. Happy to review changes to make subclassing the existing GeoJSON producer easier. Or you can just copy and modify, if you like, to get prototyping moving on faster.

If you are interested in a ready made compact and efficient format instead, I suggest looking into flatgeobuf <https://github.com/flatgeobuf/flatgeobuf>, it already has a Javascript reader library and GeoServer has a community module to generate it as a WFS output format.

Cheers
Andrea

On Tue, Sep 13, 2022 at 1:54 PM Ian Turton <ijtur...@gmail.com <mailto:ijtur...@gmail.com>> wrote:

    Sorry hit send too soon!

    I would also prefer it if it was an extension rather than part of
    the core GeoServer.

    Ian


    On Tue, 13 Sept 2022 at 12:52, Ian Turton <ijtur...@gmail.com
    <mailto:ijtur...@gmail.com>> wrote:

        I would suggest calling it something other than GeoJSON since if
        it strays too far from the spec clients will become confused.

        Ian


_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to