MapTools.org

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

Mike Leahy mgleahy@fes.uwaterloo.ca
Fri, 13 Jun 2003 12:48:58 -0500
Regarding this problem,

There is a post at
http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0207/msg00537.h
tml that indicates this problem can be solved by commenting out a line
in mapquery.c - and the example in the MapServer buglist is pretty much
the same problem I have...but considering the trouble I've gone through
just to compile postgis, I don't think I would have a great deal of luck
trying to compile MapServer & MapScript.  I don't suppose it would be
possible to get and up-to-date MapServer/MapScript w support for PostGIS
compiled with the fix described at the link above?

If not, I'll just continue working with the Multera-build of PostGIS...

Mike



-----Original Message-----
From: maplab-users-admin@dmsolutions.ca
[mailto:maplab-users-admin@dmsolutions.ca] On Behalf Of Mike Leahy
Sent: June 13, 2003 11:28 AM
To: maplab-users@dmsolutions.ca; postgis-users@postgis.refractions.net
Subject: [maplab-users] PostGIS 0.7.5 returning '0' for shape indexes

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
	}

_______________________________________________
Maplab-users mailing list
Maplab-users@dmsolutions.ca
http://lists.dmsolutions.ca/mailman/listinfo/maplab-users



This archive was generated by Pipermail.