[Geoserver-devel] Arcs support in GeoServer

Hi,
finally made it to make a patch for proper arc support in GeoServer:
https://github.com/aaime/geoserver

The user visible changes are that you get two new elements in the GUI to configure the curves:

  1. a flag that the admin will use to indicate wether the linework can contain also circular arcs

  2. a linearization tolerance, as a measure (e.g., you can specifiy 2m or 3ft)

  3. is kind of obvious, 1) is the byproduct of GeoServer using GML3 deprecated types for single
    and multiple lines, LineStringType and MultiLineStringType, which cannot contain curves.
    The issue happens in the FeatureTypeSchemaBuilder, where we basically force the properties
    to be LineString or MultiLineString without knowing if they will contain curves, or not.

The issue is, from the software we cannot know if there will be curves, we’d have to make a full scan of all the data
every time we build those schemas, as lines are just lines, the fact that they might contain circular
segments is a detail that the data source will not give you, because there is not line layer
that is made purely of curves, they are always mixed with straight ones.

So… in order to maintain backwards compatibility in WFS 1.1 output, I had to ask the admin to tell
me whether there will be curves, and in that case, we switch from LineString to Curve, from
MultiLineString to MultiCurve, without affecting the current 99% case, where curves are not present.
GML 3.2 output is instead unaffected, because it uses Curve and MultiCurve for everything already.

The way the switch is done is a bit hacky, basically the feature type is transformed, for the sole
sake of computing the GML schema, so that it uses CurveGeometry as the binding for the
data (as said, it does not make sense to do that in general, as we can also get LineString
in the data mix, plus, CurveGeometry is an interface, thus it cannot be a Geometry, which
is instead a class).

Basically, I’ve tried to keep this new curve support as much out of the way as possible from
the normal usage, while still making it possible to support curves for those that have them.

Feedback welcomed

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Good stuff Andrea.

For a while in GeoServer 1.x we allowed users to “override” attribute types (allowing them to publish a string as a date for example). In the current UI the Feature Type Details are a static list.

Still this would be a good place provide a "curve"checkbox (or curve/line drop down) along with the tolerance.

···

Jody Garnett

On Thu, Jul 17, 2014 at 11:23 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

Hi,
finally made it to make a patch for proper arc support in GeoServer:
https://github.com/aaime/geoserver

The user visible changes are that you get two new elements in the GUI to configure the curves:

  1. a flag that the admin will use to indicate wether the linework can contain also circular arcs

  2. a linearization tolerance, as a measure (e.g., you can specifiy 2m or 3ft)

  3. is kind of obvious, 1) is the byproduct of GeoServer using GML3 deprecated types for single
    and multiple lines, LineStringType and MultiLineStringType, which cannot contain curves.
    The issue happens in the FeatureTypeSchemaBuilder, where we basically force the properties
    to be LineString or MultiLineString without knowing if they will contain curves, or not.

The issue is, from the software we cannot know if there will be curves, we’d have to make a full scan of all the data
every time we build those schemas, as lines are just lines, the fact that they might contain circular
segments is a detail that the data source will not give you, because there is not line layer
that is made purely of curves, they are always mixed with straight ones.

So… in order to maintain backwards compatibility in WFS 1.1 output, I had to ask the admin to tell
me whether there will be curves, and in that case, we switch from LineString to Curve, from
MultiLineString to MultiCurve, without affecting the current 99% case, where curves are not present.
GML 3.2 output is instead unaffected, because it uses Curve and MultiCurve for everything already.

The way the switch is done is a bit hacky, basically the feature type is transformed, for the sole
sake of computing the GML schema, so that it uses CurveGeometry as the binding for the
data (as said, it does not make sense to do that in general, as we can also get LineString
in the data mix, plus, CurveGeometry is an interface, thus it cannot be a Geometry, which
is instead a class).

Basically, I’ve tried to keep this new curve support as much out of the way as possible from
the normal usage, while still making it possible to support curves for those that have them.

Feedback welcomed

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it



Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world’s largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds


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

I expect your patch is actually: https://github.com/aaime/geoserver/commits/arcs2

···

Jody Garnett

On Thu, Jul 17, 2014 at 11:23 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

Hi,
finally made it to make a patch for proper arc support in GeoServer:
https://github.com/aaime/geoserver

The user visible changes are that you get two new elements in the GUI to configure the curves:

  1. a flag that the admin will use to indicate wether the linework can contain also circular arcs

  2. a linearization tolerance, as a measure (e.g., you can specifiy 2m or 3ft)

  3. is kind of obvious, 1) is the byproduct of GeoServer using GML3 deprecated types for single
    and multiple lines, LineStringType and MultiLineStringType, which cannot contain curves.
    The issue happens in the FeatureTypeSchemaBuilder, where we basically force the properties
    to be LineString or MultiLineString without knowing if they will contain curves, or not.

The issue is, from the software we cannot know if there will be curves, we’d have to make a full scan of all the data
every time we build those schemas, as lines are just lines, the fact that they might contain circular
segments is a detail that the data source will not give you, because there is not line layer
that is made purely of curves, they are always mixed with straight ones.

So… in order to maintain backwards compatibility in WFS 1.1 output, I had to ask the admin to tell
me whether there will be curves, and in that case, we switch from LineString to Curve, from
MultiLineString to MultiCurve, without affecting the current 99% case, where curves are not present.
GML 3.2 output is instead unaffected, because it uses Curve and MultiCurve for everything already.

