-
Notifications
You must be signed in to change notification settings - Fork 1
How to Use
The application follows OpenLayers standards for defining Layers and Maps. It has two classes in the models.
- Layer
- Map
The two classes has a many to many relationship so that one layer can be used in many maps and a map can have many layers.
The Layer class is defined to satisfy specific requirements to create a new OpenLayers Layer. It has fields as follows :-
name : define layer name
layer_type : Define layer types as in openlayers -- Base Layer {baseLayer:True } / Overlay {baseLayer:False}
protocol : defines the appropriate protocol to be followed while creating the layer .The user can select from the list with options as follows based on the capabilities of the server.
i) ArcGIS Cache - This layer uses ArcGIS's Tile caching for better performance.It is always taken as the base layer.
ii) ARCGIS93Rest - follows the ArcGIS rest api for map generation.
iii) WFS - Web feature Service standard by Open Geospatial Consortium.Generally used for overlays.
iv) WMS - Web Map Service standard by Open Geospaial Consortium.
v) OSM - Basic Open Street Map layer.
source : Provide the source URL for the layer data. Generally the server.
layer_info : This is field is mostly used for the ArcGIS cache protocol.The cache layer information from the server needs to be entered over here in JSON format.This data is required while creating a ArcGIS cache layer.
layers : This field is generally used for WFS,WMS and ArcGIS93Rest protocols to request specific layers from the server
The Map class has basic options for creating an OpenLayers Map. A Map can have multiple layers.Thus theres a many to many field 'layers' present in the Map class.The fields are as follows.
slug_name : generates a slug name for the given name to be used in URIs.
name : Provide a name for the Map.
projection : Takes from SPATIAL_REFEREBCE_SYSTEM_ID defined in the settings.py
max_resolution : Provide maxResolution
max_extent : Provide bounds for the map extent.
zoom_level : Provide a initial zoom level at which the map must be zoomed.
tile_size : Provide tile size.generally in the form of pixels.Generally (256,256)
layers : A many to many field where the user can select predefined layers to be added in the Map.
The user can define Layers in the admin using the Layer class.
These Layers can then be added to the Map defined in the Admin using the Map class.
The application has two views -
/map/map/map_name - which provides a preview of the map in the browser.
/map/javascript/map_name.js - This view generates a javascript code containing a function called create map(){} along with other layer and map definitions.
The javascript can be called in the html template of any application in which the map is to be used using the script tag.
The create map function can also be overridden to provide more functionality based on the requirement of the specific application.