Opened 14 years ago

Closed 13 years ago

#3500 closed enhancement (fixed)

Add a shpkml macro that outputs shape geometry in kml 2.2

Reported by: mraross Owned by: assefa
Priority: normal Milestone: 6.0 release
Component: Output-KML Version: unspecified
Severity: normal Keywords: kml
Cc:

Description

Add a shpkml macro that returns the feature's shape as a valid KML Geometry element (e.g., Point, LineString, Polygon, Multigeometry). This will enable the use of getFeatureInfo to generate linestring and polygon placemarks with full control over the KML. Parameters are proj and precision (as per shpxy), extrude (0 or 1) and tessellate (0 or 1).

Here’s an example of a template snippet that will generate a multigeometry placemark containing a point and a polygon for each selected feature in a map layer :

[resultset layer=DBM_7H_MIL_PARK_POLY1]

<Folder>

<name>Parks</name> [feature trimlast=','] <Placemark>

<name>[ENGLISH_NAME]</name> <Snippet/> <description>

<![CDATA[

<p>Year Established: [YEAR_ESTABLISHED]</p> <p>Area: [AREA_KILOMETERS_SQUARED] sq km</p>

]]>

</description> <styleUrl>#parks_map</styleUrl> <MultiGeometry>

<Point>

<coordinates> [shplabel proj=epsg:4326 precision=10] </coordinates>

</Point> [shpkml tessellate=1 proj=epsg:4326 precision=10]

</MultiGeometry>

</Placemark> feature

</Folder>

resultset

Change History (5)

comment:1 by mraross, 14 years ago

shpkml should output x,y,z coordinates if the data source has them; x,y,0 otherwise.

comment:2 by assefa, 13 years ago

I am not sure here why sphxy would not be enough to achieve this. Is it possible to include a example of the final kml that needs to be produced?

comment:3 by mraross, 13 years ago

I can't figure out how to generate a kml <geometry> element for a polygon with holes using shpxy. I could only generate a kml <geometry> element for a polygon without holes as follows:

[resultset layer=DBM_7H_MIL_PARK_POLY1]

<Folder>

<name>Parks as Polygon Placemarks</name> [feature trimlast=','] <Placemark>

<name>[ENGLISH_NAME]</name> <Snippet/> <description>

<![CDATA[

<p>Year Established: [YEAR_ESTABLISHED]</p> <p>Area: [AREA_KILOMETERS_SQUARED] sq km</p>

]]>

</description> <styleUrl>#parks_map</styleUrl> <MultiGeometry>

<Point> <coordinates> [shplabel proj=epsg:4326 precision=10] </coordinates></Point>

<Polygon>

<tessellate>1</tessellate> <outerBoundaryIs>

<LinearRing>

<coordinates>

[shpxy xf="," xh=" " yh=" " yf=",0 " proj=epsg:4326 precision=10]

</coordinates>

</LinearRing>

</outerBoundaryIs>

</Polygon>

</Placemark> feature

</Folder>

resultset

What I couldn't figure out is how to generate inner boundaries using shpxy given that the current shape may not have one, and the syntax for inner boundaries is different than that for outer boundaries. Perhaps an extension to shpxy is possible where you can specify the format of the outer boundary separate from the format of the inner boundaries?

comment:5 by chodgson, 13 years ago

Resolution: fixed
Status: newclosed

The fix to #3606 completely resolves this issue. Closing.

Note: See TracTickets for help on using tickets.