Skip to content

Commit

Permalink
fixed issue with geometrycollection and updated documentation with ex…
Browse files Browse the repository at this point in the history
…ample
  • Loading branch information
turingtestfail committed Jul 15, 2024
1 parent 050ee64 commit a0b652a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
29 changes: 27 additions & 2 deletions doc/en/user/source/extensions/mapml/template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ An example mapml-feature.ftl file to modify a point layer would look like::
</map-body>
</mapml->

This would result in a MapML feature output body that would resemble:
This would result in a MapML feature output body that would resemble::
<mapml- xmlns="http://www.w3.org/1999/xhtml"><map-head><map-title>Bridges</map-title><map-meta charset="UTF-8"/><map-meta content="text/mapml" http-equiv="Content-Type"/><map-meta name="extent" content="top-left-longitude=-180.000000,top-left-latitude=90.000000,bottom-right-longitude=180.000000,bottom-right-latitude=-90.000000"/><map-meta name="cs" content="gcrs"/><map-meta name="projection" content="MapML:urn:ogc:def:crs:EPSG::4326"/><map-style>.bbox {display:none} .Bridges-r1-s1{r:48.0; stroke-opacity:1.0; stroke-dashoffset:0; well-known-name:square; stroke-width:1.0; opacity:1.0; fill:#808080; fill-opacity:1.0; stroke:#000000; stroke-linecap:butt}</map-style></map-head><map-body><map-feature id="Bridges.1107531599613" class="Bridges-r1-s1"><map-geometry><map-point><map-coordinates><map-span class="desired">0.0007 0.0002</map-span></map-coordinates></map-point></map-geometry><map-properties><table xmlns="http://www.w3.org/1999/xhtml"><thead><tr><th role="columnheader" scope="col">Property name</th><th role="columnheader" scope="col">Property value</th></tr></thead><tbody><tr><th scope="row">FID</th><td itemprop="FID">110</td></tr><tr><th scope="row">UPDATED NAME</th><td itemprop="NAME">CHANGED Cam Bridge</td></tr></tbody></table></map-properties></map-feature></map-body></mapml->

Expand Down Expand Up @@ -286,4 +286,29 @@ A more complex example mapml-feature.ftl that operates on a multi-polygon layer
</#if>
</map-feature>
</map-body>
</mapml- >
</mapml- >

Templates can also be used to create MapML GeometryCollections that consist of multiple geometry types. For example, a template that creates a GeometryCollection that contains points and linestring representations of the NYC TIGER POI sample data would look like::

<mapml- xmlns="http://www.w3.org/1999/xhtml">
<map-head>
</map-head>
<map-body>
<map-feature>
<#list attributes as attribute>
<#if attribute.isGeometry>
<map-geometry>
<map-geometrycollection>
<map-linestring><map-coordinates><#list attribute.rawValue.coordinates as coord>${coord.x} ${coord.y}</#list></map-coordinates></map-linestring>
<map-point><map-coordinates><#list attribute.rawValue.coordinates as coord>${coord.x} ${coord.y}</#list></map-coordinates></map-point>
</map-geometrycollection>
</map-geometry>
</#if>
</#list>
</map-feature>
</map-body>
</mapml->

This would result in a MapML feature output body that would resemble::

<mapml- xmlns="http://www.w3.org/1999/xhtml"><map-head><map-title>poi</map-title><map-meta charset="UTF-8"/><map-meta content="text/mapml" http-equiv="Content-Type"/><map-meta name="extent" content="top-left-longitude=-74.011832,top-left-latitude=40.711946,bottom-right-longitude=-74.008573,bottom-right-latitude=40.707547"/><map-meta name="projection" content="WGS84"/><map-meta name="cs" content="gcrs"/><map-style>.bbox {display:none} .poi-r1-s1{r:88.0; well-known-name:circle; opacity:1.0; fill:#FF0000; fill-opacity:1.0} .poi-r1-s2{r:56.0; well-known-name:circle; opacity:1.0; fill:#FFFFFF; fill-opacity:1.0}</map-style></map-head><map-body><map-feature id="poi.4" class="poi-r1-s1 poi-r1-s2"><map-geometry><map-geometrycollection><map-linestring><map-coordinates>-74.00857344353 40.71194564907</map-coordinates></map-linestring><map-point><map-coordinates>-74.00857344353 40.71194564907</map-coordinates></map-point></map-geometrycollection></map-geometry><map-properties><table xmlns="http://www.w3.org/1999/xhtml"><thead><tr><th role="columnheader" scope="col">Property name</th><th role="columnheader" scope="col">Property value</th></tr></thead><tbody><tr><th scope="row">NAME</th><td itemprop="NAME">lox</td></tr><tr><th scope="row">THUMBNAIL</th><td itemprop="THUMBNAIL">pics/22037884-Ti.jpg</td></tr><tr><th scope="row">MAINPAGE</th><td itemprop="MAINPAGE">pics/22037884-L.jpg</td></tr></tbody></table></map-properties></map-feature></map-body></mapml->
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
public class GeometryCollection {

@XmlElements({
@XmlElement(name = "point", type = Point.class, namespace = "http://www.w3.org/1999/xhtml"),
@XmlElement(
name = "map-point",
type = Point.class,
namespace = "http://www.w3.org/1999/xhtml"),
@XmlElement(
name = "map-linestring",
type = LineString.class,
Expand Down

0 comments on commit a0b652a

Please sign in to comment.