wiki:BluePrint/GIS/Markers

Version 9 (modified by Fran Boon, 8 years ago) ( diff )

--

GIS Markers

Markers get used to display Features.

We have a folder full of samples (in static/img/markers) which then can be supplemented by user uploads.

The Database table therefore needs to have all the samples imported into it. The 'uploads' feature of Web2Py only supports having all files in the single 'uploads' folder & needs them to be named in the format: table.image.name.ext.

UPDATE: As of Sep 09 this format is supported:

db.table.field.uploadfolder = os.path.join(request.folder, "static/img/markers")

In order to allow good maintenance we want to keep the markers named nicely & in their hierarchy. We want a script to copy these files into the uploads folder with the correct names & insert the records into the database to point at them.
Currently this is done for just the single default marker: marker.png (code in modules/s3db/gis.py)
NB ID=1 is the default marker

dir = os.path.join(request.folder, "static", "markers")
files = dir.list()
etc (recursively)

(or could we have 2 types of markers defined in the DB? Static & Uploads)

We would also like to be able to support Markers held within static/theme/<theme_name>/img

We also want these enhancements to the marker/create routine:

  • height & width detected automatically
    • do this client-side using JavaScript's Image() class methods: img.width/img.height
      • Saves database calls
      • Slow to compute?
      • not supported by older versions of JS or by non-JS browsers
    • Do this server-side when marker added to database?
      • Requires 2 extra DB calls when producing the page
      • use PIL?
      • jQuery used to populate the fields or else populate via hidden fields
  • jQuery to populate the name field from the filename

When choosing Markers, it would be useful to be aware of the original folder hierarchy (look at Sahana2 for example UI for selecting markers)

Could maybe use this to help use Uploaded Images in a Catalogue view:


GIS BluePrints

Note: See TracWiki for help on using the wiki.