Archive

Archive for October, 2006

Adding SESSION based data store for Chameleon based apps.

October 23rd, 2006

I have had a great need for a directory structure like the following in my Chameleon based apps:

SESSION_DIR
|
—>data
|
—>base_data (Base data shared with all apps on file server)
|
—>app_data (Application specific data residing on local server)
|
—>dyn_data (User specific dynamically generated layers)

The way I have tackeled this is to create a new directory in the session space of the Chameleon app and create symbolic links for the base and application data to common data storage areas on my file sservers. Lastly a new directory is created in that session data directory for dynamically created data. Pretty basic, but many questions have been asked to me about this, so here is an example.

index.phtml

// Make sure we have a data dir that is session based:
// sessionSavePath/data/base_data -> symbolic link to base data dir (shared)
// sessionSavePath/data/app_data -> application specific data (shared)
// sessionSavePath/data/dyn_data -> user specific dynamic data (not shared)
// If the directory does not exist, then we need to make one.
$data_dir = getSessionSavePath()."/data";
$data_base_dir = $data_dir."/base_data";
$data_app_dir = $data_dir."/app_data";
$data_dyn_dir = $data_dir."/dyn_data";
//save the current application working directory
$cwd = getcwd();
if (!file_exists($data_dir))
{
// Here we make the session data dir
$dir_exec = sprintf("mkdir ".$data_dir);
exec ($dir_exec,$arr,$err1);
$_SESSION['sessDataDir'] = $data_dir;
// Here we make the user dynamic data dir
$dir_exec = sprintf("mkdir ".$data_dyn_dir);
exec ($dir_exec,$arr,$err1);
// Here we make the base data link
$dir_exec = sprintf("ln -s ".
$cwd."/../../base_data ".$data_base_dir);
exec ($dir_exec,$arr,$err1);
// Here we make the app data link
$dir_exec = sprintf("ln -s ".
$cwd."/../app_data ".$data_app_dir);
exec ($dir_exec,$arr,$err1);
}
// Finally we modify the data path of our map object
$oMap = $oApp->moMapSession->getMapObj();
$oMap->set("shapepath", $data_dir);

mapfile.map

# For base data items
DATA Political/counties.shp
becomes...
DATA base_data/Political/counties.shp
<code># For app specific data
DATA Marinezones/contiguous_us_eez.shp
becomes...
DATA app_data/Marinezones/contiguous_us_eez.shp
<code># For dynamic data
Most apps will just create a layer dynamically in Mapscript and point the data statement toward the dyn_data directory.

That is it. Pretty basic, but allows you to keep your data separated between base data all apps will use, application specific data, and data that is generated dynamically by users on the fly.

GIS Tool Use, GIS Tools

Web-GIS on the cheap…

October 23rd, 2006

OK, I have servers at work that I use daily to develop Mapserver/GDAL/OGR/GRASS/GMT/etc… based apps, but how about on a shared hosting environment?

Well, I finally got it going. I have written up my install instructions for Mapserver/GDAL/OGR/Proj/Postgres/Postgis/Geos/GMT/GRASS on Dreamhost, a debian based shared hosting service. The great thing about it…

1) It cost $9.95/month (1 year contract) *12 = $119.40

2) You can use a discount code to get $97 off… Total cost at sign-up = $119.40-$97 = $22.40

UPDATE (12/09/06): I just created a propmo code that gives the FULL discount to you… Nothing to me.  It is ZPULLEYFULL , enjoy!

3) Add a domain for $9.95 and the first year of this site cost $32.35 … WOW

With this package I get 200 Gigs of space (grows weekely!) and 1 Terabyte of bandwidth/month (grows weekly!).

So what good is it if I cant do some mapping work with it? Well, I have posted notes how I was able to get a fully functional Mapserver/PostGIS environment up. I went as far as to get command line GRASS installed to do geo-processing sans the GUI. GMT installed like a breeze, and bammmm… a GIS work environment.

Cant beat the rent ;-)

Check out some demo’s running on the server:

1) ka-map

2) GMT

pretzel:~/usr/local/src/gmt/GMT4.1.2/examples> ./do_examples.csh
Doing example 01…done
Doing example 02…done
Doing example 03…done
Doing example 04…done
Doing example 05…done
Doing example 06…done
Doing example 07…done
Doing example 08…done
Doing example 09…done
Doing example 10…done
Doing example 11…done
Doing example 12…done
Doing example 13…done
Doing example 14…done
Doing example 15…done
Doing example 16…done
Doing example 17…done
Doing example 18…done
Doing example 19…done
Doing example 20…done
Doing example 21…done
Doing example 22…done
Doing example 23…done
Doing example 24…done
Doing example 25…done
Completed all examples
pretzel:~/usr/local/src/gmt/GMT4.1.2/examples>

Check out the Output Images

3) GRASS

IMPORT ——>

GRASS 6.1.cvs > r.in.gdal input=world-topo-bathy-97_32_84_24.tif output=bmng_grass location=blue_marble
A datum name wgs84 (WGS_1984) was specified without transformation parameters.
Note that the GRASS default for wgs84 is towgs84=0.000,0.000,0.000.
100%
CREATING SUPPORT FILES FOR bmng_grass.red
SETTING GREY COLOR TABLE FOR bmng_grass.red (8bit, full range)
100%
CREATING SUPPORT FILES FOR bmng_grass.green
SETTING GREY COLOR TABLE FOR bmng_grass.green (8bit, full range)
100%
CREATING SUPPORT FILES FOR bmng_grass.blue
SETTING GREY COLOR TABLE FOR bmng_grass.blue (8bit, full range)
r.in.gdal complete.
Mapset in Location
GRASS 6.1.cvs>

VERIFY ——->

Welcome to GRASS 6.1.cvs (2006)
GRASS homepage: http://grass.itc.it/
This version running thru: TC Shell (/usr/bin/tcsh)
Help is available with the command: g.manual -i
See the licence terms with: g.version -c
Start the graphical user interface with: gis.m &
When ready to quit enter: exit
Mapset in Location GRASS 6.1.cvs > g.list type=rast
----------------------------------------------
raster files available in mapset PERMANENT:
bmng_grass.blue bmng_grass.green bmng_grass.red

----------------------------------------------
Mapset in Location GRASS 6.1.cvs>

Thats it for now… Up and running!!!!!!

GIS Tool Install

Working toward publishing presentations and papers

October 23rd, 2006

Started to work this evening to organize all of the papers and presentations I have done in the last couple of years dealing with Open Source GIS. I will be adding more as I clean things up and fill in the blanks.

Here is a link to the Presentations and Papers

Conferences, General, OSGeo, Uncategorized