[GRASSLIST:6435] Re: Database link to jpeg images
Jachym Cepicky
jachym.cepicky at centrum.cz
Tue Apr 12 12:28:01 EDT 2005
hullo,
On Tue, Apr 12, 2005 at 07:00:20AM -0700, RAVI KUMAR wrote:
> Dear all
>
> 1. I have a site database of fossils.
> 2. The database is attached to PgSql.
> On querying on the vector in the DM i get a form explaining
> the Genus, Spesies, location of sampl etc.. FINE
> 3. But now as they are fossils. The collection of digital photos
> on the computer as jpeg images, should be also displayed
> when I query the site.
>
> HOW TO LINK THE PgSql database to show the jpeg image of the fossil
> along with the query form, or in another monitor (screen), while U R still in GRASS.
>
you can save the images direct in the database or (better and easyer) you can
save them somewhere on your disk.
then you have to write some script or do it manualy. The command should look
somehow like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/sh
img_dir="path/to/your/image/directory/
for img in `d.what.vect -t your_vector |grep img_column | sed -e s/img_column\ :\ //`; do
display $img_dir/$img;
done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if you want something better, you should look at
http://grass.itc.it/grass60/manuals/html60_user/g.parser.html
where it is described, how to write your own grass-script with all the stuff
(help message, gui, etc.) arround..
all right, it should be something like:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/sh
# showimages.sh
# (c) jachym cepicky 2005
# copyright: This program is free software under the GNU General Public
# License (>=v2).
#%Module
#% description: show me the image related to this vector
#%End
#%option
#% key: vector
#% type: string
#% description: vector file to be quered
#% required : yes
#%end
#%option
#% key: imgcolumn
#% type: string
#% description: column from database, where the file names are stored
#% required : yes
#%end
#%option
#% key: directory
#% type: string
#% description: directory, where the images are stored
#% required : no
#% answer: .
#%end
if [ "$1" != "@ARGS_PARSED@" ] ; then
exec $GISBASE/etc/bin/cmd/g.parser "$0" "$@"
fi
cd $GIS_OPT_directory;
for img in `d.what.vect -t $GIS_OPT_vector |grep $GIS_OPT_imgcolumn | sed -e s/$GIS_OPT_imgcolumn\ :\ //`; do
echo "Displaying image $img";
display $img;
done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUT, I didn't tested it!!!!
Enjoy, hope it helps
Jachym
--
Jachym Cepicky
e-mail: jachym.cepicky at centrum.cz
URL: http://les-ejk.cz
GPG: http://www.fle.czu.cz/~jachym/gnupg_public_key/
More information about the grass-user
mailing list