The way the switch is done is a bit hacky, basically the feature type is transformed, for the sole
sake of computing the GML schema, so that it uses CurveGeometry as the binding for the
data (as said, it does not make sense to do that in general, as we can also get LineString
in the data mix, plus, CurveGeometry is an interface, thus it cannot be a Geometry, which
is instead a class).

Basically, I’ve tried to keep this new curve support as much out of the way as possible from
the normal usage, while still making it possible to support curves for those that have them.

Feedback welcomed

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it



Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world’s largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds


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

n Thu, Jul 17, 2014 at 9:11 PM, Jody Garnett <jody.garnett@anonymised.com> wrote:

Good stuff Andrea.

For a while in GeoServer 1.x we allowed users to "override" attribute
types (allowing them to publish a string as a date for example). In the
current UI the Feature Type Details are a static list.

It does not matter. We simply miss in JTS superclass that could be the
parent of LineString, CircularString, CompoundString and the equivalent
rings.
Thus, it's impossible to describe the concept of "linear, connected
geometry" (aka Curve) that would be needed to represent the data sets
containing
circular args.

Still this would be a good place provide a "curve"checkbox (or curve/line
drop down) along with the tolerance.

Yes, that's what I did in the pull request

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

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

Did we ever get a GSIP for this curve work? I went looking for something to link to from the release announcement and could not find anything.

I also could not find the documentation in the docs: http://docs.geoserver.org/latest/en/user/webadmin/data/layers.html#layer-types

···

Jody Garnett

On Thu, Jul 17, 2014 at 11:23 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

Hi,
finally made it to make a patch for proper arc support in GeoServer:
https://github.com/aaime/geoserver

The user visible changes are that you get two new elements in the GUI to configure the curves:

  1. a flag that the admin will use to indicate wether the linework can contain also circular arcs

  2. a linearization tolerance, as a measure (e.g., you can specifiy 2m or 3ft)

  3. is kind of obvious, 1) is the byproduct of GeoServer using GML3 deprecated types for single
    and multiple lines, LineStringType and MultiLineStringType, which cannot contain curves.
    The issue happens in the FeatureTypeSchemaBuilder, where we basically force the properties
    to be LineString or MultiLineString without knowing if they will contain curves, or not.

The issue is, from the software we cannot know if there will be curves, we’d have to make a full scan of all the data
every time we build those schemas, as lines are just lines, the fact that they might contain circular
segments is a detail that the data source will not give you, because there is not line layer
that is made purely of curves, they are always mixed with straight ones.

So… in order to maintain backwards compatibility in WFS 1.1 output, I had to ask the admin to tell
me whether there will be curves, and in that case, we switch from LineString to Curve, from
MultiLineString to MultiCurve, without affecting the current 99% case, where curves are not present.
GML 3.2 output is instead unaffected, because it uses Curve and MultiCurve for everything already.

The way the switch is done is a bit hacky, basically the feature type is transformed, for the sole
sake of computing the GML schema, so that it uses CurveGeometry as the binding for the
data (as said, it does not make sense to do that in general, as we can also get LineString
in the data mix, plus, CurveGeometry is an interface, thus it cannot be a Geometry, which
is instead a class).

Basically, I’ve tried to keep this new curve support as much out of the way as possible from
the normal usage, while still making it possible to support curves for those that have them.

Feedback welcomed

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it



Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world’s largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds


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

On Thu, Jul 24, 2014 at 11:56 PM, Jody Garnett <jody.garnett@anonymised.com>
wrote:

Did we ever get a GSIP for this curve work? I went looking for something
to link to from the release announcement and could not find anything.

No, there was no GSIP, the changes to GeoServer were trivial (at least
compared to the ones in GeoTools) and
did not really add curve geometry support, they just added ways to control
it.

I also could not find the documentation in the docs:
http://docs.geoserver.org/latest/en/user/webadmin/data/layers.html#layer-types

Right, my bad, forgot about it. Just added them right above the feature
type configuration.
I did not modify the layer types because curved geometries do not make for
a new layer type, nor they make
for a new geometry type for what it's worth, because there is no such a
thing as a layer that only has curved
geometries inside, the 99% case is that you have polygons whose rings are
occasionally compound curves, made of a mix
of curved and straight segmetns, and linestrings that occasionally (but now
always) are compound curves
or CircularStrings.
As a result, there can be no notion of a "curved geometry layer", we have
the regular polygon and line ones,
with some eventual "surprises" in their contents.

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

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

Thanks Andrea I will update the blog post to link to that doc page.

···

On Thu, Jul 24, 2014 at 11:56 PM, Jody Garnett <jody.garnett@anonymised.com> wrote:

Did we ever get a GSIP for this curve work? I went looking for something to link to from the release announcement and could not find anything.

No, there was no GSIP, the changes to GeoServer were trivial (at least compared to the ones in GeoTools) and
did not really add curve geometry support, they just added ways to control it.

I also could not find the documentation in the docs: http://docs.geoserver.org/latest/en/user/webadmin/data/layers.html#layer-types

Right, my bad, forgot about it. Just added them right above the feature type configuration.
I did not modify the layer types because curved geometries do not make for a new layer type, nor they make
for a new geometry type for what it’s worth, because there is no such a thing as a layer that only has curved
geometries inside, the 99% case is that you have polygons whose rings are occasionally compound curves, made of a mix
of curved and straight segmetns, and linestrings that occasionally (but now always) are compound curves
or CircularStrings.
As a result, there can be no notion of a “curved geometry layer”, we have the regular polygon and line ones,
with some eventual “surprises” in their contents.

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it