This project is read-only.

WFS and WMS Service Configuration

The OGCServices\App_Data folder contains 4 configuration files. The WFSCapabilities.xml and WMSCapabilities.xml contain all the boiler plate XML for both services. The WFSConfiguration.xml contains a custom XML document holding settings for each layer that enable the services to connect to SQL Server and query the data. The WMSConfiguration.xml contains an OGC Web Map Context (WMC) XML document that describes the styles available for each layer. The layer Name element is used to tie all the configuration settings together for a layer.

WFS Configuration File Example

<?xml version="1.0" encoding="utf-8" ?>
<WFS_Configuration>
  <FeatureTypeList>
    <FeatureType>
      <Name>world_admin</Name>
      <TableName>world_admin</TableName>
      <GeometryColumn>shape</GeometryColumn>
      <FeatureIdColumn>fid</FeatureIdColumn>
      <ConnectionString>Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Projects\GeospatialServices\TestGeospatialServices\Input\Runtime\TestGeospatialServicesDatabase.mdf;Integrated Security=True;User Instance=True</ConnectionString>
    </FeatureType>
  </FeatureTypeList>
</WFS_Configuration>

GeoJSON Service Configuration

The Url parameters method and dataset identifes which 'service' to pass the GeoJSON request to;

method [spatialquery, buffer]
dataset [<dataset name as configured in web.config>]

For spatailquery methods, a SQL expression is declared within the web.config. Two special parameters call @wkt and @srid represent the well known text of the SqlGeometry and the spatial reference identifier. As the @wkt parameter passes a text string into the sql expression, the expression should use the STGeomFromText method.

SELECT count(*) as city_count, SUM(POP_1990) total_pop_1990, SUM(cast(POPULATION as float)) total_pop_2009 FROM us_cities where geom.STIntersects(Geometry::STGeomFromText(@wkt,@srid)) = 1 and WATCH_WARN = @WATCH_WARN

The GeoJSON object contains a geometry and parameters which are both optional. The parameters must match the @variables within the SQL expression. In the following example, the property WATCH_WARN is passed into the sql expression as @WATCH_WARN.

{"type":"FeatureCollection", "features":[{"type":"Feature", "geometry":{"type":"Polygon", "coordinates":[[[-88, 40], [-84, 40], [-84, 43], [-88, 40], [-88, 40]]]}, 
"properties":{"WATCH_WARN": 1}, "crs":{"type":"name", "properties":{"name":"epsg:4326"} } } ] } 

Dependencies

Unit tests depend on SQL Express 2008 being installed

Last edited Nov 27, 2009 at 6:51 AM by infitude, version 5

Comments

No comments yet.