geotrellis / geotrellis-server

Tools for building raster processing and display services
Apache License 2.0
73 stars 24 forks source link

WMS GetFeatureInfo #358

Closed pomadchin closed 3 years ago

pomadchin commented 3 years ago

Overview

This PR adds WMS GetFeatureInfo endpoint implementation and adjusts WMS GetCapabilities to follow the spec more precisely.

Checklist

Demo

JSON (QGIS uses it)

Query:

http://localhost:9000/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&
BBOX=1.15698072385719541,-131.89698230287206115,73.46267114083812544,-62.00819518673727515&
CRS=EPSG:4326&
WIDTH=694&HEIGHT=718&
LAYERS=NLCD%202011&STYLES=red-to-blue&
FORMAT=image/png&
QUERY_LAYERS=NLCD%202011&
INFO_FORMAT=application/json&
I=332&J=326

Query output:

{
  "type":"FeatureCollection",
  "features":[
    {
      "type":"Feature",
      "geometry":{
        "type":"Point",
        "coordinates":[
          -98.41280115573257,
          40.58271581891017
        ]
      },
      "bbox":[
        -98.41280115573257,
        40.58271581891017,
        -98.41280115573257,
        40.58271581891017
      ],
      "properties":{
        "band-0-pixel-value":22
      }
    }
  ]
}

XML (WFS)

Query:

http://localhost:9000/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&
BBOX=1.15698072385719541,-131.89698230287206115,73.46267114083812544,-62.00819518673727515&
CRS=EPSG:4326&
WIDTH=694&HEIGHT=718&
LAYERS=NLCD%202011&STYLES=red-to-blue&
FORMAT=image/png&
QUERY_LAYERS=NLCD%202011&
INFO_FORMAT=text/xml&
I=332&J=326

Query output:

<FeatureCollection xmlns="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <gml:featureMember>
      <Geometry>
         <gml:MultiPolygon srsName="urn:ogc:def:crs:EPSG::4326">
            <gml:polygonMember>
               <gml:Polygon>
                  <gml:exterior>
                     <gml:LinearRing>
                        <gml:Coordinates>-98.51350545993449,40.48201151470824 -98.31209685153064,40.48201151470824 -98.31209685153064,40.68342012311209 -98.51350545993449,40.68342012311209 -98.51350545993449,40.48201151470824</gml:Coordinates>
                     </gml:LinearRing>
                  </gml:exterior>
               </gml:Polygon>
            </gml:polygonMember>
         </gml:MultiPolygon>
      </Geometry>
      <band-0-pixel-value>22.0</band-0-pixel-value>
   </gml:featureMember>
</FeatureCollection>

QGIS Demo

image

Closes #321 Closes #332