【问题标题】:'parameters' option in the postgis_geojson.php scriptpostgis_geojson.php 脚本中的“参数”选项
【发布时间】:2012-09-25 21:05:13
【问题描述】:

我正在使用这个脚本(更新https://gist.github.com/3763701),它运行良好(恭喜作者),但“参数”选项不适用于我的表格,例如这个调用:

http://localhost/postgis_geojson.php?geotable=seafloor_thermometry_point_wgs84&geomfield=geom&parameters=source='GEOMAR'

给予:

There was an error parsing the JSON document. The document may not be well-formed.
Document contents:
<br /> <b>Warning</b>: pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: syntax error at or near &quot;GEOMAR&quot; at character 110 in <b>/var/www/html/postgis_geojson.php</b> on line <b>85</b><br /> An SQL error occured.

然而,在 postgis 中这个调用:

select id,fid,source from seafloor_thermometry_point_wgs84 where source='GEOMAR';

给予:

 id | fid | source
----+-----+--------
  1 |   1 | GEOMAR
  2 |   2 | GEOMAR
  3 |   3 | GEOMAR
  4 |   4 | GEOMAR
...etc

问题可能出在哪里?

感谢您对此的任何提示,

格瑞

编辑:

我的 postgis 表在 id 中有 PK,我正在使用 postgis 1.5、postgresql 8.4.8、php-5.1.6-27.el5、php-pgsql-5.1.6-27.el5、apache 2 (httpd- 2.2.3-43.el5) 和 rhel5 32 位中的 Firefox 6.0.2,

【问题讨论】:

    标签: php postgis


    【解决方案1】:

    解决方案:

    在第 70 行,尝试将 pg_escape_string($parameters) 更改为 $parameters

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-27
      • 1970-01-01
      • 1970-01-01
      • 2015-09-13
      • 2017-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多