[postgis-users] displaying a specific extent of the map

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Thu May 25 07:49:07 PDT 2006


PostGIS is a spatial extension for PostgreSQL (http://www.postgresql.org
<http://www.postgresql.org/> ) rather than MS-SQL Server. I'd suggest you
need to ask on either an MS-SQL or an ASP/Javascript coding site for help,
but without more information it's impossible to determine exactly what the
problem you're experiencing is.

 

 

Kind regards,

 

Mark.

------------------------
WebBased Ltd
17 Research Way
Plymouth
PL6 8BT

T: +44 (0)1752 797131
F: +44 (0)1752 791023

http://www.webbased.co.uk  
http://www.infomapper.com
http://www.swtc.co.uk 

This email and any attachments are confidential to the intended recipient
and may also be privileged. If you are not the intended recipient please
delete it from your system and notify the sender. You should not copy it or
use it for any purpose nor disclose or distribute its contents to any other
person.

  _____  

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of simflex
Sent: 25 May 2006 14:16
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] displaying a specific extent of the map

 

Greetings all,

First time user of this forum.

We use a sql server db to store data including x, y values. and using ASP on
the front end to retrieve data

Currently, we are do have a summary report laid out thus:

incident id   first name     last name  incident type, incident location

1                John           Doe            vehicular          amber
street
...
...

Our issue arises because we want to be able to click on incident id to zoom
directly to the extent of the map where the incident occurred.

so far, we are struggling with this. any ideas would greatly appreciated.

Here is what we have got so far:


<script>
function zoomToExt ent(box) {
   box_array = box.split(" ");
   minx = box_array[0]*1;
   miny = box_array[1]*1;
   maxx = box_array[2]*1;
   maxy = box_array[3]*1;
   width = (maxx - minx) + 200;
   height = maxy - miny;
   centerx = minx + (width / 2.0);
   centery = miny + (height / 2.0);
  lonlatPt = map.mcsToLonLat(centerx, centery);
  lon = lonlatPt.getX();
   lat = lonlatPt.getY();
   map.zoomWidth(lat, lon, width, 'FT');
}
</script>
<%

Set cn=Server.CreateObject("ADODB.Connection")
nID = Request("RecordID")
'response.write nID
'response.end

cn.Open "Driver={SQL Server};" & _
           "Server=haoi;" & _
           "Address=haoi,1433;" & _
           "Network=DBMSSOCN;" & _
           "Database=incidentsDB;" & _
           "Uid=sa;" & _
           "Pwd="

SQL = "select incident_LOC, id,minlat,minlon,maxlat,maxlon from Incidents
where id =" & nID
Set rs = cn.Execute( SQL )
'response.write SQL
'response.end
%>
<div align="center">
<table>
<%
cnt = 0
Do Until cur.EOF
    cnt = cnt + 1
    incidentlocation = cur(0).Value
 recnum = CLng(cur(1).Value)
    ileft = CLng(cur(2).value) - 250
    ibottom = CLng(cur(3).Value) - 250
    iright = CLng(cur(4).Value) + 250
    itop = CLng(cur(5).Value) + 250

    ; tan = ileft & " " & ibottom & " " & iright & " " & itop

%>             <tr>
                <td>
                  <a href="#" onClick="zoomToExtent('<%=tan%>');return
false;">
                  <font size="-1"><%=incidentlocation%></font>
                  </a>
                 </td>
                </tr>
   <%
       cur.MoveNext
   Loop
   %>
   </table>
<%
if cnt = 0 Then
%>
    <Center><B>No results</center>
<%
End If
rs.Close()
cn.Close()
%>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060525/f9fdf779/attachment.html>


More information about the postgis-users mailing list