[mapserver-users] RE: Extents

Jay Kapalczynski jkapalczynski at ci.maple-grove.mn.us
Fri Oct 9 16:11:50 EDT 2009


I am plotting an XY coordinate in my map using an OVF file to hit the MySQL database.

I then have a button that calls a .js page and refreshes the layer...

As the XY changes in the database it appears to be tracking in the map



I want to take this one step further and test the recently plotted XY to see if it s in the current extent.  If not then recenter.



PART 1



BUITTON:  Calls the .js page sets an interval and refreshes the layer "Database"

<service name="refreshLayers3" title="Refresh Layer every 2 Seconds" type="internal" default="true" locked="true" command="setIntervalNow()" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>



.js PAGE:

//setIntervalNow();



var varTest = -1;



function setIntervalNow()

{

 varTest = setInterval("setIntervalNow2()", 3000);

}



function setIntervalNow2()

{

 Events.triggerEvent('refreshlayer', 'Database');

}





PART 2

What I want to do is grab the current XY and test to see if its in the current extent

If not then create another extent and zoom to it.

Right now I am having a hard time trying to join the two parts.



For this part I am launching the code from the Identify button which calls an Ajax page and passes the Extent to a PHP page



<tr>

<td align="center" width='100'>Tracking Testing:</td>

 <td style= "cursor:pointer" align="center" onclick="javascript:getnewresults('XY_MapRecenter.php','[imgext]','[miny]','[maxx]','[maxy]')"><font size='2' color='#007FFF' >Open Images</font></td>

</tr>



I can get test and make the new Extent but can only return the values to a tab and then fire it off from a button....what I want to do is have this done automatically...

I don't know how I can do this...



Thanks







-----Original Message-----
From: Steve Lime [mailto:Steve.Lime at dnr.state.mn.us]
Sent: Friday, October 09, 2009 2:23 PM
To: Jay Kapalczynski; 'mapserver-users at lists.osgeo.org'
Subject: RE: [mapserver-users] RE: Extents



Still confused on what you're trying to do. It sounds like your PHP code is hitting the database to

get the xy's. You could poll that PHP page as necessary via AJAX and have it return the xy data

as JSON. Then you use the JSON data accordingly to control GeoMoose by zooming to a point or

whatever. I don't know if GeoMoose provides AJAX wrappers or not, that's a question for that

another mailing list...



Steve



>>> On 10/6/2009 at 1:33 PM, in message

<D7A5EAC385604446AB1DD24BF4F5A918A00826AABB at MG-Mail.ci.maple-grove.mn.us>, Jay

Kapalczynski <jkapalczynski at ci.maple-grove.mn.us> wrote:

> I am using GeoMOOSE if that sheds new light on this...

>

> What I am trying to do is click a button.

> This calls a js page that runs some code every few seconds. Right now its

> simply refreshing a specific layer.

> I want the code to grab the extent of the current map

> I then use an XY to recreate a new extent.

> Then zoom to that extent.

>

> I am getting the XY from a database.  Testing to see if within current

> extent.

> If not I want it to recenter (zoom to new extent I calculated)

>

> Currently I am doing this in php...the only thing is that I cant figure out

> how to get the app to recenter from PHP.

>

> I can do it from a button (see below) but I need it to work automatically

>

> <h5 style="margin:0px; padding:0px;"><b>Zoom to View String:</b> <a

> href="javascript:Map.zoomToViewString(453633.29 + ',' + 4984898.68 + ',' +

> 464278.99 + ',' + 4995544.38)"><img src="shared/images/view.png" border="0"

> title="Click to Zoom Map to PID"></a>

>

> I have everything I need ( I think ) but need to figure out how to get the

> js page to retireve the extent, then I can fire to above off in javascript.

>

> That make sense....

>

> Thanks for your thoughts Steve...

>

>

> -----Original Message-----

> From: Steve Lime [mailto:Steve.Lime at dnr.state.mn.us]

> Sent: Tuesday, October 06, 2009 1:25 PM

> To: Jay Kapalczynski; 'mapserver-users at lists.osgeo.org'

> Subject: [mapserver-users] RE: Extents

>

> Why wouldn't you get the extent at the same time you get the map? You had to

> have one to retrieve

> it in the first place. -Steve

>

>>>> On 10/6/2009 at 1:17 PM, in message

> <D7A5EAC385604446AB1DD24BF4F5A918A00826AABA at MG-Mail.ci.maple-grove.mn.us>, Jay

> Kapalczynski <jkapalczynski at ci.maple-grove.mn.us> wrote:

>> Can I call or make a request from a .js page to get the extent of my map?

>>

>>

>> From: Jay Kapalczynski

>> Sent: Tuesday, October 06, 2009 8:35 AM

>> To: mapserver-users at lists.osgeo.org

>> Subject: Extents

>>

>> I have a applications using MapServer.  I have a button that runs some code

>> on a .js page every few seconds.

>> What I need to do is somehow get the map extent to the .js page.

>>

>> Is it possible to write some javascript code to retrieve the maps extent

>> every few seconds?

>>

>> Thanks


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20091009/e88b7a3f/attachment-0001.html


More information about the mapserver-users mailing list