[Cartoweb-users] SOAP bbox request
Alex Kuznetsov
nexikan at gmail.com
Tue Jul 25 22:06:35 EDT 2006
We are working on a college MapServer project with CartoWeb... is a great
productive tool.
As a final task, we are trying to add functionality to search for an
individual parcel and zoom
to it on the map. We are able to retrieve the coordinates from our PostGIS
database but can't get
the SoapClient working and can't figure out how to integrate this function
with the rest of CartoWeb...
i.e. do we have to add/extend a plug-in?
Our third attempt is pasted below. Note the ERROR above the offending line.
Any help greatly appreciated
- Tony Bonnici, Alex Kusnetsov
-------------
<html>
<head><title>Parcel Locator</title>
</head>
<body>
<?php
$dbcon = pg_connect("dbname=webproj6 user=postgres host=localhost
password=postgres");
if ($dbcon == 0) die("connection to WebProj6 PostgreSQL DB failed");
$query = 'SELECT astext(envelope(the_geom)) FROM poly_parcel where GID =
5000' ;
$result = pg_query($query) or die('Query failed [' . $query . '] with
error: ' . pg_last_error());
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC))
{
foreach ($line as $col)
list($j1, $j2, $x1, $y1, $xj, $yj, $x2, $y2) = split('[( ,]', $col) ;
}
pg_free_result($result);
pg_close($dbcon);
$x1 -= $margin ;
$y1 -= $margin ;
$x2 += $margin ;
$y2 += $margin ;
// ERROR ON NEXT LINE: Warning: SoapClient::__construct() [
function.SoapClient---construct]:
// I/O warning : failed to load external entity "
http://localhost/cartoserver.wsdl.php?mapId=ybaranav1"
// in C:\wamp\www\cartoweb3\projects\ybaranav1\parloc2.php on line 41
$client = new SoapClient("
http://localhost/cartoserver.wsdl.php?mapId=ybaranav1");
$request->mapId = 'ybaranav1';
$request->imagesRequest->className = 'ImagesRequest';
$request->imagesRequest->mainmap->isDrawn = true;
$request->imagesRequest->mainmap->path = '';
$request->imagesRequest->mainmap->width = 500;
$request->imagesRequest->mainmap->height = 500;
$request->imagesRequest->mainmap->format = '';
$request->imagesRequest->keymap->isDrawn = true;
$request->imagesRequest->keymap->path = '';
$request->imagesRequest->keymap->width = 224;
$request->imagesRequest->keymap->height = 150;
$request->imagesRequest->keymap->format = '';
$request->imagesRequest->scalebar->isDrawn = true;
$request->imagesRequest->scalebar->path = '';
$request->imagesRequest->scalebar->width = 350;
$request->imagesRequest->scalebar->height = 3;
$request->imagesRequest->scalebar->format = '';
$request->layersRequest->className = 'LayersRequest';
$request->layersRequest->layerIds = array('Parcel','Buildings');
$request->layersRequest->resolution = null;
$request->locationRequest->className = 'LocationRequest';
$request->locationRequest->locationType = 'bboxLocationRequest';
$request->locationRequest->bboxLocationRequest->bbox->minx = $x1 ;
$request->locationRequest->bboxLocationRequest->bbox->miny = $y1 ;
$request->locationRequest->bboxLocationRequest->bbox->maxx = $x2 ;
$request->locationRequest->bboxLocationRequest->bbox->maxy = $y2 ;
try
{
$result = $client->getMap($request);
print_r($result);
}
catch (SoapFault $fault)
{
print $fault->faultstring;
}
?>
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060725/00f9086c/attachment.html
More information about the Cartoweb-users
mailing list