SourceForge Logo

  1. Comunication protocol overview
  2. Map queries
  3. Info queries
  4. Url queries

Cgi protocol

In order to allow html-javascript navigation of maps i wrote a couple of cgi to stand in the middle between the javascript and the server: map and info. Here is a description of the protocol to be used to obtain a map or an html page, it has the same structure of the request protocol

They translate a CGI request into an XML one, open a connection with grulesd and deliver the response.

Usually grulesd will run on the same machine listening on port 6148. It may however run on another machine or another port. In that case a file named 'grules.cfg' needs to be created in the same directory where the cgi are, with only a line in it, containing address and port where the server is located.

Should the server be unavailable, error messages can be customized with html files and images, just put in the same directory as 'grules' is the following files:

  1. 'noserver.png': image returned on map requests when server is unreachable (may be dead or over busy).
  2. 'noserver.html': html file for info requests when server unreachable.

Overview

This protocol i really a literal translation of the Xml one. Here is a minimal example:
  /cgi-bin/grl/map?project=PROJECT®ion=X:Y:N:S:E:W&THEME1&THEME2
Where one should obviously substitute PROJECT with the default project, and all other variables as appropriate. Each theme request can be further specified using '|' as a separator and the following queries:
  • scheme:SCHEME to request a particular scheme
  • shape:LAYER:12 to select the shape number 12 in the layer LAYER inside the theme.
  • $FIELD:VALUE1:VALUE2 to select only the shapes where the field FIELD is among VALUE1 or VALUE2 (or how many you want)
  • geo:E:N:R to select only shapes intersecting a circle of radius R centered in (E,N)
Whenever one of theese queries appears alone among '&' it will be applied to all themes appearing in the url.

When requesting an 'info' the rules are the same only a template (.grml) will be used to return information. On default the template will have the same name of the default project (like industry.grml for a project industry) and should be located in the info cgi directory.

Table of contents Home