wiki:HowToViewSpatialIndexUsingGeoServerWMS

Version 4 (modified by fxp, 15 years ago) ( diff )

--

Note: Warning: Using this, all metadata record's bounding box will be visible to all. Spatial index contains all metadata record and the WMS will not take care of filtering bounding box according to privileges.

How-to browse your GeoNetwork spatial index using WMS in GeoServer ?

Create a link between spatial index directory to GeoServer data directory

cd trunk/data/geoserver_data/data
ln -s ../../../web/geonetwork/WEB-INF/lucene/spatial/ spatialindex

Note: Here maybe there could be lock issue on the Shapefile if both GeoNetwork and GeoServer open the file (not tested). A better option could be to make a copy of the files on a regular basis.

Configure GeoServer to deploy the spatial index Shapefile

Datastore configuration

Define shapefile to use

Configure feature type

Really simple SLD style

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>Catalogue bounding box style</Name>
    <UserStyle>
      <Title>Catalogue</Title>
      <Abstract></Abstract>
      <FeatureTypeStyle>
        <Rule>
          <Title>Polygon</Title>
          <PolygonSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#000000</CssParameter>
              <CssParameter name="stroke-width">3</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>id</ogc:PropertyName>
            </Label>
            <Font>
              <CssParameter name="font-family">Times New Roman</CssParameter>
              <CssParameter name="font-style">Normal</CssParameter>
              <CssParameter name="font-size">14</CssParameter>
            </Font>
            <LabelPlacement>
              <PointPlacement>
                <AnchorPoint>
                  <AnchorPointX>0.5</AnchorPointX>
                  <AnchorPointY>0.5</AnchorPointY>
                </AnchorPoint>
              </PointPlacement>
            </LabelPlacement>
          </TextSymbolizer>
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Access the WMS using a WMS client (eg. OpenLayers, GoogleEarth)

OpenLayers

OpenLayers output

GoogleEarth

You could use GeoServer KML templating system in order to style your KML. On issue will be that only the metadata record ID (internal GeoNetwork identifier) is available.

Google Earth output

KML Demo template:

  • title
    Metadata: ${id.value}
    
  • description
    Metadata id: ${id.value}.
    <br/>
    <br>
    <a href="http://localhost:8080/geonetwork/srv/en/metadata.show?id=${id.value}">Metadata</a><br/>
    <a href="http://localhost:8080/geonetwork/srv/en/xml.metadata.get?id=${id.value}">Metadata (XML)</a>
    

Note: Here the privilege filter is applied by the catalogue.

Comments

  • Another option at least for KML output is to create a searcher which output KML (Done in geocat.ch sandbox on top of a CSW searcher).
  • In order to retrieve more information from the shapefile using Talend ETL could be an option to create a more complete shapefile with metadata title, change date, ...

See http://www.talendforge.org/wiki/doku.php?id=sdi:geonetworkmetadataextractfields

Attachments (5)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.