[postgis-users] Fixed limits on text functions in PostGIS?

Bruce Rindahl rindahl at lrcwe.com
Tue Jun 19 08:55:44 PDT 2007


Damn I'm confused.  I now can't reproduce the error.  Yesterday my PHP query
was giving 0 for strlen.  Now it is working fine.  A snippet of code is:

$my_result_set = pg_Exec($my_pg_connect, $mySQL) or die (pg_ErrorMessage());

//get number of rows retrieved
$numRecs = pg_NumRows($my_result_set);
$i = 0;
while ($i < $numRecs) {
	$resultArray = pg_Fetch_Array($my_result_set, $i);

	$mySvgString = $resultArray['path'];
	//check if the returned element contains data
	if (strlen($mySvgString) > 0) {
		print "\t".'<path d="'.$mySvgString.'" />'."\n";
	}
	$i++;
}

Yesterday I was getting a clean record from the query (all the other
attributes) but strlen($mySvgString) was 0.  I did several checks, commented
out the if {} and it always was the same result - nothing in $mySvgString.
Now it is working perfectly.  I did nothing to the database last night - no
vacuums.

Sorry about the wild goose chase but thanks for all the help - I will keep
an eye on it.

Bruce Rindahl

-----Original Message-----
From: Michael Fuhr [mailto:mike at fuhr.org] 
Sent: Tuesday, June 19, 2007 4:56 AM
To: Bruce Rindahl
Cc: 'PostGIS Users Discussion'
Subject: Re: [postgis-users] Fixed limits on text functions in PostGIS?

On Mon, Jun 18, 2007 at 10:02:18PM -0600, Bruce Rindahl wrote:
> Apparently my issue is with PHP.  This is where I am getting null results
in
> the asSVG function.

Works here with PHP 5.2.3 and 5.2.2:

  $res = pg_query($conn, 'select assvg(the_geom) from floodplain6');
  while ($row = pg_fetch_assoc($res)) {
      echo 'isset   = ', isset($row['assvg']), "\n";
      echo 'empty   = ', empty($row['assvg']), "\n";
      echo 'is_null = ', is_null($row['assvg']), "\n";
      echo 'strlen  = ', strlen($row['assvg']), "\n";
  }
  pg_free_result($res);

I get the following output with both native PostgreSQL calls and
with PDO:

  isset   = 1
  empty   = 
  is_null = 
  strlen  = 114164

Can you provide a simple PHP script that demonstrates the problem
you're seeing?

-- 
Michael Fuhr






More information about the postgis-users mailing list