[postgis-users] Distance function - problem when no data found
strk
strk at keybit.net
Thu Aug 5 12:39:13 PDT 2004
You have a problem with perl, not postgis nor postgresql.
I'm not a perl expert, but I suppose the qq(something) does
not like something containing ')' (and probably '(' as well).
Run perl with the -w switch to see if it gives you warnings.
--strk;
On Thu, Aug 05, 2004 at 03:08:29PM -0400, Tom Melhuish wrote:
> I haven't received any feedback on my previous notes regarding this
> problem, so I updated my system to the latest version levels and still
> get the same error messages:
>
> Postgis 0.8.2, Postgresql 7.4.3, DBI 1.43, DBD_pg 1.32, RH 9.0
>
>
>
> I'm executing the following Postgis SQL command and if I select the
> spatial object within the distance the command works, but I get the
> following error message in the Postgresql log:
>
> ERROR: cursor "mycursor" does not exist
>
>
>
> When I select the spatial object out side and no data is found the
> command fails and I get the following in the Postgresql log file.
>
> ERROR: syntax error at or near ")" at character 144
>
> LOG: could not send data to client: Connection reset by peer
>
> LOG: could not send data to client: Broken pipe
>
> LOG: unexpected EOF on client connection
>
> The Apache log gives me:
>
> Premature end of script headers:
>
>
>
>
>
> If I copy either SQLcommand and execute it in psql it runs fine. With
> no error messages in the postgresql log file. I also have this same
> command in PostGis 0.7.4 and postgresql 7.3.2 and it works fine.
>
>
>
> Please let me know if I need to provide any other information to help
> debug the program.
>
>
>
> This is a very common PostGis command and was curious if anybody else is
> getting an empty array back if no items are found within the circular
> boundary with no errors in the logfile?
>
>
>
> Below is the code snippet
>
> ++++++++++++++++++++++++++++++++++++++++
>
> $SQLcommand=qq(SELECT layer, ncpin, mapsheet, ownername, addr1, addr2,
> addr3, city, state, zip, book, page, value, acreage, pflag, revalue,
> market FROM jccondo WHERE the_geom &&
> GeometryFromText('BOX3D(2103178.38307993 558215.2516,2173267.36692007
> 611928.4437)',1) AND Distance(GeometryFromText('POINT(2170383.04659743
> 579103.715194444)',1),the_geom) < 1401.77967680279);
>
>
>
> eval {
>
> my $stmt = $dbh->prepare($SQLcommand) || &AppletMsg("The table name
> doesn't exist or one of the attribute names are not valid...
> $GisDataSrc","error");
>
> };
>
> if ($@) {
>
> &AppletMsg("The table name doesn't exist or one of the attribute names
> are not valid... $@","error <mailto:$@%22,%22error> ");
>
> }
>
>
>
> eval {
>
> $stmt->execute() or &AppletMsg("Can't execute select items on
> $GisDataSrc - $DBI::errstr ","error");
>
> };
>
> if ($@) {
>
> &AppletMsg("Can't execute select items... $@","error
> <mailto:$@%22,%22error> ");
>
> }
>
>
>
> $colctr=1;
>
>
>
> while (@tname = ($stmt->fetchrow_array())) {
>
> foreach $value (@tname) {
>
>
>
> if ($colctr == $NumAttrItems+1 ){
>
> $ItemNum++;
>
> $colctr=1;
>
> }
>
> $QueryResultsmatrix[$ItemNum]->[$colctr]=$value
> $colctr++;
>
> }
>
> }
>
>
>
> $stmt->finish();
>
> ++++++++++++++++++++++++++++++++++
>
>
>
> Thanks in advance for your help.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list