MapFish Tutorial Issues

26 views
Skip to first unread message

Todd Blanchard

unread,
Dec 26, 2009, 2:32:29 AM12/26/09
to turbo...@googlegroups.com
Trying to get through the MapFish tutorial.  Lots of details are left out.

First - how does one create the database and load the data?  I can create an empty postgis db - but not one containing a table called world_fb that has country boundaries.  I cannot find how to do that despite extensive searching.

I was able to find what I think is the basis for this example in loading data from

wget http://aprsworld.net/gisdata/world/world.zip unzip world.zip shp2pgsql world.shp world gisdb > world.sql psql -d gisdb < world.sql

so tweaking the layers.ini file for table name seems OK - but starting the server and trying to see the JSON, I get errors about no type "geometry".

So I ez_install geoalchemy and now it chugs for a bit, fails to deliver a page, and logs nothing useful.

23:16:28,942 INFO  [sqlalchemy.engine.base.Engine.0x...3910] BEGIN
23:16:28,943 INFO  [sqlalchemy.engine.base.Engine.0x...3910] SELECT world.gid AS world_gid, world.name AS world_name, world.capital AS world_capital, world.approx AS world_approx, world.area AS world_area, world.sourcethm AS world_sourcethm, world.the_geom AS world_the_geom 
FROM world
23:16:28,943 INFO  [sqlalchemy.engine.base.Engine.0x...3910] {}
23:16:42,653 INFO  [tg.i18n] Language ['en-us']: not supported
23:16:42,653 INFO  [tg.i18n] Language ['en-us']: not supported by FormEncode

Then in the section Displaying the Vector Data as a Layer in an OpenLayers Map

It is not at all clear what files one should edit to add the code. As a TG2 noob, I can't figure this out at all.

Any help moving past these issues would be appreciated.
-Todd Blanchard

Sanjiv Singh

unread,
Dec 26, 2009, 6:07:49 AM12/26/09
to turbo...@googlegroups.com
Hi Todd,

On Sat, Dec 26, 2009 at 1:02 PM, Todd Blanchard <tblan...@mac.com> wrote:
> Trying to get through the MapFish tutorial.  Lots of details are left out.
> First - how does one create the database and load the data?  I can create an
> empty postgis db - but not one containing a table called world_fb that has
> country boundaries.  I cannot find how to do that despite extensive
> searching.

I guess you are right. We should have a section showing how to load sample data.


> I was able to find what I think is the basis for this example in loading
> data from
> wget http://aprsworld.net/gisdata/world/world.zip unzip world.zip shp2pgsql
> world.shp world gisdb > world.sql psql -d gisdb < world.sql
> so tweaking the layers.ini file for table name seems OK - but starting the
> server and trying to see the JSON, I get errors about no type "geometry".
> So I ez_install geoalchemy and now it chugs for a bit, fails to deliver a
> page, and logs nothing useful.
> 23:16:28,942 INFO  [sqlalchemy.engine.base.Engine.0x...3910] BEGIN
> 23:16:28,943 INFO  [sqlalchemy.engine.base.Engine.0x...3910] SELECT
> world.gid AS world_gid, world.name AS world_name, world.capital AS
> world_capital, world.approx AS world_approx, world.area AS world_area,
> world.sourcethm AS world_sourcethm, world.the_geom AS world_the_geom
> FROM world
> 23:16:28,943 INFO  [sqlalchemy.engine.base.Engine.0x...3910] {}
> 23:16:42,653 INFO  [tg.i18n] Language ['en-us']: not supported
> 23:16:42,653 INFO  [tg.i18n] Language ['en-us']: not supported by FormEncode

I downloaded the same data and followed up to "displaying as json".
It worked for me on tg2.0.3. You could also have a look at the video
here http://vimeo.com/4135185 . Although, it is windows specific, but
may still be of some help.


