<P><BR>hi Mark,<BR><BR>I don't believe that sql server is the problem.<BR><BR>Rather these 2 code snips:<BR><BR><script><BR>function zoomToExt ent(box) {<BR>   box_array = box.split(" ");<BR>   minx = box_array[0]*1;<BR>   miny = box_array[1]*1;<BR>   maxx = box_array[2]*1;<BR>   maxy = box_array[3]*1;<BR>   width = (maxx - minx) + 200;<BR>   height = maxy - miny;<BR>   centerx = minx + (width / 2.0);<BR>   centery = miny + (height / 2.0);<BR>  lonlatPt = map.mcsToLonLat(centerx, centery);<BR>  lon = lonlatPt.getX();<BR>   lat = lonlatPt.getY();<BR>   map.zoomWidth(lat, lon, width, 'FT');<BR>}<BR></script></P> <P>***********************************************************************************</P> <P>               
<td><BR>                  <a href="#" onClick="zoomToExtent('<%=tan%>');return false;"><BR>                  <font size="-1"><%=incidentlocation%></font><BR>                  </a><BR>                 </td><BR><BR><BR>First of all, I am getting an error on the following lines:<BR><BR>  lonlatPt = map.mcsToLonLat(centerx, centery);<BR>  lon = lonlatPt.getX();<BR>   lat = lonlatPt.getY();<BR>   map.zoomWidth(lat, lon, width, 'FT');<BR><BR>If  I remove them, then the following don't do anything at
all:<BR><BR><BR>                <td><BR>                  <a href="#" onClick="zoomToExtent('<%=tan%>');return false;"><BR>                  <font size="-1"><%=incidentlocation%></font><BR>                  </a><BR>                 </td><BR><BR><BR>Not sure what I am doing wrong here.<BR><BR><BR><BR><BR><BR>-----Original message-----<BR>From: "Mark Cave-Ayland" m.cave-ayland@webbased.co.uk<BR>Date: Thu, 25 May 2006 10:49:21 -0400<BR>To: "'PostGIS Users Discussion'" postgis-users@postgis.refractions.net<BR>Subject: RE: [postgis-users]
displaying a specific extent of the map<BR><BR>> PostGIS is a spatial extension for PostgreSQL (http://www.postgresql.org<BR>> <HTTP: www.postgresql.org />) rather than MS-SQL Server. I'd suggest you<BR>> need to ask on either an MS-SQL or an ASP/Javascript coding site for help,<BR>> but without more information it's impossible to determine exactly what the<BR>> problem you're experiencing is.<BR>> <BR>> <BR>> <BR>> <BR>> <BR>> Kind regards,<BR>> <BR>> <BR>> <BR>> Mark.<BR>> <BR>> ------------------------<BR>> WebBased Ltd<BR>> 17 Research Way<BR>> Plymouth<BR>> PL6 8BT<BR>> <BR>> T: +44 (0)1752 797131<BR>> F: +44 (0)1752 791023<BR>> <BR>> http://www.webbased.co.uk <BR>> http://www.infomapper.com<BR>> http://www.swtc.co.uk <BR>> <BR>> This email and any attachments are confidential to the intended recipient<BR>> and may also be privileged. If you are not the intended recipient please<BR>>
delete it from your system and notify the sender. You should not copy it or<BR>> use it for any purpose nor disclose or distribute its contents to any other<BR>> person.<BR>> <BR>> _____ <BR>> <BR>> From: postgis-users-bounces@postgis.refractions.net<BR>> [mailto:postgis-users-bounces@postgis.refractions.net] On Behalf Of simflex<BR>> Sent: 25 May 2006 14:16<BR>> To: postgis-users@postgis.refractions.net<BR>> Subject: [postgis-users] displaying a specific extent of the map<BR>> <BR>> <BR>> <BR>> Greetings all,<BR>> <BR>> First time user of this forum.<BR>> <BR>> We use a sql server db to store data including x, y values. and using ASP on<BR>> the front end to retrieve data<BR>> <BR>> Currently, we are do have a summary report laid out thus:<BR>> <BR>> incident id first name last name incident type, incident location<BR>> <BR>> 1 John Doe vehicular amber<BR>> street<BR>> ...<BR>> ...<BR>> <BR>>
Our issue arises because we want to be able to click on incident id to zoom<BR>> directly to the extent of the map where the incident occurred.<BR>> <BR>> so far, we are struggling with this. any ideas would greatly appreciated.<BR>> <BR>> Here is what we have got so far:<BR>> <BR>> <BR>> <SCRIPT><br>> function zoomToExt ent(box) {<br>>    box_array = box.split(" ");<br>>    minx = box_array[0]*1;<br>>    miny = box_array[1]*1;<br>>    maxx = box_array[2]*1;<br>>    maxy = box_array[3]*1;<br>>    width = (maxx - minx) + 200;<br>>    height = maxy - miny;<br>>    centerx = minx + (width / 2.0);<br>>    centery = miny + (height / 2.0);<br>>   lonlatPt = map.mcsToLonLat(centerx, centery);<br>>   lon = lonlatPt.getX();<br>>    lat = lonlatPt.getY();<br>>    map.zoomWidth(lat, lon, width, 'FT');<br>> }<br>> </SCRIPT>  <BR>> <%<br>> <br>> Set cn=Server.CreateObject("ADODB.Connection")<br>> nID = Request("RecordID")<br>> 'response.write nID<br>> 'response.end<br>>
<br>> cn.Open "Driver={SQL Server};" & _<br>>            "Server=haoi;" & _<br>>            "Address=haoi,1433;" & _<br>>            "Network=DBMSSOCN;" & _<br>>            "Database=incidentsDB;" & _<br>>            "Uid=sa;" & _<br>>            "Pwd="<br>> <br>> SQL = "select incident_LOC, id,minlat,minlon,maxlat,maxlon from Incidents<br>> where id =" & nID<br>> Set rs = cn.Execute( SQL )<br>> 'response.write SQL<br>> 'response.end<br>> %><BR>> </P> <DIV align=center><BR>>  <TABLE><BR>> <%<br>> cnt = 0<br>> Do Until cur.EOF<br>>     cnt = cnt + 1<br>>     incidentlocation = cur(0).Value<br>>  recnum = CLng(cur(1).Value)<br>>     ileft = CLng(cur(2).value) - 250<br>>     ibottom = CLng(cur(3).Value) - 250<br>>     iright = CLng(cur(4).Value) + 250<br>>     itop = CLng(cur(5).Value) + 250<br>> <br>>     ; tan = ileft & " " & ibottom & " " & iright & " " & itop<br>> <br>> %> <TBODY> <TR><BR>>  <TD><BR>> <A onclick="zoomToExtent('<%=tan%>');return<br>> false;"
href="#"><BR>> <FONT size=-1><%=incidentlocation%></FONT><BR>> </A><BR>> </TD><BR>> </TR><BR>> <%<br>>        cur.MoveNext<br>>    Loop<br>>    %><BR>> </TBODY></TABLE><BR>> <%<br>> if cnt = 0 Then<br>> %><BR>>  <CENTER><B>No results</CENTER><BR>> <%<br>> End If<br>> rs.Close()<br>> cn.Close()<br>> %><BR>> <BR>> <BR></B></DIV>