14.3. MapScript Objects

 < Day Day Up > 

For a complete MapScript object, variable, and method guide see the latest on the MapServer documentation web site page or Sean Gillies' reference guide (http://zcologia.com/mapserver).

Class diagrams are also available from these web sites:

Classes within the map file can be accessed as objects in MapScript. In fact, there are more objects to handle than you normally see, because MapServer does a lot of the work with them behind the scenes. The main part of a MapScript application is the map object (mapObj). The mapObj can have many layer objects (layerObj) as well as legend (legendObj), scale bar (scalebarObj), and reference map (referenceMapObj) objects. Figure 14-1 shows a diagram of how these objects are hierarchically structured.

The main object is the mapObj. You can add a layerObj, classObj, and styleObj to the mapObj. Other objects should never be explicitly created, such as webObj, scalebarObj, legendObj, and colorObj. These are already part of the mapObj, and constructing new objects for them will fail. If you get segmentation faults from MapScript, this may be the cause.

All the attributes of objects that you normally see in the map file are available for manipulation through MapScript.

Using the MapScript API is best understood by walking through some simple examples.

     < Day Day Up > 


    Web Mapping
    Web Mapping Illustrated: Using Open Source GIS Toolkits
    ISBN: 0596008651
    EAN: 2147483647
    Year: 2005
    Pages: 138

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net