> Then in the section Displaying the Vector Data as a Layer in an OpenLayers
> Map
> It is not at all clear what files one should edit to add the code. As a TG2
> noob, I can't figure this out at all.
> Any help moving past these issues would be appreciated.

This example uses toscawidgets for creating the map (tw.openlayers).
You could first start with a simple plain javascript example. Start with
the example at http://openlayers.org/dev/examples/gml-layer.html and
change this line
map.addLayer(new OpenLayers.Layer.GML("GML", "gml/polygon.xml"));
to
map.addLayer(new OpenLayers.Layer.GML("GML", "/countries", {format:
OpenLayers.Format.GeoJSON}));

For using tw.openlayers example as given in the tutorial define the
widgets in controlers/root.py
and then stick it to the tmpl_context in a method inside RootController class.

I could send you the source code for the working app if you want.

regards
Sanjiv

> -Todd Blanchard
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to
> turbogears+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
>

Todd Blanchard

unread,
Dec 26, 2009, 8:56:18 AM12/26/09
to turbo...@googlegroups.com
Hmm, I still have the problem.

Could you send me a listing of what packages you have installed in your environment?

Also, are you seeing this error over and over again?
05:51:15,928 INFO  [tg.i18n] Language ['en-us']: not supported
05:51:15,929 INFO  [tg.i18n] Language ['en-us']: not supported by FormEncode

Mine is below - looking for differences.

Thanks for any help here.

On Dec 26, 2009, at 3:07 AM, Sanjiv Singh wrote:

I downloaded the same data and followed up to "displaying as json".
It worked for me on tg2.0.3. You could also have a look at the video
here http://vimeo.com/4135185 . Although, it is windows specific, but
may still be of some help.

AddOns-0.6-py2.6.egg
Babel-0.9.4-py2.6.egg
Beaker-1.3-py2.6.egg
BytecodeAssembler-0.3-py2.6.egg
Catwalk-2.0.2-py2.6.egg
DecoratorTools-1.7-py2.6.egg
Extremes-1.1.1-py2.6.egg
FeatureServer-1.12-py2.6.egg
FormEncode-1.2.1-py2.6.egg
Genshi-0.5.1-py2.6-macosx-10.6-universal.egg
GeoAlchemy-0.1-py2.6.egg
Mako-0.2.4-py2.6.egg
PEAK_Rules-0.5a1.dev_r2582-py2.6.egg
Paste-1.7.2-py2.6.egg
PasteDeploy-1.3.3-py2.6.egg
PasteScript-1.7.3-py2.6.egg
Pygments-1.0-py2.6.egg
Pylons-0.9.7-py2.6.egg
Routes-1.10.3-py2.6.egg
SQLAlchemy-0.5.1-py2.6.egg
Shapely-1.0.11-py2.6.egg
SymbolType-1.0-py2.6.egg
TGFeature.egg-link
Tempita-0.2-py2.6.egg
TileCache-2.10-py2.6.egg
ToscaWidgets-0.9.4-py2.6.egg
ToscaWidgets-0.9.8-py2.6.egg
TurboGears2-2.0.3-py2.6.egg
TurboJson-1.2.1-py2.6.egg
VectorApp.egg-link
WebError-0.10.1-py2.6.egg
WebFlash-0.1a9-py2.6.egg
WebHelpers-0.6.4-py2.6.egg
WebOb-0.9.6.1-py2.6.egg
WebTest-1.1-py2.6.egg
decorator-3.0.0-py2.6.egg
easy-install.pth
egenix_mx_base-3.1.1-py2.6-macosx-10.6-universal.egg
geojson-1.0.1-py2.6.egg
mapfish-1.2-py2.6.egg
nose-0.10.4-py2.6.egg
pip-0.6.1-py2.6.egg
prioritized_methods-0.2.1-py2.6.egg
psycopg2-2.0.13-py2.6-macosx-10.6-universal.egg
psycopg2-2.0.8-py2.6-macosx-10.6-universal.egg
repoze.tm2-1.0a4-py2.6.egg
repoze.what-1.0.8-py2.6.egg
repoze.what.plugins.sql-1.0rc1-py2.6.egg
repoze.what_pylons-1.0rc3-py2.6.egg
repoze.what_quickstart-1.0-py2.6.egg
repoze.who-1.0.15-py2.6.egg
repoze.who.plugins.sa-1.0rc1-py2.6.egg
repoze.who_friendlyform-1.0b3-py2.6.egg
repoze.who_testutil-1.0rc1-py2.6.egg
setuptools-0.6c11-py2.6.egg
setuptools.pth
simplejson-2.0.8-py2.6-macosx-10.6-universal.egg
sprox-0.6.6-py2.6.egg
sqlalchemy_migrate-0.5.2-py2.6.egg
tg.devtools-2.0.2-py2.6.egg
tgext.admin-0.3.6-py2.6.egg
tgext.crud-0.3.3-py2.6.egg
tgext.geo-0.6-py2.6.egg
transaction-1.0a1-py2.6.egg
tw.forms-0.9.8-py2.6.egg
tw.openlayers-0.8.4-py2.6.egg
zope.interface-3.4.1-py2.6-macosx-10.6-universal.egg
zope.sqlalchemy-0.4-py2.6.egg

