wiki:MapObjectOld

Introduction

A map object in Rappture is a high-level interface to the map widget. It describes how the map is viewed (e.g. what layers are visible), what controls are used, and the various data viewers to examine associated data.

    <map>
        <about>
             <label>My Map</label>
             <description></description>
        </about>

       <stylesheet>mymap.xml</stylesheet>
       <table>mydata.csv</table>
       <background>white</background>
 
       <legend></legend>
       <scalebar></scalebar>
       <pan></pan>
       <zoom></zoom>
       <viewers>
          <xygraph></xygraph>
          <barchart> </barchart>
          <gallery></gallery>
          <photo></photo>        
       </viewers>
       
       <layers>
         <layer id="name"> 
            <label>My Layer</label>
            <description>This layer is used for...</description>        
            <style>-show no -icon file.png -font Arial -color blue</style>          ...
         </layer>
       </layers>
    </map>

Maps must a have stylesheet. This is map-specific information that describes the layers and styles that compose the map. For 2-D maps (almost all maps) this is a Mapnik stylesheet.

<about><label>
This is the label of the map. It's used to label the output of the map in Rappture's drop down list of outputs.
<stylesheet>
This is map-specific information that describes the layers and styles

that compose the map. For 2-D maps (almost all maps) this is a Mapnik stylesheet.

<projection>
Defines the projection of the map if type is 'projected' (for geocetric maps this should be omitted). All layers should ideally be in this projection, but any layers that are not will be re-projected. If not specified, the map projection will be the projection of the first (base) layer. The projection can be an EPSG code in the form "epsg:n" where n is a number, or it can be a PROJ4 command-line string.
<extents>
This specifies the output extent of the map (i.e.the bounding box of the map). Any data in layers beyond these extents will not be visible. The <extents> values are given in this format: <Lower Left X> <Lower Left Y> <Upper Right X> <Upper Right Y>, with spaces separating each value. This needs to be in the same projection and units as the map, i.e. the projection specified in the projection element or by the first (base) layer.
<units>
This is the units for displayed distances in the map (e.g scale bar).
<background>
Sets the background of the blank map. The default is white.
<layer>
There can be one or more layers described. The first layer is by default the base layer. Layers are drawn in the order they are found in the <map>.
<symbols>
Defines one or sets of symbols to use in the map. The symbol is typically aan image.
<halo>
Specifies the number of pixels error to select items.
<legend>
Specifies the legend is to be displayed and its attributes.
<scalebar>
Specifies the scalebar is to be displayed and its attributes.
<pan>
Specifies that panning controls are to be drawn and their location. You can still use the mouse to pan the map without panning controls.
<zoom>
Specifies that zoom controls are to be drawn and their location. You can still use the mouse to zoom the map without zooming controls.
<viewers>
Specifies a x-y or bar graph to be displayed using layer data. There may be more than one plot specified.

Layers

A <layer> subelement describes a layer of the map. Layers are drawn one on top of the next.

  <layer>
    <name>My Layer</name>
    <description>...</description>
    <type>raster</type>
    <status>hidden</status>
    <opacity>100</opacity>
    <file>...</file>
    <url>...</url>
    <query>...</query>

    <style>...</style>

    <labelstyle>
	<font></font>
	<status>hidden</status>
	<anchor></anchor>
	<style>-color blue -outlinecolor green -anchor n</style>
    </labelstyle>

    <feature>...</feature>
  </layer>
<name>
This is the name of the layer. It's displayed in controls to hide/show individual layers.
<description>
This is a description of the layer.
<type>
This is the type of layer. Valid layer types are circle, line, point, polygon, and raster.
<status>
The status of the layer. The status is a list of attributes: hidden, noquery. If the layer is hidden, it is initially not displayed in the map. The user may choose to display it using the map controls.
<style>
A layer may have one or more styles defined.
<labelstyle>
The element describes the styles for the labels in the layer.
<opacity>
This sets the opacity of the layer. The default is 100 percent.

Layer Data

Layer data can be described by using one several subelements.

<file>
This is the name of a file. The file path is relative, it is searched using the defined <path> for the <map>. If the file is a shape file, then the name is used as a root name to match the various shape files.
<url>
This is a url query.
<query>
This is a GIS query the type of layer.
<field>
This lets use a field as the data portion of a shape.

Styles

Styles can be described as a JSON string, or a TCL-like configure string, or XML elements, Styles need to be named so that they can be used in layer expressions.

