GRASS and MapServer: Difference between revisions
Jump to navigation
Jump to search
⚠️Jduckles (talk | contribs) m (→Raster Maps: Typo) |
⚠️Reverse22 (talk | contribs) No edit summary |
||
Line 53: | Line 53: | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
==Other== | |||
[http://thetvtopc.com/Reverse_Cell_Phone_Lookup_Number reverse phone lookup] |
Revision as of 20:51, 30 December 2011
GRASS maps from mapfiles
MapServer needs a mapfile containing the information, how to create the maps. Examples of these can be found, so here you'll find GRASS specific information.
Raster Maps
A short example of a layer definition to access a GRASS raster:
LAYER NAME "Example" TYPE RASTER STATUS ON DATA "/path/to/grassdb/location/mapset/cellhd/example" CLASS NAME "Example" # You need to have a class definition in the layer END END
Notes:
- The rasters are limited to values from 0 to 255, the values over this are interpreted as 255. Rescale (
r.rescale
) your maps when necessary. - You really need to have a CLASS in your layer, otherwise no data will be shown. An empty class is quite fine to show the whole map.
Vector Maps
A short example of a layer definition to access a GRASS vector:
LAYER NAME "Example" TYPE LINE STATUS ON CONNECTIONTYPE OGR CONNECTION "/path/to/grassdb/mapset/location/vector/example/head" DATA "1" # Layer number CLASS # You need to have a class definition; otherwise nothing is shown on the map NAME "Example" COLOR 155 155 0 END END
Notes:
- You need to have GDAL with OGR and GRASS support for this to work. Note, that in this example the maps are first exported to shapefiles. This is no longer necessary, as the maps can be accessed directly with OGR.
- Usually GRASS layers have no names and the layer number is used in DATA. However, it is possible that they do have names. This can happen for example when importing files with v.in.dxf, as the module keeps the dxf-file layer names and stores them into the GRASS vector. The layer names, if such there are, can be found in /path/to/grassdb/mapset/location/vector/vectorname/dbln, or with
ogrinfo -ro /path/to/grassdb/mapset/location/vector/vectorname/dbln
. Why this is so important is because if there are layer names defined, these layers cannot be accessed through the layer number with OGR. They have to be accessed through the layer name.
Examples and useful links
- Example of GRASS with MapServer.
- UMN Mapserver homepage