Diez B. Roggisch

unread,
Dec 26, 2009, 10:07:13 AM12/26/09
to turbo...@googlegroups.com
Todd Blanchard schrieb:

> Hmm, I still have the problem.
>
> Could you send me a listing of what packages you have installed in your
> environment?
>
> Also, are you seeing this error over and over again?
> 05:51:15,928 INFO [tg.i18n] Language ['en-us']: not supported
> 05:51:15,929 INFO [tg.i18n] Language ['en-us']: not supported by FormEncode

It's not an error, it's an info-level logging statement. Nothing to
worry about.

Do you really have the postgis-extensions installed? The error with "no
type geometry" looks somewhat suspicious.

Diez

Todd Blanchard

unread,
Dec 26, 2009, 12:22:46 PM12/26/09
to turbo...@googlegroups.com
That went away when I installed GeoAlchemy, but I still don't get the JSON. Just silent failure.

Sanjiv Singh

unread,
Dec 26, 2009, 12:55:36 PM12/26/09
to turbo...@googlegroups.com
I have these packages

setuptools-0.6c9-py2.6.egg
tg.devtools-2.0.2-py2.6.egg
repoze.who-1.0.15-py2.6.egg
repoze.what_quickstart-1.0-py2.6.egg
sqlalchemy_migrate-0.5.2-py2.6.egg
TurboGears2-2.0.3-py2.6.egg
zope.interface-3.4.1-py2.6-linux-i686.egg
Paste-1.7.2-py2.6.egg
repoze.who_friendlyform-1.0b3-py2.6.egg
repoze.what.plugins.sql-1.0rc1-py2.6.egg
repoze.who.plugins.sa-1.0rc1-py2.6.egg
repoze.what-1.0.8-py2.6.egg
TurboJson-1.2.1-py2.6.egg
repoze.tm2-1.0a4-py2.6.egg
repoze.what_pylons-1.0rc3-py2.6.egg
WebError-0.10.1-py2.6.egg
WebFlash-0.1a9-py2.6.egg
Genshi-0.5.1-py2.6-linux-i686.egg
Pylons-0.9.7-py2.6.egg
repoze.who_testutil-1.0rc1-py2.6.egg
prioritized_methods-0.2.1-py2.6.egg
simplejson-2.0.8-py2.6-linux-i686.egg
PEAK_Rules-0.5a1.dev_r2582-py2.6.egg
transaction-1.0a1-py2.6.egg
decorator-3.0.0-py2.6.egg
Pygments-1.0-py2.6.egg
Tempita-0.2-py2.6.egg
WebOb-0.9.6.1-py2.6.egg
WebTest-1.1-py2.6.egg
Mako-0.2.4-py2.6.egg
nose-0.10.4-py2.6.egg
FormEncode-1.2.1-py2.6.egg
PasteScript-1.7.3-py2.6.egg
PasteDeploy-1.3.3-py2.6.egg
Beaker-1.3-py2.6.egg
WebHelpers-0.6.4-py2.6.egg
Routes-1.10.3-py2.6.egg
Extremes-1.1-py2.6.egg
AddOns-0.6-py2.6.egg
DecoratorTools-1.7-py2.6.egg
BytecodeAssembler-0.3-py2.6.egg
SymbolType-1.0-py2.6.egg
zope.sqlalchemy-0.4-py2.6.egg
ToscaWidgets-0.9.7.2-py2.6.egg
Babel-0.9.4-py2.6.egg
Catwalk-2.0.2-py2.6.egg
tgext.admin-0.2.6-py2.6.egg
sprox-0.6.4-py2.6.egg
tgext.crud-0.2.4-py2.6.egg
tw.forms-0.9.7.2-py2.6.egg
MapFish-1.1
geojson-1.0.1-py2.6.egg
Shapely-1.0.12-py2.6.egg
TileCache
featureserver
tgext.geo
Sphinx-0.6.2-py2.6.egg
docutils-0.5-py2.6.egg
Jinja2-2.1.1-py2.6-linux-i686.egg
egenix_mx_base-3.1.1-py2.6-linux-i686.egg
static-0.4-py2.6.egg
pydot-1.0.2-py2.6.egg
pyparsing-1.5.2-py2.6.egg
flexirest-0.8-py2.6.egg
GDAL-1.6.1-py2.6-linux-i686.egg
xmpppy-0.5.0rc1-py2.6.egg
SQLAlchemy-0.5.6-py2.6.egg
TGScheduler-1.5-py2.6.egg
BeautifulSoup-3.1.0.1-py2.6.egg
pyephem-3.7.3.4-py2.6-linux-i686.egg
GeoAlchemy-0.1-py2.6.egg

