Revision 3124
Added by perry almost 18 years ago
spatial_option.html | ||
---|---|---|
16 | 16 |
<HEAD> |
17 | 17 |
<TITLE>Metacat Spatial Option</TITLE> |
18 | 18 |
<link rel="stylesheet" type="text/css" href="./default.css"> |
19 |
<style> |
|
20 |
h5 { margin-left: 12px; } |
|
21 |
</style> |
|
19 | 22 |
</HEAD> |
20 | 23 |
<BODY> |
21 | 24 |
<table width="100%"> |
... | ... | |
161 | 164 |
<p dir="ltr" style="text-align:left;margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> There is one very important note about document authentication. While metacat provides very fine-grained permissions control at the document level, the Web Mapping Server component does not. For this reason, only documents that are publicly readable (i.e. documents which match the following SQL query : </span><span style="font-size:9pt;font-family:'Courier New'" lang="en-US">select distinct docid from xml_access where principal_name = 'public' and perm_type = 'allow')</span><span lang="en-US">will be added to the spatial cache. </span><span lang="en-US">In the Future Directions section of this document, the potential for adding feature-level permissions to the WMS server are discussed.</span></p> |
162 | 165 |
|
163 | 166 |
|
164 |
<h5> <a name="wms"> Web Mapping Service </a> </h5>
|
|
167 |
<h5> <a name="wms"> Web Mapping Server </a> </h5>
|
|
165 | 168 |
|
166 | 169 |
|
167 |
|
|
168 |
|
|
169 | 170 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> The primary function of the Web Mapping Server component is to render the spatial cache as a web-deliverable map image. It is also responsible for rendering other geographic data to provide base maps or other auxillary map layers.</span></p> |
170 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> The OpenGIS consortium has defined a standard for requesting maps, the Web Mapping Service or WMS standard. WMS servers accept a common set of parameters via http, render the spatial dataset into an appropriate image and deliver it back to the client. For Metacat, we chose to go with GeoServer, a WMS-capable application written in Java. </span></p> |
|
171 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Integration with Metacat Context</span></p> |
|
172 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Configuration</span></p> |
|
173 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Web Interface</span></p> |
|
174 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Supports many vector data formats</span></p> |
|
175 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Outputs Images (mainly) but can be used to output GML and KML.</span></p> |
|
176 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Known issues (rasters, startup procedure, difficult for novice to configure, maven build, size)</span></p> |
|
177 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"></p> |
|
171 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> The OpenGIS consortium has defined a standard for requesting maps, the Web Mapping Service or WMS standard. WMS servers accept a common set of parameters via http, render the spatial dataset into an appropriate image and deliver it back to the client. </p> |
|
172 |
<p> For Metacat, we chose to go with GeoServer, a WMS-capable application written in Java. Geoserver (and the Geotools library upon which it depends) are seamlessly integrated into the metacat servlet context. This allows all of the Geoserver/Geotools functionality to be accessible to all of metacat and allows easier deployment than if it were distributed seperately. The downside to this approach is that upgrading geoserver later becomes slightly more complicated.</span></p> |
|
173 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Geoserver comes with a default configuration that is already aware of the spatial cache and a world countries base layer. In order to configure existing data and add new data sources, geoserver comes with an web-based configuration utility. It is available at http://your.server/context/geoserver.jsp </span></p> |
|
174 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Geoserver has lots of built in functionality and can support a wide variety of vector GIS data sources. These data sources can be styled using SLDs and can be made available via open distribution standards such as WMS and WFS. For our purposes, it mainly outputs Images (via WMS) but can be used to output raw vector data in the form of GML or KML.</span></p> |
|
175 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> There are several issues with geoserver tha users should be aware of. The version of Geoserver (1.4) used by Metacat does not support raster input dataset (ie satellite imagery or digital elevation models). For distributing rasters, we recommend UMN Mapserver be set up independently. Geoserver, though it offers a web configuration interface, is lacking in several key areas and you may still have to hand-edit some XML files in order to customize your WMS server. </span></p> |
|
178 | 176 |
|
179 | 177 |
|
180 | 178 |
|
... | ... | |
197 | 195 |
|
198 | 196 |
|
199 | 197 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> In order to provide a web-based user interface to the WMS and the spatial query functionality, Metacat relies on Community Mapbuilder. Mapbuilder is a pure HTML/javascript application which uses AJAX and XSLT on the client side to create a desktop-GIS-like environment for interacting with geographic data through a web browser.</span></p> |
200 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Consumes WMS services, defined through WMC</span></p> |
|
201 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Map interface components (map, box zooms, layer list, "select location" dropdown, scalebar, coordinates, info query)</span></p> |
|
202 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Widget Architecture, Metacat config files, html divs</span></p> |
|
203 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> AOIMetacat Query</span></p> |
|
204 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Integration with skins</span></p> |
|
198 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> The main function of mabuilder is to act as a front-end to WMS services. The WMS layers are configured through a Web Map Context document (typically found in the skin directory under spatial/context.xml). This context document (or WMC) can define the initial extent of the map, the ordering and visibility of layers and, of course, the source and name of the WMS layer.</span></p> |
|
199 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> Mapbuilder provides several interface components or widgets (map, box zooms, layer list, "select location" dropdown, scalebar, coordinates, info query) that make it easy to deploy highly-functional web mapping applications with minimal coding. There are three main configuration files you need to work with in order to customize the map interface: The context document discussed above, the mapbuilder configuration file (typically under spatial/config.xml) which defined the widgets and their behavior and finally the html file (typically spatial/map.html) which loads the mapbuilder javascript library and places the widgets in your html layout.</span></p> |
|
200 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> For integration with metacat, we built a custom mapbuilder widget, the AOIMetacat Query, which allows you to click query the map, either by box or point, and call the metacat spatial_query action. </span></p> |
|
201 |
<p style="margin-bottom:12pt;margin-left:0pt;text-indent:0in"><span lang="en-US"> The cleanest way to integrate a mapbuilder interactive map with any page in your application is to simply create an iframe element with the src pointing to a standalone map.html. </span></p> |
|
205 | 202 |
|
206 | 203 |
|
207 | 204 |
|
... | ... | |
209 | 206 |
|
210 | 207 |
<h4> <a name="install">Installing and Configuring the Spatial Option</a> </h4> |
211 | 208 |
|
212 |
<p style="margin-bottom:12pt"><span lang="en-US">When first installing a version of metacat with the spatial option, you'll want to ensure that </span><span style="font-style:italic" lang="en-US">install.spatial</span><span lang="en-US"> is </span><span style="font-style:italic" lang="en-US">true</span><span lang="en-US"> in build.properties. You'll also want to ensure that </span><span style="font-style:italic" lang="en-US">runSpatialOption </span><span lang="en-US">is </span><span style="font-style:italic" lang="en-US">true</span><span lang="en-US"> in metacat.properties. Both of these values are the default so, unless you explicitly set them to be false, the spatial option should install and run automatically.</span></p> |
|
209 |
<h5> Initial Installation </h5> |
|
210 |
<p style="margin-bottom:12pt"><span lang="en-US">To install the spatial option, choose a version of metacat >= 1.7.0. You'll want to ensure that </span><span style="font-style:italic" lang="en-US">runSpatialOption</span><span lang="en-US"> is set to </span><em>true</em><span lang="en-US"> in lib/metacat.properties before you build. Running the spatial option is <em> true </em> by default so, unless you explicitly set it to be false, the spatial option will install and run automatically when you install metacat.</span></p> |
|
213 | 211 |
|
214 |
<p style="margin-bottom:12pt">How do I configure the layout of the html mapping interface?</p>
|
|
215 |
|
|
216 |
<p style="margin-bottom:12pt"> How can I change the lat/long display to degree-minutes-seconds ? </p>
|
|
212 |
<h5>How do I configure the layout of the html mapping interface?</h5>
|
|
213 |
The layout of the map components is defined in the spatial/map.html file within the skin's directory. It is a simple tabular layout and the map components are abstracted into "widgets", blocks with a specific id, which can be reorganized within the table. For deeper customization you can modify the web map context document (spatial/context.xml) and the mapbuilder config file (spatial/config.xml). |
|
214 |
<h5> How can I change the lat/long display to degree-minutes-seconds ? </h5>
|
|
217 | 215 |
By default, the map display shows the cursors position in decimal degrees since this is the prefered format for many GPS/GIS applications. However, there may be cases where you need to report coordinates as degrees minutes-seconds. To do so, go into you skins spatial configuration file (usually ${skin.dir}/spatial/config.xml) and edit the CursorTrack widget as shown below: |
218 | 216 |
<pre> |
219 | 217 |
<CursorTrack id="cursorTrack"> |
... | ... | |
223 | 221 |
</CursorTrack> |
224 | 222 |
</pre> |
225 | 223 |
|
226 |
<p style="margin-bottom:12pt">How can I configure the initial extent of the map?</p> |
|
227 |
<p style="margin-bottom:12pt">How do I configure the "select location" dropdown to contain different predefined locations?</p> |
|
228 |
<p dir="ltr" style="text-align:left;margin-bottom:12pt;margin-top:0.0000in;margin-right:0.0000in">Can I use a different web mapping interface?</span></p> |
|
229 |
<p dir="ltr" style="text-align:left;margin-bottom:12pt;margin-top:0.0000in;margin-right:0.0000in">How do I configure the styling and classification of the data?</p> |
|
230 |
<p style="margin-bottom:12pt">How can I upgrade/change the version of geoserver?</p> |
|
231 |
<p style="margin-bottom:12pt">What versions of tomcat are supported?</p> |
|
232 |
<p style="margin-bottom:12pt">The spatial functionality has only been tested on tomcat 5. </p> |
|
233 |
<p style="margin-bottom:12pt">How do I add the map to another page or metacat skin?</p> |
|
224 |
<h5>How can I configure the size and initial extent of the map?</h5> |
|
225 |
The map's initial extent is defined in the web map context document for each skin. To change the map size and/or initial extent, edit the following lines: |
|
226 |
<pre> |
|
227 |
<Window width="720" height="360" /> |
|
228 |
<BoundingBox SRS="EPSG:4326" minx="-180" miny="-90" maxx="180" maxy="90" /> |
|
229 |
</pre> |
|
230 |
Where the width and height are the image size in pixels and the minx/maxx represent the range of longitudes and miny/maxy reprsent the range of latitudes. |
|
234 | 231 |
|
232 |
<h5>How do I configure the "select location" dropdown to contain different predefined locations?</h5> |
|
233 |
The locations data are held in a file called "named_locations.xml" in your skin's spatial directory. This defines each location as a gml:featureMember. Within each featureMember, you can edit the gml:name and gml:coordinates fields to edit or add new locations. |
|
234 |
|
|
235 |
<h5>Can I use a different web mapping interface?</span></h5> |
|
236 |
<p>Certainly. Since our mapping server conforms to the WMS standard, you can develop a map interface using any WMS client application. There are many of WMS clients ranging from desktop GIS applications (ArcGIS, QGIS, JUMP, UDig) to javascript web mapping frameworks (openlayers, mapbender, mapbuilder) and anyone of them could be used to build a novel spatial application from the metacat wms.</p> |
|
237 |
<p> There is an experimental version of OpenLayers (a tiled, google-maps-esque web interface) included with Metacat spatial. This can be accessed at http://your.server/context/style/common/spatial_templates/openlayers1/map.html. Keep in mind that this is experimental and not supported as an official interface. |
|
238 |
|
|
239 |
<h5>How do I configure the styling and classification of the data?</h5> |
|
240 |
|
|
241 |
The datasets are styled through the use of Styled Layer Descriptors (SLD). The default SLDs used for the data points and data bounding boxes are in {context}/data/styles and named <em> data_points_style.sld </em> and <em> data_bounds_style.sld </em> respectively. |
|
242 |
You can find more a more detailed tutorial on using SLD with geoserver at : <a href="http://docs.codehaus.org/display/GEOSDOC/SLD+Intro+Tutorial"> http://docs.codehaus.org/display/GEOSDOC/SLD+Intro+Tutorial</a>. |
|
243 |
|
|
244 |
<h5>What versions of tomcat are supported?</h5> |
|
245 |
|
|
246 |
<p>The spatial functionality has only been tested on tomcat 5. The web.xml.tomcat4 distributed with metacat is no longer supported after Metacat 1.6.0 . If you <em>need</em> to use tomcat 4, you might be able to update this file to reflect the incorporation of geoserver (see web.xml.tomcat5) though we have no intention of supporting it's use.</p> |
|
247 |
|
|
248 |
<h5>How do I add the map to another page or metacat skin?</h5> |
|
249 |
|
|
250 |
The map interface is held in a seperate html document and can be easily included in any html page through the use of an iframe : |
|
251 |
<pre> |
|
252 |
<iframe scrolling="no" frameborder="0" width="736" height="520" |
|
253 |
src="/knb/style/common/spatial_templates/spatial1/map.html"> |
|
254 |
</iframe> |
|
255 |
</pre> |
|
256 |
The map URL referenced here is the default, common spatial template for use in any skin. If you plan on doing any customization of the map interface, you should copy that spatial template into your skin's directory: |
|
257 |
<pre> |
|
258 |
cp -r style/common/spatial_templates/spatial1 style/skins/myskin/spatial |
|
259 |
</pre> |
|
260 |
and access it with the url "/knb/style/skins/myskin/spatial/map.html". |
|
235 | 261 |
|
236 | 262 |
|
237 | 263 |
<h4> <a name="adding_data">Adding Other Spatial Datasets to the Web Map</a> </h4> |
238 | 264 |
|
239 |
<h5> Adding your own spatial datasets </h5> |
|
240 |
<h5> External WMS data sources </h5> |
|
241 |
<h5> Spatial datasets already registered with metacat </h5> |
|
242 |
<h5> Raster Images </h5> |
|
265 |
<h5> Adding your own spatial datasets </h5> |
|
266 |
If you have other vector GIS datasets on your server that you'd like to include in the interactive map, there are two main tasks:<ul> |
|
267 |
<li> Registering the dataset with geoserver </li> <li> Adding the layer to the web map context </li> </ul> |
|
243 | 268 |
|
269 |
<h6> Registering your dataset with geoserver </h6> |
|
270 |
There is a <a href="http://docs.codehaus.org/display/GEOSDOC/User+Tutorial+Shapefile"> geoserver tutorial </a> which covers the precise steps of adding a new layer via the web interface. The actual process will differ slightly depending on your configuration so we'll clarify and summarize the steps below: |
|
271 |
<ol> |
|
272 |
<li>Creating a datastore (ie registering the raw data)</li> |
|
273 |
<ul> |
|
274 |
<li> Point your browser to http://your.server/context/geoserver.jsp, login and navigate to the "data stores" config page.</li> |
|
275 |
<li> Define your new shapefile datastore and point to the shp file on the filesystem (relative to {tomcat.dir}/webapps/{context}/ ). </li> |
|
276 |
<li> Use the "metacat" namespace to describe your data </li> |
|
277 |
</ul> |
|
278 |
<li> Creating the feature type (ie registering the data as a recognizable layer)</li> |
|
279 |
<ul> |
|
280 |
<li> You must define a spatial reference system number for each layer. Most lat/long data is "4326". If your data is in another projection, you'll have to determine its SRS using the help links provided. </li> |
|
281 |
<li> The dropdown list of styles provides some good default choices but to get more control over the styling, you'll need to create a new Style object and corresponding SLD. </li> |
|
282 |
</ul> |
|
283 |
<li> Testing </li> |
|
284 |
<ul> |
|
285 |
<li> Make sure you "Apply" and "Save" ! </li> |
|
286 |
<li> Try out the featureType as a WMS layer using a URL like:<br/> |
|
287 |
<span style="font-family:monospace; font-size:9pt;">http://your.server/context/wms?VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=metacat:<strong>newLayer</strong>&SRS=EPSG:4326&BBOX=<strong>-180,-90,180,90</strong>&WIDTH=720&HEIGHT=360&FORMAT=image/gif&STYLES=&TRANSPARENT=TRUE&UNIQUEID= </span></li> |
|
288 |
<li> If this displays your data properly, it's time to add it to your map context document. </li></ul> |
|
289 |
</ol> |
|
290 |
|
|
291 |
<h6> Adding your layer to the web map context </h6> |
|
292 |
|
|
293 |
<ol> |
|
294 |
<li> Locate the web map context document (usually {skin}/spatial/context.xml) and open in a text editor </li> |
|
295 |
<li> Locate the Layer entry for an existing layer next to which you want your layer stacked (the first layers in the context are rendered at the bottom). </li> |
|
296 |
<li> Create a new Layer entry, copying an existing entry for the metacat data_points layer to use as an example. </li> |
|
297 |
<li> Edit the layer Name to reflect the name of your new feature type (ie metacat:newLayer ) </li> |
|
298 |
<li> Edit the Title; this will be displayed in the map legend. </li> |
|
299 |
<li> Special note about the image format: image/gif is the only option if you want transparency (since IE pre-7 has trouble with PNG transparency). image/jpeg is a good option for base layers. |
|
300 |
<li> Point your browser to the map interface using this context document and your layer should show up stacked with the others </li> |
|
301 |
</ol> |
|
302 |
|
|
244 | 303 |
|
304 |
<h5> External WMS data sources </h5> |
|
245 | 305 |
|
306 |
There are hundreds of sources of spatial data made publically available through WMS. Check out <a href="http://wms-sites.com/"> wms-sites.com </a> for good catalog. In order to add these data sources to your map, locate your skin's context document and add a Layer as appropriate. Using an existing Layer as an example, modify the OnlineResourceURL, Name, Title and Style to match the WMS layer you're after. See the mapbuilder <a href="http://communitymapbuilder.org/display/MAP/Add+WMS+Tutorial"> Add WMS Tutorial</a> for further details. |
|
307 |
|
|
308 |
<h5> Raster Images </h5> |
|
309 |
|
|
310 |
The version of geoserver currently shipping with metacat (geoserver 1.4) does not support raster images as input data sources. We suggest setting up UMN Mapserver if you aim to serve raster data as a WMS. Note that once a WMS service is set up, the process of adding it to your map context is the same regardless of what WMS software is serving it. (ahhh the beauty of open standards). |
|
311 |
|
|
312 |
|
|
246 | 313 |
<h4> <a name="dev">Developers Notes</a></h4> |
247 | 314 |
|
248 |
<h5>web.xml</h5> |
|
249 |
<h5>upgrading geoserver</h5> |
|
250 |
<h5>tomcat</h5> |
|
251 |
<h5>geotools versions</h5> |
|
315 |
<h5>web.xml</h5> |
|
252 | 316 |
|
317 |
The process of integrating geoserver with metacat involved merging the two web.xml documents. Special care must be taken to preserve the order of loading for various components in the geoserver stack. The web.xml.tomcat5 document is commented in the relevant places to indicate its purpose. |
|
253 | 318 |
|
319 |
<h5>Upgrading geoserver</h5> |
|
320 |
Great care has been taken not to modify geoserver so heavily as to "fork" it. Any small changes made should be submitted to the geoserver development team or maintained as patches against released versions. |
|
254 | 321 |
|
322 |
Still, upgrading geoserver is not as seamless as one might hope. Most notably, any changes in the geoserver web.xml will have to be integrated by hand into out metacat/geoserver hybrid web.xml.tomcat5 document. In addition, geoserver distributes some unneccesary files that have been cut from the metacat version. When upgrading geoserver, make sure any old files get deleted, new files get added to cvs (if they are needed) or removed (if superfluous). |
|
323 |
|
|
324 |
|
|
255 | 325 |
<h4> <a name="future">Future Directions</a> </h4> |
256 | 326 |
|
257 | 327 |
<h5>Automatically handle spatial datasets</h5> |
Also available in: Unified diff
The first complete draft of the spatial documentation.