John Fries (3) [Avatar] Offline
I just bought "PostGIS in Action" and am trying to get Chapter 11.5 "Displaying data with server-side web scripting" working.

I don´t understand where to put "data_json.tpl", so that it will be find, or what it has to contain (only the small script-part in the book?), because there must be some problem with that
-> Warning: Smarty error: unable to read resource: "data_json.tpl" in CsmilieampphtdocswebapplibssmartySmarty.class.php on line 1093

If not here, where else can I ask for help concerning this PostGIS Example?

Thank You
regina.leo (265) [Avatar] Offline
Re: Chapter 11.5 - how to get example work ?
It should go in a folder called


Create that folder if it doesn't exist.

Also create a folder called: templates_c
that is writeable by your apache process.

By default Smarty looks for a folder named templates relative to location of the file instantiating Smarty (so should be in this case at the root of your app). You should also create a folder called templates_c which is where Smarty compiles the file on first use and puts there.

If you don't like the default locations, you can override them on the instantiation of smarty in this case the __construct() method of _DataFeeder (datafeeder.php)

add right after the $this->plugins_dir lines
$this->template_dir = array('templates', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates');
$this->compile_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates_c';

The above should actually be where its looking for the files but you can hardcode a path to go somewhere else.
John Fries (3) [Avatar] Offline
Re: Chapter 11.5 - how to get example work ?
Thank you very much. It´s working fine now.

Do You know up to how many features (points and lines only) I can work with the JSON-method combined with OpenLayers? I want to use this method instead of using WFS-T and GeoServer. I´ve read somewhere that using KML with more than 1000 features is not recommended. Is the JSON-method more stable?

regina.leo (265) [Avatar] Offline
Re: Chapter 11.5 - how to get example work ?
I think JSON is better since it is more of a native format for Javascript, so probably less processing that OpenLayers has to do. I haven't tried though, so not sure what the limit would be.