[GRASS5] Re: WWW and Grass.

Federico Ponchio ponchio at ruffini.dm.unipi.it
Fri Oct 13 05:51:01 EDT 2000


Markus,
	yes, i will announce it on the list but first i would like
to make it work for Internet Explorer, be sure its reasonably stable
(its been working for a week, but i didn't tested it as it should have
been), get some money from a couple of governative institutions which
could have some problems understaning why they have to pay for something
im going to give away for free. (They didn't grasp the open source idea)
And lastly id like to ask you some questions and talk about some aspect of
the thing. I think that when i release it it should be at least in
a semidefinitive form.

I beg you to read the following and give your opinion.

Architecture as it is now:
There is a pool of shared memory, in which is stored all the data needed
for plotting the map and answering word and spatial queries.
Every CGI attach the shared memory, perform various operations
(possibly updating expired data) end detach the segment.

As id like it:
Theres a "master demon" which allocates the memory and is in charge of
updating the data. The requests could be served by forked "childrens"
(tricky to deliver the image) or dirctly by CGI (tricky to pass memory).

Configuration:

I send you the configuration files so that you can understand what im
talking about.

The principal web page and the javascript must be modified when working
with a different number of themes or when configuring the search. 
I haven't found a decent way to standardize it.
Im quite proud of the auto-resizing map when resizing the window.
Probably the most difficult thing in this project :P

The search page and the info page: theese are templates whith a couple
of ad-hoc tags to tell the CGI how to display the data.
Every map can have a differently customized page (you see only a table in
the demo, but i could give out informations in any way).
Advantage: everyone can choose its graphic look and display information
in the most flexible way.
Problem: the syntax i use to tell the CGI where to put the requested data
it is not standard, and certainly not a elegant. Proposals?

A big messy configuration file:
Actually in a ad-hoc, absolutely non standard, a bit scary, and somewhat
ugly format. Have a look at it, its commented.
Wouldn't it be better to write it in XML?

Missing: the mask attribute for the lines is not used (as it is planned)
so that one would be able to draw roads and rivers in an appropriate way.
Question: its not clear how to deal with isles. Actually i use this
pproach: if an area contains another i consider it a hole and strip it.
Im not satisfied of it. When the original creators of grass though about
the question they had something in mind. 
Im not smart enough to understand it looking at the .h files.


Database issues:

I'm using Informix and Postgres libraries (MySQL planned) for processing
the database queryes needed for assigning attributes and for searches.
This unnaturally forces the poor unfortunate configurator to write
explicitly the queries. This gives a great deal of flexibility to the
tool, maybe there's some standard on how tables record data associated to
grass maps, which could simplify the work? 
I did not investigated so much the problem, my fault.
Nice thing though, you can use an intermediate table for associating
objects to "keys" and be able to use remote databases which do not need to
be related to your map.

Various issues: 
CGI's being runned by apache cannot set some enviroment varibles due to
a uid and effective uid check in grass5.0beta/src/libes/gis/mapset_msc.c      
I find it a bit silly that i cannot use as default mapset a mapset im not
the owner when i an change it anytime later.
I had to disable the check. But its a (minor) problem.

Security issues:
I did not thought of them at all, at the moment theres not even a limit on
the dimensions of the image one could ask to the server.


Performance Issues:
This is a demo and not being masochist i did not use heavy maps on it
(except for the raster of Pisa (which you may have not seen: it displays
onlt under a certain scale). But big map files can pose a serious problem.
This tool allow you to circunvent the problem creating maps with different
details (w.prune for vectorial maps for example) and displaying the right
one at the right scale in the same layer so that the final user do not
even notice.
This is obviously a rough and ugly hack.
The right answer is called multiresolution.
I know theres some good work with 3d vectorial meshes. I think it can be
ported into 2d with some effort.
I know there's been some good work in the raster field too. I do not know
its there's any piece of open source code but something could be done.

Thats all? Well i didn't sleep all the night (im trying to get a
Ph.D. in Math also, so im quite busy), so i may miss something.
Forgive my english, if you can.

			Federico

P.S. I did it all alone, and i do not see anyone who could help
me in this task. I feel a bit scared at the sheer amount of work awaiting
for me.

P.P.S. The original idea of this work is due to Mauro Bueti, currently
working as System Administrator at the "Soprintendenza ai beni
culturali" of Pisa. He provided (instaled and mantained) a computer,
and lured me into not giving up promising me money, fame and womens.


 On Fri, 13 Oct 2000, Markus Neteler
wrote:

> Federico,
> 
> wow, this is impressive! I suggest you announce it on
> grasslist at baylor.edu
> and I will put a link onto our link page?!
> 
> What do you think?
> 
>  Markus
> 
-------------- next part --------------
background:255 255 255 
#lines following a # are comments (quite obious)
#this defines some colors to be referenced later in queries,
#using the number i had commented near it
color: 160 80 80 #1
color: 145 80 80 #2
color: 130 80 80 #3
color: 80 60 60

#here im defining some font face for the labels:
# 20 is the size 5 refer to the alignment and next is the true type font
face: 20 5 /usr/local/grass/grassproject/fonts/arial.ttf 
face: 10 5 /usr/local/grass/grassproject/fonts/arial.ttf 
#here are other GLOBAL DEFAULTS. (Overridable obviously)
mapset: definitivo 
dbms: informix 
#host: snarf #if some of this pieces is missing a standard one is used.
database: grassrules
user: grassrul
passwd: grass00 #nasty: the password in clear.... 
#here is defined the first theme, unfortunately i called it layer.
#this is a bit confusing. Im sorry.
layer:
	#LAYER DEFAULTS: similar to the global defaults, only
	#they stay only inside this layer.
	#lifetime 0 means this map do not need to be upgraded as it displays
	#static information. a different number would have forced
	#the CGI to reread the information from the database after number
	#seconds (3600 an hour, 89000 a day etc.)
	lifetime: 0 
	#maps comes in three kind: vector, site and label
	kind: vector
	#here start the first map and PI_limiti_FAST is its name.
	map: PI_limiti_FAST
		#this tells if its to be displayed as areas or lines.
		#it should be merged with the kind attribute. To be done.
		vis: areas
		#valueas are in UTM units per pixel and determine range
		#in which the map is displayer.
		#def_res is the default resolution, useful.
		min_res: 5
		max_res: 500
		def_res: 50
		#here im overriding the default.
		lifetime: 20000
		#color_mode can be single or multiple ( a single color
		# for all the areas or a different color for every one)
		#otherwise can be query_single or query_multiple
		#meaning that the cat will be retrieved with a query.
		color_mode: single
		#yes, data is stored in a hash. since is single
		#every Area with nonzero cat is displaye in gray.
		color_hash:
		cat: 1 190 190 190
		end_hash:
		#here is define some information attributes:
		#A title (or name ) for the object,
		info_title: "Comune di <0>."
		#a small summary.,
		#notice how <0> refers to the first field in the info_query.
		#below.
		info_summary: "Comune di <0> in provincia di <1>."
		info_query: "select comune as hidden, provincia, regione from PI_limiti where cat=%d;"
		#self explanatory.
		search_query: "select cat from PI_limiti where upper(comune) like upper('%%%s%%');"
	end_map:
	#again, layer_defaults:
		kind: vector
		vis: lines
		min_res: 0
		max_res: 500
		def_res: 50
		color_mode: single
		color_hash: 
		cat: 0 64 64 64 64
		end_hash:
	map: PI_limiti_FAST
	map: LI_limiti_FAST
	map: LU_limiti_FAST
	map: MS_limiti

	map: toscana_FAST
		vis: areas
		min_res: 500
		max_res: 500000
		def_res: 1000
		color_mode: multiple
		color_hash:
		cat: 8 128 128 128 128
		end_hash:
		lifetime: 20000
		info_title: "Provincia di <0>.";
		info_summary: "Provincia di <0>, regione Toscana.;"
		info_query: "select provincia as hidden from toscanatmp where cat=%d;"
	map: toscana_FAST
		vis: lines
		min_res: 500
		max_res: 500000
		def_res: 1000
		color_mode: single
		color_hash: 
		cat: 0 64 64 64 
		end_hash:
	map: PI_Loc_abi
		vis: areas
		min_res: 5
		max_res: 500
		def_res: 50
		lifetime: 2000
		color_mode: query_multiple
		color_hash: 500

		#here is use different colors for inhabitated ares
		#using the "population" field.

		color_query: "select cat, 1 from PI_Loc_abi where abitanti > 50000 union select cat, 2 from PI_Loc_abi where abitanti > 10000 and abitanti <= 50000 union select cat, 3 from PI_Loc_abi where abitanti <= 10000;"
		info_title: "Localita' <0>."
		info_summary: "Localita' <0> nel comune di <1>."
		info_query: "select nome_loc as hidden, nome_com as Comune, abitanti as Abitanti, quota as Altitudine from PI_Loc_abi where cat=%d;"
		search_query: "select cat from PI_Loc_abi where upper(nome_loc) like upper('%%%s%%');"
	map: PI_limiti
		kind: site
		vis: labels
		min_res: 20
		max_res: 100
		def_res: 50
		lifetime: 2000
		color_mode: single
		color_hash: 
		cat: 0 128 128 128
		cat: 1 32 32 32
		end_hash:
		face_mode: single
		face_hash: 
		cat: 1 10 5 /usr/local/grass/grassproject/fonts/times.ttf
		end_hash:
		label_mode: query_multiple
		label_hash: 100
		label_query: "select cat, comune from pi_limiti;"
	map: LI_limiti
		kind: site
		vis: labels
		min_res: 0
		max_res: 100000000000
		def_res: 50
		lifetime: 2000
		color_mode: single
		color_hash: 
		cat: 1 130 50 50
		end_hash:
		face_mode: single
		face_hash: 
		cat: 1 10 5 /usr/local/grass/grassproject/fonts/times.ttf
		end_hash:
		label_mode: query_multiple
		label_hash: 100
		label_query: "select cat, comune from li_limiti;"
	map: PI_Loc_abi
		kind: site
		vis: labels
		min_res: 0
		max_res: 60
		def_res: 10
		lifetime: 2000000
		color_mode: single
		color_hash:
		cat: 1 0 0 0 
		end_hash:
		face_mode: query_multiple
		face_hash: 600
		face_query: "select cat, 0 from PI_Loc_abi where abitanti > 10000 union select cat, 1 from PI_loc_abi where abitanti <= 10000;"
		end_hash:
		label_mode: query_multiple
		label_hash: 500
		label_query: "select cat, nome_loc from PI_Loc_abi;"
		end_map:
layer:
		kind: vector		
		vis: lines
		min_res: 0
		max_res: 2000
		def_res: 50
		color_mode: single
		color_hash: 
		cat: 0 80 50 50
		end_hash:
	map:PI_tav_igm_FAST
	map:LI_tav_igm_FAST
	map:MS_tav_igm_FAST
	map:LU_tav_igm_FAST
	end_map:
		kind:raster
		vis: raster
		min_res: 1
		max_res: 60
		def_res: 50
		color_mode: multiple
		color_hash:
		cat: 0 255 255 255 
		cat: 1 191 191 191 
		cat: 2 100 100 100 
		cat: 3 31 31 31
		cat: 4 0 0 0
		end_hash:
#	map: 1042no
	map: 1042se	
#	map: 1042so
layer:
	map: PI_v1497pol
		kind: vector
		vis: areas
		min_res: 0
		max_res: 400
		def_res: 50
		local_dbms: informix 
		#local_host: snarf
		#local_port: 5432
		local_database: grassrules
		local_user: grassrul 
		local_passwd: grass00
		query_cat: "select cat from pi_v1497pol where codvr = %s;"
		query_key: "select codvr from pi_v1497pol where cat = %d;"
		lifetime: 2000
		color_mode: single
		color_hash: 
		cat: 1 100 190 60
		cat: 0 90 50 50
		end_hash:
	        mask_mode: single
		mask_hash:
		cat: 1 pisa/tile.png
		end_hash:
		info_title: "Zona vincolata L.1497."
		info_summary: "Oggetto: <0>."
		info_query: "select oggvin as oggetto from pi_vincoli where codvin = %s;"
		search_query: "select codvin from pi_vincoli where upper(oggvin) like upper('%%%s%%');"
	map: PI_v1497pol
		kind: vector
		vis: lines
		min_res: 0
		max_res: 400
		def_res: 50
		color_mode: single
		color_hash: 
		cat: 0 180 180 0
		end_hash:









-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20001013/6cfc5f23/search.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20001013/6cfc5f23/info.html


More information about the grass-dev mailing list