[Geoserver-users] Additional WMS GetFeatureInfo questions

Hi Mathew,

  Here is a simple xslt:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform&quot;
    xmlns:wfs="http://www.opengis.net/wfs&quot;
    xmlns:gml="http://www.opengis.net/gml&quot;
    xmlns:geo="http://www.web-demographics.com/geo&quot;

version="1.0">
<xsl:template match="/">
<html>
<body bgcolor="#C8C8C8">
  <h2>ID:
<xsl:value-of
select="wfs:FeatureCollection/gml:featureMember/geo:state/@fid" />
</h2>
  <table border="1">
    <tr bgcolor="#808080">
    <th>State</th>
    <th>State FIPS</th>
  </tr>
  <tr>
    <td>
    <xsl:value-of
select="wfs:FeatureCollection/gml:featureMember/geo:state/geo:name"/>
    </td>
    <td>
    <xsl:value-of
select="wfs:FeatureCollection/gml:featureMember/geo:state/geo:STATE"/>
    </td>
  </tr>
  </table>
  </body>
  </html>
  </xsl:template>
</xsl:stylesheet>

Using this GetFeature request:
<wfs:GetFeature service="WFS" version="1.0.0"
  outputFormat="GML2"
  xmlns:topp="http://www.openplans.org/geo&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
  <wfs:Query typeName="geo:state">
    <ogc:Filter>
       <ogc:FeatureId fid="166"/>
    </ogc:Filter>
    </wfs:Query>
</wfs:GetFeature>

Resulting in this GML:

  <?xml version="1.0" encoding="UTF-8" ?>
- <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:geo="http://www.web-demographics.com/geo&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.web-demographics.com/geo
http://localhost:80/geoserver/wfs/DescribeFeatureType?typeName=geo:state
http://www.opengis.net/wfs
http://localhost:80/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
- <gml:boundedBy>
- <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4269&quot;&gt;
  <gml:coordinates xmlns:gml="http://www.opengis.net/gml&quot; decimal="." cs=","
ts="">-109.06025696,36.99242401 -102.04151917,41.00344467</gml:coordinates>
  </gml:Box>
  </gml:boundedBy>
- <gml:featureMember>
- <geo:state fid="state.166">
  <geo:AREA>28.0391981205100</geo:AREA>
  <geo:PERIMETER>22.0191923313779</geo:PERIMETER>
  <geo:ST99_D00_>167</geo:ST99_D00_>
  <geo:ST99_D00_I>166</geo:ST99_D00_I>
  <geo:STATE>08</geo:STATE>
  <geo:name>Colorado</geo:name>
  <geo:LSAD>01</geo:LSAD>
  <geo:REGION>4</geo:REGION>
  <geo:DIVISION>8</geo:DIVISION>
- <geo:the_geom>
- <gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4269&quot;&gt;
- <gml:polygonMember>
+ <gml:Polygon>
- <gml:outerBoundaryIs>
- <gml:LinearRing>
  <gml:coordinates xmlns:gml="http://www.opengis.net/gml&quot; decimal="." cs=","
ts="">-107.918421,41.002036 -107.69133582,41.00210425 -107.625624,41.002124
        .
        .
-107.59463771,41.0022379 -107.573624,41.00231514 -107.52150536,41.00250671 -
108.046539,41.002064 -107.92323412,41.00203705
-107.918421,41.002036</gml:coordinates>
  </gml:LinearRing>
  </gml:outerBoundaryIs>
  </gml:Polygon>
  </gml:polygonMember>
  </gml:MultiPolygon>
  </geo:the_geom>
  </geo:state>
  </gml:featureMember>
  </wfs:FeatureCollection>

Here is what it looks like:
http://www.cadmaps.com/GetFeature_sample.htm

Randy

-----Original Message-----
From: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net] On Behalf Of Matthew
Perry
Sent: Friday, June 16, 2006 1:51 AM
To: Javier de la Torre
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Additional WMS GetFeatureInfo questions

Javier,

  Based on what you and Chris Holmes have said, yes, I am defintely
going the WFS GetFeature route.

My plan is to write an AJAX interface that will route the WFS request
through a jsp page which will also serve as a proxy for external WFS
requests. I'll transform it to html server-side and send it back to
the browser.

  Still, coming from a long history with mapserver, I am frustrated at
the amount of work it takes to simply query the data. With mapserver,
the concept of query templates are key, allowing you to create custom
html layouts that are populated by query results from the vector
attribute tables. It literally takes 3 minutes to accomplish.
Customizing my javascript to do a WFS request and transforming the GML
into HTML is a cumbersome process but apparently quite necessary.

As I am quite new to XSLT, does anyone have an example of transforming
WFS/GML into a tabular HTML layout?

- matt

On 6/16/06, Javier de la Torre <jatorre@anonymised.com> wrote:

Have you considered using WFS? I am using WMS to present the layers
and WFS to get the details when the user click. With WFS you will be
able to:

-Set the buffer, tolerance of the click by units of measurement.
-Get the data in XML and trasnform it to any other format like HTML.
-Decide how many features you want to get when the user click and
there are several features behind a point. You can decide to get them
all, to get only one, etc...
-Decide the data, properties, that you want the server to return to you.

--
Matt Perry
perrygeo@anonymised.com
http://www.perrygeo.net

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

Randy,

Thanks for the example. It was exactly what I needed to get going.

matt

