Opened 20 years ago

Closed 20 years ago

#704 closed defect (invalid)

getShape does not work with Postgis Layer

Reported by: leonardo@… Owned by: dblasby@…
Priority: high Milestone:
Component: PostGIS Interface Version: 4.2
Severity: normal Keywords:
Cc: dblasby@…

Description

Hi, 

There seems to be a problem with getShape().  When the member function getShape
() is called in a postgis layer, it returns an empty shape object. If the data 
source of the layer is a shapefile, it works fine.In this situation, the first 
arg  (tile index) is -1 and the shapeindex (the oid) is correct.


-----------------                        
The php code:

                        $edificiosLayer->open();
			$shapeSelect = ms_newShapeObj(MS_POLYGON);
			$shapeSelect=$edificiosLayer->getShape($resultObj-
>tileindex,$resultObj->shapeindex);
			$edificiosLayer->close();

			$shape_chave=$shapeSelect->values['CHAVE'];
--------------
The layer in the mapfile:
LAYER # polygon 
  NAME         almeirim_edificios
   
 STATUS        DEFAULT
 TYPE         POLYGON
  
    
 CONNECTIONTYPE postgis
 CONNECTION "user=nobody dbname=almeirim_geo host=localhost"
 DATA "the_geom from almeirim_edificios_table"
  
   
  HEADER    'querytemplates/edificios_header.html'
  FOOTER    'querytemplates/edificios_footer.html'   
  
  CLASS    
    name "Edificios"	        
    COLOR      100 100 190     
    TEMPLATE  'querytemplates/edificios_query.html'    
    OUTLINECOLOR 0 0 0
  END
  
   
END #  layer 
-------------

Change History (6)

comment:1 by dmorissette, 20 years ago

Cc: dblasby@… pramsey@… added
Component: MapScript-PHPPostGIS Interface
Summary: getShape does not work with Postgis Layer getShape does not work with Postgis Layer
PHP MapScript doesn't do anything special in getShape(): it just passes control
to the lower-level code, so I am moving this bug to the PostGIS component.

Leonardo, are you using version 4.2 of MapServer? If not then can you please try
again with version 4.2.0.

Paul, Dave: can you comment on this?  Any idea what could be happening?

comment:2 by dblasby@…, 20 years ago

Does querying work with your layer?  Are you using the latest CVS and 
postgresql 7.3 (or 7.4)?

There is no special handling for getShape() - it uses exactly the same 
functions as querying.

I'll take a closer look at the getShape() function tomorrow and see what its 
doing.

comment:3 by dblasby@…, 20 years ago

I checked the code this morning - it is just calling the normal query 
functions.  Try turning debug on in your layer and see what it says.  

It should spit out an SQL statement.  See what results you get when you execute 
it.

comment:4 by dmorissette, 20 years ago

Cc: mapserver-bugs@… added
Owner: changed from mapserverbugs to dblasby@…

comment:5 by leonardo@…, 20 years ago

Sorry, there is any bug, it was my error.
First I had a misconfiguration in the database and then I did index the value 
with the wrong case (the postgis script changed the case of the shape 
attributes to lower case). Some fprintf's solved the question.
The getShape function as well as the querying are working well now.  




comment:6 by dmorissette, 20 years ago

Resolution: invalid
Status: newclosed
Let's mark this INVALID then.
Note: See TracTickets for help on using tickets.