Packages with version no are in trunk version

HTH
Sanjiv

Sanjiv Singh

unread,
Dec 26, 2009, 12:57:35 PM12/26/09
to turbo...@googlegroups.com
On Sat, Dec 26, 2009 at 10:52 PM, Todd Blanchard <tblan...@mac.com> wrote:
> That went away when I installed GeoAlchemy, but I still don't get the JSON.  Just silent failure.

BTW, GeoAlchemy is not required by MapFish. It is required only if you
want to use FeatureServer with tgext.geo

Sanjiv

>
> On Dec 26, 2009, at 7:07 AM, Diez B. Roggisch wrote:
>
>> Do you really have the postgis-extensions installed? The error with "no
>> type geometry" looks somewhat suspicious.
>

Todd Blanchard

unread,
Dec 26, 2009, 6:28:33 PM12/26/09
to turbo...@googlegroups.com
Hmm, I don't see anything suspicious.

Any tips on how I might debug a page that simply never gets served?
No errors reported....kind of worrying if there is no way to diagnose this.

Sanjiv Singh

unread,
Dec 28, 2009, 9:34:22 PM12/28/09
to turbo...@googlegroups.com
On Sun, Dec 27, 2009 at 4:58 AM, Todd Blanchard <tblan...@mac.com> wrote:
> Hmm, I don't see anything suspicious.
>
> Any tips on how I might debug a page that simply never gets served?
> No errors reported....kind of worrying if there is no way to diagnose this.

The Error Middleware is there for this purpose but I wonder why that is silent.
You could try using a debugger or just put lots of print statements everywhere,
including inside the mapfish controller code, to see whats going on.

Also, try putting a ?maxfeatures=1 params at the end of the url and see
if the LIMIT clause shows up in the SQL. I found my browser kind of
saturated without that param

regards
Sanjiv

Reply all
Reply to author
Forward
0 new messages