On 6/16/06, Randy George <rkgeorge@anonymised.com> wrote:

Hi Mathew,

        Here is a simple xslt:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform&quot;
                xmlns:wfs="http://www.opengis.net/wfs&quot;
                xmlns:gml="http://www.opengis.net/gml&quot;
                xmlns:geo="http://www.web-demographics.com/geo&quot;

version="1.0">
<xsl:template match="/">
<html>
<body bgcolor="#C8C8C8">
  <h2>ID:
<xsl:value-of
select="wfs:FeatureCollection/gml:featureMember/geo:state/@fid" />
</h2>
  <table border="1">
        <tr bgcolor="#808080">
                <th>State</th>
                <th>State FIPS</th>
        </tr>
        <tr>
                <td>
                <xsl:value-of
select="wfs:FeatureCollection/gml:featureMember/geo:state/geo:name"/>
                </td>
                <td>
                <xsl:value-of
select="wfs:FeatureCollection/gml:featureMember/geo:state/geo:STATE"/>
                </td>
        </tr>
  </table>
  </body>
  </html>
  </xsl:template>
</xsl:stylesheet>

Using this GetFeature request:
<wfs:GetFeature service="WFS" version="1.0.0"
  outputFormat="GML2"
  xmlns:topp="http://www.openplans.org/geo&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
  <wfs:Query typeName="geo:state">
    <ogc:Filter>
       <ogc:FeatureId fid="166"/>
    </ogc:Filter>
    </wfs:Query>
</wfs:GetFeature>

Resulting in this GML:

  <?xml version="1.0" encoding="UTF-8" ?>
- <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:geo="http://www.web-demographics.com/geo&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.web-demographics.com/geo
http://localhost:80/geoserver/wfs/DescribeFeatureType?typeName=geo:state
http://www.opengis.net/wfs
http://localhost:80/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
- <gml:boundedBy>
- <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4269&quot;&gt;
  <gml:coordinates xmlns:gml="http://www.opengis.net/gml&quot; decimal="." cs=","
ts="">-109.06025696,36.99242401 -102.04151917,41.00344467</gml:coordinates>
  </gml:Box>
  </gml:boundedBy>
- <gml:featureMember>
- <geo:state fid="state.166">
  <geo:AREA>28.0391981205100</geo:AREA>
  <geo:PERIMETER>22.0191923313779</geo:PERIMETER>
  <geo:ST99_D00_>167</geo:ST99_D00_>
  <geo:ST99_D00_I>166</geo:ST99_D00_I>
  <geo:STATE>08</geo:STATE>
  <geo:name>Colorado</geo:name>
  <geo:LSAD>01</geo:LSAD>
  <geo:REGION>4</geo:REGION>
  <geo:DIVISION>8</geo:DIVISION>
- <geo:the_geom>
- <gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4269&quot;&gt;
- <gml:polygonMember>
+ <gml:Polygon>
- <gml:outerBoundaryIs>
- <gml:LinearRing>
  <gml:coordinates xmlns:gml="http://www.opengis.net/gml&quot; decimal="." cs=","
ts="">-107.918421,41.002036 -107.69133582,41.00210425 -107.625624,41.002124
                                .
-107.59463771,41.0022379 -107.573624,41.00231514 -107.52150536,41.00250671 -
108.046539,41.002064 -107.92323412,41.00203705
-107.918421,41.002036</gml:coordinates>
  </gml:LinearRing>
  </gml:outerBoundaryIs>
  </gml:Polygon>
  </gml:polygonMember>
  </gml:MultiPolygon>
  </geo:the_geom>
  </geo:state>
  </gml:featureMember>
  </wfs:FeatureCollection>

Here is what it looks like:
http://www.cadmaps.com/GetFeature_sample.htm

Randy

-----Original Message-----
From: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net] On Behalf Of Matthew
Perry
Sent: Friday, June 16, 2006 1:51 AM
To: Javier de la Torre
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Additional WMS GetFeatureInfo questions

Javier,

  Based on what you and Chris Holmes have said, yes, I am defintely
going the WFS GetFeature route.

My plan is to write an AJAX interface that will route the WFS request
through a jsp page which will also serve as a proxy for external WFS
requests. I'll transform it to html server-side and send it back to
the browser.

  Still, coming from a long history with mapserver, I am frustrated at
the amount of work it takes to simply query the data. With mapserver,
the concept of query templates are key, allowing you to create custom
html layouts that are populated by query results from the vector
attribute tables. It literally takes 3 minutes to accomplish.
Customizing my javascript to do a WFS request and transforming the GML
into HTML is a cumbersome process but apparently quite necessary.

As I am quite new to XSLT, does anyone have an example of transforming
WFS/GML into a tabular HTML layout?

- matt

On 6/16/06, Javier de la Torre <jatorre@anonymised.com> wrote:
> Have you considered using WFS? I am using WMS to present the layers
> and WFS to get the details when the user click. With WFS you will be
> able to:
>
> -Set the buffer, tolerance of the click by units of measurement.
> -Get the data in XML and trasnform it to any other format like HTML.
> -Decide how many features you want to get when the user click and
> there are several features behind a point. You can decide to get them
> all, to get only one, etc...
> -Decide the data, properties, that you want the server to return to you.
>

--
Matt Perry
perrygeo@anonymised.com
http://www.perrygeo.net

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

--
Matt Perry
perrygeo@anonymised.com
http://www.perrygeo.net