Attribute field missing when querying PostGIS DB using PHP/MapScript

Sebastian Albrecht albrecht at FIELAX.DE
Wed Apr 19 01:21:12 PDT 2006


Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: kundenserver.de abuse at kundenserver.de login:0d7df878e47e269a7b9683f17acbb849

Hello everybody,

when querying a PostGIS layer using PHP/Mapscript queryByRect and 
reading the selected shape using getShape the last attribute field of 
the layer is always missing in the values-Array of the shape.


This is my data string for PostGIS:

DATA "tree.position FROM
	(
	SELECT oid, position, size, age, observer, village
	FROM tree_data                             ^^^^^^^
	WHERE observer='albrecht'
	)
       AS tree USING srid=4326 USING UNIQUE oid"


The values-Array of the shape from query result (var_dump):

["values"]=>
   array(5) {
     ["oid"]=>
     string(8) "10209993"
     ["position"]=>
     string(50) "0101002020E6100100849ECDAACF541540718FA20F5DC44A40"
     ["size"]=>
     string(1) "5"
     ["age"]=>
     string(1) "3"
     ["observer"]=>
     string(8) "albrecht"

 >>>>> "village" field missing here :( <<<<<
   }


Using ethereal (network capture tool) I found out the database SQL 
request of MapServer is correct (including "village").

My current solution is to add one more field to the SQL line
 > SELECT oid, position, size, age, observer, village, ' ' AS dummy
so the missing field is "dummy" and not "village".

Is that behaviour known and is there an explanation for the problem?

Best regards,

Sebastian


-- 
----------------------------------------------------------------
FIELAX Gesellschaft fuer wissenschaftliche Datenverarbeitung mbH
Schifferstr. 10-14, 27568 Bremerhaven, GERMANY

Sebastian Albrecht

Phone:    +49 (0)471 30015-16
Fax:      +49 (0)471 30015-22
EMail:    albrecht at fielax.de
----------------------------------------------------------------



More information about the MapServer-users mailing list