Tech:Open Source/Random Code Notes
From Cyclopath
These notes are based on first discovery, so they may be incorrect, and probably chaotic, disorganized and incomplete.
Feel free to correct, add to, organize, improve, etc., as well as adding FIXMEs for missing/desired information.
main.mxml generates the visual components of the map, and has an initialization function the appears to be the starting point of the program.
Data exchange between the client and the pyserver is done in the files beginning with WFS (though I read they are not strictly WFS). The 'get's get data and 'put'a save changes made by the user, both in batches, which are assembled and disassembled by the appropriate side.
This batch approach means there is no error codes available to the client, or error recovery; either the batches succeed or fail.
When a debug version of flash is installed, right click on the map, and click 'debug' to get the trace statements in the flash log file.
There is no protections for concurrent edits (two users) of the same object:
- If one user moves a byway which another user has deleted, the last user to save will not be able to save (loses all changes since they are batched).
- Any change to the same object produces this error, even if theres no actual conflict (ie one changes name, another moves block).
- Changes to adjecent, connected blocks cause no problems.
class G (G.as) holds global variables (single letter name-ick)
class Map_Canvas (Map_Canvas.as) is the main map class.
The seven tools aways visible on the map are in the tools subfolder. The base class is Tool (Tool.as).
In addition, there is a commands subfolder, base class Command with many more, but also includes many of the commands in tools, with identical names (class and filename). FIXME what are the differences in function between these?
Notes on scripts importing MNDOT maps:
import_polygons.py imports lakes and green spaces. It produces errors. My guess is that the current MNOOT shape files (.shp) have a newer format that makes this script outdated. I found shp codes for green spaces & lakes, 170 & 220. I don't know if these are valid for current MNDOT shp's. CP types are 2,3 resp. import_mndot_roads.py imports byways. It's prerequites are a sql table and a TIS. tis_join.sql appears to create the table for preceeding. It's prerequisite is a long list of steps. This is where I gave up.
One more thing for import_polygons.py. In the road codes, ramps should be changed from 41 to 11. On the map, I found a lot of local road ramps typed as expressway ramps, and made 'impassible' as a result.
[edit] Debugging Mapserver and Tilecache
I took a request string from the apache logs that appeared to be a tile request, appended to localhost and feed it into the browser. It looked something like this:
http://localhost/wms?&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=cyclopath&SRS=EPSG:26915&BBOX=524288,4947968,557056,4980736&WIDTH=256&HEIGHT=256&FORMAT=image/png
I got this:
loadOutputFormat(): General error message. OUTPUTFORMAT clause references driver AGG/PNG, but this driver isn't configured.
This obviously means mapserver isn't configured right. But I couldn't figure out how to fix it, and I gave up. After spending a month struggling to get CP installed, I don't want to spend another to get this working. I'll live without tiles for the time being. I'm hoping someone else will figure this out.
[edit] Edit at all zoom levels
Warning: I've only tried this on a sparsely populated map. Low zoom edit levels with a densely populated map will probably cause the client to bog down, or maybe crash.
This is good for adding large scale features quickly on an unpopulated map or map area.
Find 'public static const raster_only_zoom:int' in conf.as and change it from 13 to 8 (or some number in between).
In 'pyserver/CONFIG' find 'request_area_max' and add a couple of zeros. Note the comment about DOS attacks.
There are some missing entries in the draw_param table that will create problems, so run psql and add these:
psql -U cycling
insert into draw_param (draw_class_code,zoom,width,label,label_size) values (12,11,5,'t',5); insert into draw_param (draw_class_code,zoom,width,label,label_size) values (12,10,3,'t',3); insert into draw_param (draw_class_code,zoom,width,label,label_size) values (12,9,2,'t',2); insert into draw_param (draw_class_code,zoom,width,label,label_size) values (11,11,0,'f',0); insert into draw_param (draw_class_code,zoom,width,label,label_size) values (11,10,0,'f',0); insert into draw_param (draw_class_code,zoom,width,label,label_size) values (11,9,0,'f',0);
