If you aren't able to use Armin's solution, You can try this solution if you 
can use a particular feature in the map and you are using postgis and 
postgres tables:

<?php
if($_POST['Submit'])
{
$qry  = 'SELECT  xmin(box3d(the_geom)), ymin(box3d(the_geom)), 
xmax(box3d(the_geom)), ymax(box3d(the_geom)) from subdiv where SUBDIVNAME 
like \'' . strtoupper($_POST['subdiv']).'%\'';

$dbconn = pg_connect("host=localhost dbname=mydb user=myuser 
password=mypassword")
   or die('Could not connect: ' . pg_last_error());

$result = pg_query($qry) or die('Query failed: ' . pg_last_error());

$line = pg_fetch_array($result, null);

print  $line['xmin'] . '+' . $line['ymin'] . '+' . $line['xmax'] . '+' . 
$line['ymax'];
}
else
{
print <<<END
<form method='post' action='subgeom.php'>
Subdivion Name: <input type='text' name='subdiv'><br>
<input type='submit' name='Submit' value='Submit'>
</from>
END;
}
?>

I used this code to select the geometry of housing subdivisions so that some 
of my fellows could create links back to mapserver and I wouldn't have to do 
it for them.  You could use the geometry in your image map links or in 
javascript to pass to map.phtml, or as I've done as links in a select tag:

<select name='mysubdiv' 
onchange="window.location.href=this.options[this.selectedIndex].value">
<option> Subdivisions </option>
<option 
value='http://myserver.com/cgi-bin/mapserv?imgext=2460756.25+732970.6875+2465750.75+737314.8125&map=%2Fmaps%2Fexample%2Fdemo1.map&program=%2Fcgi-bin%2Fmapserv&img.x=250.0&img.y=200.0&zoomdir=1&zoomsize=2'>Two
 
Rivers</option>
<option 
value='http://myserver.com/cgi-bin/mapserv?imgext=2461069.5+695974.25+2462774.75+697804.0625&map=%2Fmaps%2Fexample%2Fdemo1.map&program=%2Fcgi-bin%2Fmapserv&img.x=250.0&img.y=200.0&zoomdir=1&zoomsize=2'>Soda
 
Springs</option>
</select>


The php code above could very easily take a very long list and be run in a 
loop outputting links that you want to use.

Remember too that all you really need to do to get retangles is to calculate 
how far apart the center of each of your tiles will be then run a loop that 
generates point coordinates for each point within your map's extents and 
then just do:

$map->zoompoint(-10, $mypoint, $map->width, $map->height, $ext);

In php or use javascript to call mapserver.js zoompoint (using the same 
trick with your image coordinates) or call map.phtml directly with the 
correct query string.

The nice thing about this solution is that you aren't tied to pmapper's 
display.  You get all of the advantages of pmapper, but you can also have a 
nice clean interface to mapserver for something like a public website and 
still use many of pmapper's features.

Just a suggestion.


--
Things are only difficult while you don't understand them.




>From: "Armin Burger" <armin.burger at gmx.net>
>To: "Dejan Gambin" <dejan.gambin at pula.hr>
>CC: pmapper-users at faunalia.it
>Subject: Re: [Pmapper-users] Dynamic map creation in pmapper
>Date: Thu, 18 May 2006 09:58:43 +0200 (MEST)
>
>why don't you just put all your hotspot tiffs into an image catalog
>(strangely called 'tileindex' in mapserver). And then use this tileindex
>shapefile for zooming to the desired initial extent, using the 
>functionality
>to start the application zoomed onto an initial extent (there was a posting
>2 days ago with regard to this function).
>
>this functionality requires currently pmapper version 1, it's not included
>in version 2 yet. Since you do not mention which one you are using (as at
>least half of all others on this list), I cannot say if this is then 
>working
>for you.
>
>armin
>
> > --- Urspr?ngliche Nachricht ---
> > Von: "Dejan Gambin" <dejan.gambin at pula.hr>
> > An: <pmapper-users at faunalia.it>
> > Betreff: [Pmapper-users] Dynamic map creation in pmapper
> > Datum: Wed, 17 May 2006 21:24:47 +0200
> >
> > Hi,
> >
> > I have an imagemap with 100 hotspot areas. Each hotspot is rectangular
> > area
> > represented by one tiff file (about 170MB in size including built-in
> > overviews). When user clicks on a hotspot the map with this area should 
>be
> > dsiplayed (maybe its neighbours too if this is not too complicated).
> >
> > So, I have generated the imagemap and the Javascript needed to open the
> > pmapper window with proper arguments on user click. But what about the 
>map
> > files? I wouldn't like to have to generate a hundred of map files. May I
> > create the map file dynamically? Where to put the code?
> >
> > thanks very much
> >
> > dejan
> >
> >
> > _______________________________________________
> > Pmapper-users mailing list
> > Pmapper-users at faunalia.it
> > http://faunalia.it/cgi-bin/mailman/listinfo/pmapper-users
> >
>
>--
>GMX Produkte empfehlen und ganz einfach Geld verdienen!
>Satte Provisionen f?r GMX Partner: http://www.gmx.net/de/go/partner
>
>_______________________________________________
>Pmapper-users mailing list
>Pmapper-users at faunalia.it
>http://faunalia.it/cgi-bin/mailman/listinfo/pmapper-users



Reply via email to