[postgis-users] PostGIS 0.7.5 returning '0' for shape indexes

Mike Leahy mgleahy at fes.uwaterloo.ca
Fri Jun 13 09:27:52 PDT 2003


Now that I have PostGIS 0.7.5 running in the Cygwin environment, the
GMapFactory project I am using is able to display the layers that I have
loaded into the database without any trouble.  However, when I query the
layers, I get the following error from the PHP script:

Fatal error: Assertion failed, Could not set shape values: 0, 0 in
C:\edumap\www\Independencia\wrapper\map_query.php on line 530

Line 530 in this case is labelled below, in the processQuery function.
I think the problem here is that for some reason the query is returning
a bunch of shapes with 0 or null spatial index.  I tried making an if
statement that skips the code in the loop if the spatial index is not
greater than zero, and I just ended up with some other error (i.e.,
there were no results to be displayed).

I'm not sure if this is a problem with the GMapFactory project,
MapScript, or PostGIS.  It seems that for the time being, I'm going to
have to stick with the beta version of PostGIS.  I tried creating
indexes on the GID fields for the spatial tables, but that doesn't seem
to have any affect.

Any suggestions for this one?

Many thanks,
Mike

________________________________________________________________________
____

function processQuery( $oLayer )
	{
        // log entry
        $this->logFuncStart( LOG_VERBOSE, "processQuery() starting" );
		
		// create map object
		$oMap = $this->oSession->oMap;
		
		// initialize variables
		$axResults = array();
	
    	// get the number of results
    	$nNumResults = intval($oLayer->getNumResults());
		
		// return if no results
		if ( $nNumResults < 1 )
		{
          	// log exit
            $this->logFuncEnd( LOG_ALL, "processQuery() done" );
			return "No results found for
layer[".$oLayer->name."].";
		}
    	
		// open the layer to make the shape properties available
		if ( strpos( strtoupper( ms_GetVersion() ), "VERSION
3.6") > 0 )
    		$oLayer->open( $oMap->shapepath );
    	else 
    		$oLayer->open();

    	// add element to results array for each result row
	    for ($i=0; $i < $nNumResults; $i++)
    	{
            // get next shape row
            $oResult = $oLayer->getResult($i);
 Line 530:  $oShape = $oLayer->getShape($oResult->tileindex,
$oResult->shapeindex);
    
            // push the row array onto the results array
            $aTmp = $oShape->values;
            $aTmp = array_merge( $aTmp , 
                array("SHAPE_INDEX" => $oResult->shapeindex, 
                      "TILE_INDEX" => $oResult->tileindex, 
                      "LAYER_INDEX" => $oLayer->index ) );
			array_push( $axResults, $aTmp );
        
		// end for loop   
        }
	
        // close the layer
        $oLayer->close();
				
				$this->log( LOG_VERBOSE, "Results:
".implode($axResults));
	
      	// log exit
        $this->logFuncEnd( LOG_ALL, "processQuery() done" );	
		
		// return the array
		return $axResults;
	
	// end processQuery function
	}




More information about the postgis-users mailing list