TCL:

	-linewidth 2 -font "Arial Bold 12" -symbol mySymbol

JSON:

      states {
                stroke:       #ffff00;
                stroke-width: 2.0;
      }

Plots

A <plot> defines a X-Y or barchart plot. A plot looks like a Rappture <curve>. Plots are triggered by layer selections.

   <plot>
      <values>layer1</values>	
   </plot>

Example 1: Single Map Layer with geoTIFF File

This example displays a raster image of Tippecanoe county from a geoTIFF file.

  <map>
     <about>
         <label>Tippecanoe County 20130422</label>
     </about>
    <path>/data/geoshare/tutorial/tippcanoe<path>
    <layers>
      <layer> 
        <type>raster</type>
        <file>Tippecanoe_County_20130422_LC8_C234.tif</file>
      </layer>
    </layers>
  </map>

The pertinent information is derived from the geoTIFF file using gdal.

   gdalinfo Tippecanoe_County_20130422_LC8_C234.tif

This includes the <extents>, <size>, and <projection>.

Driver: GTiff/GeoTIFF
Files: Tippecanoe_County_20130422_LC8_C234.tif
Size is 1500, 1500
Coordinate System is:
PROJCS["WGS 84 / UTM zone 16N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-87],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32616"]]
Origin = (482385.000000000000000,4495815.000000000000000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_IMAGEDESCRIPTION=Generated by MultiSpecUniversalIntel_11.08.2013 on 12-04-2013  12:03:28 |
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  482385.000, 4495815.000) ( 87d12'29.65"W, 40d36'46.68"N)
Lower Left  (  482385.000, 4450815.000) ( 87d12'25.16"W, 40d12'27.21"N)
Upper Right (  527385.000, 4495815.000) ( 86d40'34.57"W, 40d36'45.72"N)
Lower Right (  527385.000, 4450815.000) ( 86d40'41.54"W, 40d12'26.26"N)
Center      (  504885.000, 4473315.000) ( 86d56'32.73"W, 40d24'37.58"N)
Band 1 Block=1500x128 Type=UInt16, ColorInterp=Red
Band 2 Block=1500x128 Type=UInt16, ColorInterp=Green
Band 3 Block=1500x128 Type=UInt16, ColorInterp=Blue

Example 2: Single Map Layer with PNG File

This example displays a raster image of Tippecanoe county from a PNG file.

  <map>
     <about>
         <label>Tippecanoe County 20130422</label>
     </about>
    <path>/data/geoshare/tutorial/tippcanoe<path>
    <layers>
      <layer> 
        <type>raster</type>
        <file>Tippecanoe_County_20130422_LC8.png</file>
      </layer>
    </layers>
  </map>

The default extents are the size of the raster file. The size of the map defaults to 250 by 250 pixels (the size of the image). There is no projection.

Example 3: Single Map Layer Using Shape File

This example displays a map of the Great Lakes states displaying a single layer. The shape files are located in /data/geoshare/tutorial/data and are prefixed by "states_ugl" such as /data/geoshare/tutorial/data/states_ugl.shp.

  <map>
    <extent>-97.238976 41.619778 -82.122902 49.385620</extent>
    <size>400 300</size>
    <path>/data/geoshare/tutorial/data</path>
    <background>white</background>
    <layers>
      <layer> 
        <name>states</name>
        <description>The Upper Great Lakes States</description>
        <type>polygon</type>
        <file>states_ugl.shp<file>
        <style>
          <color>grey90</color>
          <outlinecolor>grey20</outlinecolor>
        </style>
      </layer>
    </layers>
  </map>

Example 4: Two Layer Map with Shape File

This example displays a map of the Great Lakes states displaying two layers. The same shape file is used for both a layer of polygons representing the states, and a layer of lines representing the state boundaries.

  <map>
    <extent>-97.238976 41.619778 -82.122902 49.385620</extent>
    <size>400 300</size>
    <path>/data/geoshare/tutorial/data</path>
    <background>white</background>

    <layers>
      <layer> 
        <name>states_poly</name>
        <description>The Upper Great Lakes States</description>
        <type>polygon</type>
        <file>states_ug.shp<file>
        <style>
          <color>grey90</color>
          <outlinecolor>grey20</outlinecolor>
        </style>
      </layer>
      <layer> 
        <name>states_line</name>
        <description>State Boundary of the Upper Great Lakes States</description>
        <type>line</type>
        <file>states_ugl.shp<file>
        <style>
          <color>grey20</color>
        </style>
      </layer>
    </layers>
  </map>

Example 5: Two Layer Map with Different Styles

This example displays a map of the Great Lakes states displaying two layers. The polygon layer has two different styles predicated by the name "land" or "water".

This requires a dynamic query of the shape data.

  <map>
    <extent>-97.238976 41.619778 -82.122902 49.385620</extent>
    <size>400 300</size>
    <path>/data/geoshare/tutorial/data</path>
    <background>white</background>

    <layers>
      <layer> 
        <name>states_poly</name>
        <description>The Upper Great Lakes States</description>
        <type>polygon</type>
        <file>states_ugl.shp<file>
        <style>
          <enable>land</enable>
          <color>grey90</color>
          <outlinecolor>grey20</outlinecolor>
        </style>
        <style>
          <enable>water</enable>
          <color>grey90</color>
          <outlinecolor>grey20</outlinecolor>
        </style>
      </layer>
      <layer> 
        <name>states_line</name>
        <description>State Boundary of the Upper Great Lakes States</description>
        <type>line</type>
        <file>states_ugl.shp<file>
        <style>
          <color>grey20</color>
        </style>
      </layer>
    </layers>
  </map>

Example 6: Two Layer Map with Labels

This example displays a map of the Great Lakes states displaying two layers and labels. Labels are automatically generated from the shape file and placed on the map according to whatever algorithm is set.

This requires a dynamic query of the shape data.

  <map>
    <extent>-97.238976 41.619778 -82.122902 49.385620</extent>
    <size>400 300</size>
    <path>/data/geoshare/tutorial/data</path>
    <background>white</background>

    <layers>
      <layer> 
        <name>states_poly</name>
        <description>The Upper Great Lakes States</description>
        <type>polygon</type>
        <file>states_ugl.shp<file>
        <style>
          <enable>land</enable>
          <color>grey90</color>
          <outlinecolor>grey20</outlinecolor>
        </style>
        <style>
          <enable>water</enable>
          <color>grey90</color>
          <outlinecolor>grey20</outlinecolor>
        </style>
        <labelstyle>
          <font>arial bold 12</font>
	  <anchor>c</anchor>
        </labelstyle>
      </layer>
      <layer> 
        <name>states_line</name>
        <description>State Boundary of the Upper Great Lakes States</description>
        <type>line</type>
        <file>states_ugl.shp<file>
        <style>
          <color>grey20</color>
        </style>
      </layer>
    </layers>
  </map>

Example 7: Three Layer Map with Raster Layer

This example displays a map of the Great Lakes states displaying three layers where one is a raster. You can see where it's useful to have the states boundary as a separate layer.

This requires a dynamic query of the shape data.

  <map>
    <extent>-97.238976 41.619778 -82.122902 49.385620</extent>
    <size>400 300</size>
    <path>/data/geoshare/tutorial/data</path>
    <background>white</background>

    <layers>
      <layer> 
        <name>states_poly</name>
        <description>The Upper Great Lakes States</description>
        <type>polygon</type>
        <file>states_ugl.shp<file>
        <style>
          <enable>land</enable>
          <color>grey90</color>
          <outlinecolor>grey20</outlinecolor>
        </style>
        <style>
          <enable>water</enable>
          <color>grey90</color>
          <outlinecolor>grey20</outlinecolor>
        </style>
        <labelstyle>
          <font>arial bold 12</font>
	  <anchor>c</anchor>
        </labelstyle>
      </layer>

      <layer>
         <name>modis</name>
         <type>raster</type>
         <file>raster/mod09a12003161_ugl_ll_8bit.tif</file>
         <bands>1 2 3</bands>
         <maskcolor>71 74 65</maskcolor>
      </layer>

      <layer> 
        <name>states_line</name>
        <description>State Boundary of the Upper Great Lakes States</description>
        <type>line</type>
        <file>states_ugl.shp<file>
        <style>
          <color>grey20</color>
        </style>
      </layer>
    </layers>
  </map>

Questions

  1. Where do users get maps? Is there a browse-able database of maps?
  1. How many features of multispec are required for the first use case?

  1. There needs to be logic to select/interpret layer values. This is usually done by a GIS database? Will we support let's say a postGIS database? Can we support an "expression" syntax?
  1. Is a dbase file (.dbf) parser required? How do I search or extract values from shape.dbf files?
Last modified 9 years ago Last modified on Nov 27, 2014 6:57:35 AM

Attachments (8)

Download all attachments as: .zip