簡體   English   中英

postgis_geojson.php腳本中的“參數”選項

[英]'parameters' option in the postgis_geojson.php script

我正在使用此腳本(更新https://gist.github.com/3763701 ),並且效果很好(祝賀作者),但是'parameters'選項不適用於我的表,例如此調用:

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)和32位rhel5的Firefox 6.0.2,

解:

在第70行,嘗試將pg_escape_string($ parameters)更改為$ parameters

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM