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

simflex simflex at millenniumhealthproducts.com
Fri May 26 05:49:50 PDT 2006


hi Mark,

I don't believe that sql server is the problem.

Rather these 2 code snips:


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');
}
 ***********************************************************************************                 
                  
                  
                  
                 


First of all, I am getting an error on the following lines:

  lonlatPt = map.mcsToLonLat(centerx, centery);
  lon = lonlatPt.getX();
   lat = lonlatPt.getY();
   map.zoomWidth(lat, lon, width, 'FT');

If  I remove them, then the following don't do anything at all:


                
                  
                  
                  
                 


Not sure what I am doing wrong here.





-----Original message-----
From: "Mark Cave-Ayland" m.cave-ayland at webbased.co.uk
Date: Thu, 25 May 2006 10:49:21 -0400
To: "'PostGIS Users Discussion'" postgis-users at postgis.refractions.net
Subject: RE: [postgis-users] displaying a specific extent of the map

> PostGIS is a spatial extension for PostgreSQL (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:
> 
> 
> 
> 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');
> }
>  
>  
> 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
> %>
>  
> 
>  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
> 
> %>  
> 
>  false;" href="#">
> 
> 
> 
> 
>     cur.MoveNext
>  Loop
>  %>
> 
>  if cnt = 0 Then
> %>
> No results
>  End If
> rs.Close()
> cn.Close()
> %>
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060526/197bb50d/attachment.html>


More information about the postgis-users mailing list