[maplab-users] Query Object on Map

Adriano Hantequeste Gomes adrianohg at gmail.com
Thu Jan 11 13:37:42 EST 2007


Hi All,


I put this code end my application.php:



// Adriano hantequeste Gomes - 11/jan/07
//
// Consulta Objeto
//
//

if ($http_form_vars["nome_b"])
         {
             $nombre = $http_form_vars["nome_b"];
             $oextent = $oMapSession->oMap->extent;
             $capa = $oMapSession->oMap->getLayerByname("Bairros");
			// ("Capa" is a Layer Object)
             $capa->queryByAttributes("NOME_BAIRR",$nome_b,MS_SINGLE);
             if ($capa->getNumResults() > 0)
             {
                 echo "Encontrou";
                 $oresult = $capa->getResult(0);
                  // oresult is a ResultCacheMemberObj
<http://mapserver.gis.umn.edu/doc42/phpmapscript-class-guide.html#result>

                 $capa->open();
                 $oshape =
				 $capa->getShape($oresult->tileindex,$oresult->shapeindex);
                 $oextent = $oshape->bounds;
                 $oshape->free();
                 //New Extent to show
                 $nminx = $oextent->minx - 300;
                 $nmaxx = $oextent->maxx + 300;
                 $nminy = $oextent->miny - 200;
                 $nmaxy = $oextent->maxy + 200; //  (My Map have a
extent = 600 x 400 pixels)
                 $oextent->setextent($nminx,$nminy,$nmaxx,$nmaxy);
       }

 $oMapNavigator->zoomRectangle($oextent->minx,$oextent->miny,$oextent->maxx,$oextent->maxy);

 }


#######################################

I put too this code in my Aplication_contents.php


<!------------------------->
<!-- CONSULTA BAIRRO   ---->
<!------------------------->
<form action="Geo.php" method="post">
Bairro: <input type="text" name="nome_b" />
<input type="submit" name="Submit" value="Ok" />
</form>
<!------------------------->
<!-- FIM CONSULTA BAIRRO -->
<!------------------------->

########################################

But retry this error when try search:


Warning: [MapServer Error]: msQueryByAttributes(): Requested layer has
no templates defined so is not queryable. in
D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line 825

Warning: [MapServer Error]: msFreeHashItems(): Can't free NULL table
in D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line 825

Warning: [MapServer Error]: msFreeHashItems(): Can't free NULL table
in D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line 825

Warning: [MapServer Error]: msInsertHashTable: Invalid hash table or
key in D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line
825

Warning: [MapServer Error]: msInsertHashTable: Invalid hash table or
key in D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line
825

Warning: [MapServer Error]: msInsertHashTable: Invalid hash table or
key in D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line
825

Warning: [MapServer Error]: msInsertHashTable: Invalid hash table or
key in D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line
825

Warning: [MapServer Error]: msInsertHashTable: Invalid hash table or
key in D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line
825

Warning: [MapServer Error]: msInsertHashTable: Invalid hash table or
key in D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\Geo.php on line
825

Fatal error: [MapServer Error]: msCalculateScale(): Invalid image
extent, minx=384426.000000, miny=7740866.107143, maxx=384426.000000,
maxy=7740866.107143. in
D:\ms4w\apps\maplab-2.2.1\projects\gmf_apps\Geo\wrapper\map_navigator.php
on line 341

-- 
Atenciosamente,
Adriano Hantequeste Gomes
CREA 080047648-4
Departamento de Geoprocessamento - GEO
Gerência de Estatística e Analise Criminal - GEAC
Secretaria de Estado da Segurança Pública e Defesa Social - SESP
Av. Marechal Mascarenhas de Moraes, 2355
Bento Ferreira - Vitória - Espírito Santo
CEP: 29.052-121
Telefone: 55 27 3334-4736
Fax:       55 27 3334-4735
Celular:   55 27 9225-4852



More information about the Maplab-users mailing list