On Mon, 27 Sep 2004, Carlos Sanchez wrote:

> Any way to get the map at http://wms.asemantics.com with links?

> > http://wms.asemantics.com/asf/?styles=emotions&VERSION=1.1.0&y
> &layers=rawworld,comloc&width=600&height=300&request=getMap&format=png&bbox=
> 0,40,-15,45

I guess we should make a page;' the options for layers are

        rawall2520 rawbluemask rawclouds rawday rawdeepblue rawetopo5 rawgg 
rawmap
        rawnight rawnl rawpol rawsw rawveg rawworld rawxerox

Options for styles are emotions, icbm, bluedot, dot, scope, labels, no
lables, etc..

So you can just put it into any HTML. Below is a small bit of perl you can
run to zoom in or out.

Dw


#!/usr/bin/perl
my ($x,$y,$dx,$dy)=();

my ($x0,$y0,$x1,$y1)=(-180,-90,180,90);
my $W=460,$H=230;
my $f=0.5; #Zoom factor
my $F=0.25; #Zoom factor
my @bg=("rawbluemask","rawetopo5","rawworld");
my @_bg=("mask","dem","map");
my @s=('bluedot','','emotions','dot');
my @_s=('disk','marker','lightbulb','dot');
my $online = 1;
my $dset = 'asemantics';
my $layer = 'offices';
my $host = 'http://demo.asemantics.com/wms/'.$dset.'/';
my $root = '';
if ($ENV{HTTP_HOST} =~ m/\.local/) {
        $dset = 'polyers';
        $layer = 'polyrdf';
        $host='/demo/wms-real/'.$dset.'/' ;
        $root='/demo/';
        @bg=("rawbluemask","rawveg","rawpol");
        @_bg=("mask","vegetation","political");
        # $online = 0;
};

($x0,$y0,$x1,$y1)=($1,$2,$3,$4)
        if $ENV{PATH_INFO} =~
        m/([\d\+\-.]+),([\d\+\-.]+),([\d\+\-.]+),([\d\+\-.]+)/;

my $bg = 0;
$bg = $1
        if $ENV{PATH_INFO} =~ m/bg=(\d+)/;

my $s = 0;
$s = $1
        if $ENV{PATH_INFO} =~ m/s=(\d+)/;

if ($ENV{QUERY_STRING} =~ m/(-?\d+),(-?\d+)/) {
        ($x,$y)=($1,$2);
        # Work out where the click roughly was
        my $rx = $x / $W;
        my $ry = $y / $H;

        # On negatives - zoom out.
        if ($x<0 && $y<0) {
                $dy = ($y1-$y0)/$f;
                $x = $W/2;
                $y = $H/2;
        }
        # Pan if near an edge
        elsif (($rx<0.15 || $rx > 0.85 || $ry<0.15 || $ry > 0.85)) {
                $dy = ($y1-$y0);
                $w='pan';
        # Zoom in very quickly if near the center
        } elsif ($rx> 0.45 && $rx < 0.55 && $ry>0.45 && $ry < 0.55) {
                $dy = ($y1-$y0)*$F;
                $w='Zoom';
        # Otherwise Zoom in slower.
        } else {
                $dy = ($y1-$y0)*$f;
                $w='zoom';
        };
        $dx = $dy * 2; # ($x1-$x0)*$f;

        $y=$H-$y;
        $x=$x0+ $x*($x1-$x0)/$W;
        $y=$y0+ $y*($y1-$y0)/$H;

        $x0 = $x - $dx/2;
        $x0 = -180 if $x0 < -180;
        $x1 = $x0 + $dx;
        if ($x1>180) {
                $x1 = 180;
                $x0 = $x1 - $dx;
        };
        $y0 = $y - $dy/2;
        $y0 = -90 if $y0 < -90;
        $y1 = $y0 + $dy;
        if ($y1>90) {
                $y1 = 90;
                $y0 = $y1 - $dy;
        };
} else {
        $w = '';
}

if (($y1-$y0 < 10) and ($online)) {
        push @bg,'mapblast';
        push @_bg,'mapblast';
}


my $cc="%0.2f";
$cc="%0.3f" if ($y1-$y0)<0.1;
$cc="%0.4f" if ($y1-$y0)<0.01;
$cc="%0.8f" if ($y1-$y0)<0.001;

foreach($x,$y,$x0,$y0,$x1,$y1) { $_=sprintf("$cc",$_); };

my $sn=$s[ $s ];
my $bgn=$bg[ $bg ];
my $bbox="$x0,$y0,$x1,$y1";

my $c='';
$c=" - - Last click at [$x,$y]" if $x != 0 || $y != 0;

print <<"EOM";
Content-type: text/html

<center>
<font color="grey">- this is the web :: just click -</font>
<p>
<a href="$root/zoom.pl/bbox=$bbox/s=$s/bg=$bg/"><img
src="$host?styles=$sn&VERSION=1.1.0&REQUEST=GETMAP&WIDTH=$W&HEIGHT=$H&TRANSPARENT=TRUE&LAYERS=$bgn,$layer&BBOX=$bbox&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/png"
ismap border=0 width=$W height=$H></a>
<br>
<font color=gray size=-2>Shown: [$bbox] $c</font>
<p>
Controls::
EOM

if ($bbox ne '-180.00,-90.00,180.00,90.00') {
print <<"EOM";
<a href="$root/zoom.pl">reset</a>
|
<a href="$root/zoom.pl/bg=$bg/s=$s/$bbox?-1,-1">zoomout</a>
|
EOM
} else {
        print "reset | zoomout |";
};

foreach(0 .. $#bg) {
        if ($_ == $bg) {
                print "$_bg[$_]";
        } else {
                print "<a
href='$root/zoom.pl/bg=$_/s=$s/$bbox'>$_bg[$_]</a> ";
        };
        print " ";
};

print "|";

foreach(0 .. $#s) {
        if ($_ == $s) {
                print "$_s[$_]";
        } else {
                print "<a
href='$root/zoom.pl/bg=$bg/s=$_/$bbox'>$_s[$_]</a>";
        };
        print " ";
};

print <<"EOM";
|
<a href="http://www.asemantics.com/showcase/show.html";>done</a>
<p>
<i>You propably want to download a real client<br>
like <a href="http://www.mancke-software.de/wmsClient/";>this java
wmsClient</a>
so that you can experiment with<br>
 different layers, styles and overlays.
<p>
<pre>



<font color="grey" size=-3>
____
&copy; 2003 - Asemantics S.R.L. - contact: [EMAIL PROTECTED]
</pre>
</center>

EOM

# map { print "<li>$_<br>$ENV{$_}"; } keys %ENV;
# printf("R1=%f  R2=%f\n",$W/$H, ($x1-$x0)/($y1-$y0));

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to