On Windows Python 2.5 (http://www.python.org/download/releases/2.5.4/), and the Python for Windows extensions (http://sourceforge.net/projects/pywin32/) must be installed.
To install MapFish, download the installation script (http://www.mapfish.org/downloads/go-mapfish-framework-1.2.py), and execute it from a terminal.
1. C:\>C:\Python25\python.exe go-mapfish-framework-1.2.py –no-site-packages env
New python executable in env\Scripts\python.exe
Installing setuptools………………………….done.
Searching for mapfish
Reading http://www.mapfish.org/downloads/1.2/pkg/mapfish/
Best match: mapfish 1.2
Downloading http://www.mapfish.org/downloads/1.2/mapfish-1.2-py2.5-win32.eg
Processing mapfish-1.2-py2.5-win32.egg
creating c:\env\lib\site-packages\mapfish-1.2-py2.5-win32.egg
Extracting mapfish-1.2-py2.5-win32.egg to c:\env\lib\site-packages
Adding mapfish 1.2 to easy-install.pth file
Installed c:\env\lib\site-packages\mapfish-1.2-py2.5-win32.egg
Processing dependencies for mapfish
Searching for geojson>=1.0,<=1.0.99
Reading http://www.mapfish.org/downloads/1.2/pkg/geojson/
Download error: (10054, ‘Connection reset by peer’) — Some packages may no
found!
Reading http://www.mapfish.org/downloads/1.2/pkg/geojson/
Best match: geojson 1.0.1
Downloading http://www.mapfish.org/downloads/1.2/geojson-1.0.1-py2.5.egg
Processing geojson-1.0.1-py2.5.egg
Moving geojson-1.0.1-py2.5.egg to c:\env\lib\site-packages
Adding geojson 1.0.1 to easy-install.pth file
Installed c:\env\lib\site-packages\geojson-1.0.1-py2.5.egg
Searching for Pylons>=0.9.7,<=0.9.7.99
Reading http://www.mapfish.org/downloads/1.2/pkg/Pylons/
Best match: Pylons 0.9.7
Downloading http://www.mapfish.org/downloads/1.2/Pylons-0.9.7-py2.5.egg
Processing Pylons-0.9.7-py2.5.egg
creating c:\env\lib\site-packages\Pylons-0.9.7-py2.5.egg
Extracting Pylons-0.9.7-py2.5.egg to c:\env\lib\site-packages
Adding Pylons 0.9.7 to easy-install.pth file
Installed c:\env\lib\site-packages\pylons-0.9.7-py2.5.egg
Link to http://www.pylonshq.com/download/0.9.7 ***BLOCKED*** by –allow-hos
Searching for SQLAlchemy>=0.5.0,<=0.5.99
Reading http://www.mapfish.org/downloads/1.2/pkg/SQLAlchemy/
Best match: SQLAlchemy 0.5.2
Downloading http://www.mapfish.org/downloads/1.2/SQLAlchemy-0.5.2-py2.5.egg
Processing SQLAlchemy-0.5.2-py2.5.egg
creating c:\env\lib\site-packages\SQLAlchemy-0.5.2-py2.5.egg
Extracting SQLAlchemy-0.5.2-py2.5.egg to c:\env\lib\site-packages
Adding SQLAlchemy 0.5.2 to easy-install.pth file
Installed c:\env\lib\site-packages\sqlalchemy-0.5.2-py2.5.egg
Searching for simplejson
Reading http://www.mapfish.org/downloads/1.2/pkg/simplejson/
Download error: (10054, ‘Connection reset by peer’) — Some packages may no
found!
Reading http://www.mapfish.org/downloads/1.2/pkg/simplejson/
Best match: simplejson 2.0.8
Downloading http://www.mapfish.org/downloads/1.2/simplejson-2.0.8-py2.5-win
g
Processing simplejson-2.0.8-py2.5-win32.egg
Moving simplejson-2.0.8-py2.5-win32.egg to c:\env\lib\site-packages
Adding simplejson 2.0.8 to easy-install.pth file
Installed c:\env\lib\site-packages\simplejson-2.0.8-py2.5-win32.egg
Searching for Tempita>=0.2
Reading http://www.mapfish.org/downloads/1.2/pkg/Tempita/
Best match: Tempita 0.2
Downloading http://www.mapfish.org/downloads/1.2/Tempita-0.2-py2.5.egg
Processing Tempita-0.2-py2.5.egg
Moving Tempita-0.2-py2.5.egg to c:\env\lib\site-packages
Adding Tempita 0.2 to easy-install.pth file
Installed c:\env\lib\site-packages\tempita-0.2-py2.5.egg
Searching for WebTest>=1.1
Reading http://www.mapfish.org/downloads/1.2/pkg/WebTest/
Best match: WebTest 1.1
Downloading http://www.mapfish.org/downloads/1.2/WebTest-1.1-py2.5.egg
Processing WebTest-1.1-py2.5.egg
Moving WebTest-1.1-py2.5.egg to c:\env\lib\site-packages
Adding WebTest 1.1 to easy-install.pth file
Installed c:\env\lib\site-packages\webtest-1.1-py2.5.egg
Link to http://svn.pythonpaste.org/Paste/WebOb/trunk#egg=WebOb-dev ***BLOCK
by –allow-hosts
Searching for WebError>=0.10.1
Reading http://www.mapfish.org/downloads/1.2/pkg/WebError/
Best match: WebError 0.10.1
Downloading http://www.mapfish.org/downloads/1.2/WebError-0.10.1-py2.5.egg
Processing WebError-0.10.1-py2.5.egg
creating c:\env\lib\site-packages\WebError-0.10.1-py2.5.egg
Extracting WebError-0.10.1-py2.5.egg to c:\env\lib\site-packages
Adding WebError 0.10.1 to easy-install.pth file
Installed c:\env\lib\site-packages\weberror-0.10.1-py2.5.egg
Searching for WebOb>=0.9.6.1
Reading http://www.mapfish.org/downloads/1.2/pkg/WebOb/
Best match: WebOb 0.9.6.1
Downloading http://www.mapfish.org/downloads/1.2/WebOb-0.9.6.1-py2.5.egg
error: Download error for http://www.mapfish.org/downloads/1.2/WebOb-0.9.6.
.5.egg: (10054, ‘Connection reset by peer’)
Searching for mapfish.plugin.client
Reading http://www.mapfish.org/downloads/1.2/pkg/mapfish.plugin.client/
Best match: mapfish.plugin.client 0.1.1
Downloading http://www.mapfish.org/downloads/1.2/mapfish.plugin.client-0.1.
.5.egg
Processing mapfish.plugin.client-0.1.1-py2.5.egg
creating c:\env\lib\site-packages\mapfish.plugin.client-0.1.1-py2.5.egg
Extracting mapfish.plugin.client-0.1.1-py2.5.egg to c:\env\lib\site-package
Adding mapfish.plugin.client 0.1.1 to easy-install.pth file
Installed c:\env\lib\site-packages\mapfish.plugin.client-0.1.1-py2.5.egg
Processing dependencies for mapfish.plugin.client
Searching for JSTools>=0.1.5,<=0.1.99
Reading http://www.mapfish.org/downloads/1.2/pkg/JSTools/
Best match: JSTools 0.1.5
Downloading http://www.mapfish.org/downloads/1.2/JSTools-0.1.5-py2.5.egg
Processing JSTools-0.1.5-py2.5.egg
Moving JSTools-0.1.5-py2.5.egg to c:\env\lib\site-packages
Adding JSTools 0.1.5 to easy-install.pth file
Installing jsbuild-script.py script to C:\env\Scripts
Installing jsbuild.exe script to C:\env\Scripts
Installing jsmin-script.py script to C:\env\Scripts
Installing jsmin.exe script to C:\env\Scripts
Installed c:\env\lib\site-packages\jstools-0.1.5-py2.5.egg
Searching for PasteScript>=1.7.2,<=1.7.99
Reading http://www.mapfish.org/downloads/1.2/pkg/PasteScript/
Best match: PasteScript 1.7.3
Downloading http://www.mapfish.org/downloads/1.2/PasteScript-1.7.3-py2.5.eg
Processing PasteScript-1.7.3-py2.5.egg
creating c:\env\lib\site-packages\PasteScript-1.7.3-py2.5.egg
Extracting PasteScript-1.7.3-py2.5.egg to c:\env\lib\site-packages
Adding PasteScript 1.7.3 to easy-install.pth file
Installing paster script to C:\env\Scripts
Installing paster-script.py script to C:\env\Scripts
Installing paster.exe script to C:\env\Scripts
Installed c:\env\lib\site-packages\pastescript-1.7.3-py2.5.egg
Searching for PasteDeploy
Reading http://www.mapfish.org/downloads/1.2/pkg/PasteDeploy/
Best match: PasteDeploy 1.3.3
Downloading http://www.mapfish.org/downloads/1.2/PasteDeploy-1.3.3-py2.5.eg
Processing PasteDeploy-1.3.3-py2.5.egg
creating c:\env\lib\site-packages\PasteDeploy-1.3.3-py2.5.egg
Extracting PasteDeploy-1.3.3-py2.5.egg to c:\env\lib\site-packages
Adding PasteDeploy 1.3.3 to easy-install.pth file
Installed c:\env\lib\site-packages\pastedeploy-1.3.3-py2.5.egg
Searching for Paste>=1.3
Reading http://www.mapfish.org/downloads/1.2/pkg/Paste/
Best match: Paste 1.7.2
Downloading http://www.mapfish.org/downloads/1.2/Paste-1.7.2-py2.5.egg
Processing Paste-1.7.2-py2.5.egg
creating c:\env\lib\site-packages\Paste-1.7.2-py2.5.egg
Extracting Paste-1.7.2-py2.5.egg to c:\env\lib\site-packages
Adding Paste 1.7.2 to easy-install.pth file
Installed c:\env\lib\site-packages\paste-1.7.2-py2.5.egg
Finished processing dependencies for mapfish.plugin.client
Downloading http://www.mapfish.org/downloads/exe/psycopg2-2.0.10.win32-py2.
.3.7-release.exe
Processing psycopg2 installation for windows
Installed C:\env\Lib\site-packages\psycopg2
Downloading http://www.mapfish.org/downloads/exe/Shapely-1.0.12.win32.exe
Traceback (most recent call last):
File “go-mapfish-framework-1.2.py”, line 1363, in <module>
main()
File “go-mapfish-framework-1.2.py”, line 424, in main
after_install(options, home_dir)
File “go-mapfish-framework-1.2.py”, line 1060, in after_install
remotezip = urllib2.urlopen(url)
File “C:\Python25\Lib\urllib2.py”, line 124, in urlopen
return _opener.open(url, data)
File “C:\Python25\Lib\urllib2.py”, line 381, in open
response = self._open(req, data)
File “C:\Python25\Lib\urllib2.py”, line 399, in _open
‘_open’, req)
File “C:\Python25\Lib\urllib2.py”, line 360, in _call_chain
result = func(*args)
File “C:\Python25\Lib\urllib2.py”, line 1107, in http_open
return self.do_open(httplib.HTTPConnection, req)
File “C:\Python25\Lib\urllib2.py”, line 1082, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (10054, ‘Connection reset by peer’)>
C:\>
2. Karena terjadi error, maka diulang untuk langkah yg pertama sampai hasilnya benar.
C:\>C:\Python25\python.exe go-mapfish-framework-1.2.py –no-site-packages env
New python executable in env\Scripts\python.exe
Installing setuptools……………..done.
Searching for mapfish
Best match: mapfish 1.2
Processing mapfish-1.2-py2.5-win32.egg
mapfish 1.2 is already the active version in easy-install.pth
Using c:\env\lib\site-packages\mapfish-1.2-py2.5-win32.egg
Processing dependencies for mapfish
Searching for WebOb>=0.9.6.1
Reading http://www.mapfish.org/downloads/1.2/pkg/WebOb/
Best match: WebOb 0.9.6.1
Downloading http://www.mapfish.org/downloads/1.2/WebOb-0.9.6.1-py2.5.egg
Processing WebOb-0.9.6.1-py2.5.egg
Moving WebOb-0.9.6.1-py2.5.egg to c:\env\lib\site-packages
Adding WebOb 0.9.6.1 to easy-install.pth file
Installed c:\env\lib\site-packages\webob-0.9.6.1-py2.5.egg
Searching for Mako>=0.2.4
Reading http://www.mapfish.org/downloads/1.2/pkg/Mako/
Best match: Mako 0.2.4
Downloading http://www.mapfish.org/downloads/1.2/Mako-0.2.4-py2.5.egg
Processing Mako-0.2.4-py2.5.egg
creating c:\env\lib\site-packages\Mako-0.2.4-py2.5.egg
Extracting Mako-0.2.4-py2.5.egg to c:\env\lib\site-packages
Adding Mako 0.2.4 to easy-install.pth file
Installing mako-render script to C:\env\Scripts
Installed c:\env\lib\site-packages\mako-0.2.4-py2.5.egg
Searching for nose>=0.10.4
Reading http://www.mapfish.org/downloads/1.2/pkg/nose/
Best match: nose 0.10.4
Downloading http://www.mapfish.org/downloads/1.2/nose-0.10.4-py2.5.egg
Processing nose-0.10.4-py2.5.egg
creating c:\env\lib\site-packages\nose-0.10.4-py2.5.egg
Extracting nose-0.10.4-py2.5.egg to c:\env\lib\site-packages
Adding nose 0.10.4 to easy-install.pth file
Installing nosetests-script.py script to C:\env\Scripts
Installing nosetests.exe script to C:\env\Scripts
Installing nosetests.exe.manifest script to C:\env\Scripts
Installed c:\env\lib\site-packages\nose-0.10.4-py2.5.egg
Searching for decorator>=2.3.2
Reading http://www.mapfish.org/downloads/1.2/pkg/decorator/
Best match: decorator 3.0.0
Downloading http://www.mapfish.org/downloads/1.2/decorator-3.0.0-py2.5.egg
Processing decorator-3.0.0-py2.5.egg
creating c:\env\lib\site-packages\decorator-3.0.0-py2.5.egg
Extracting decorator-3.0.0-py2.5.egg to c:\env\lib\site-packages
Adding decorator 3.0.0 to easy-install.pth file
Installed c:\env\lib\site-packages\decorator-3.0.0-py2.5.egg
Searching for FormEncode>=1.2.1
Reading http://www.mapfish.org/downloads/1.2/pkg/FormEncode/
Download error: (10054, ‘Connection reset by peer’) — Some packages may not be
found!
Couldn’t find index page for ‘FormEncode’ (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://www.mapfish.org/downloads/1.2/pkg/
No local packages or download links found for FormEncode>=1.2.1
Best match: None
Traceback (most recent call last):
File “C:\env\Scripts\easy_install-script.py”, line 8, in <module>
load_entry_point(‘setuptools==0.6c11′, ‘console_scripts’, ‘easy_install’)()
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\command\
easy_install.py”, line 1712, in main
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\command\
easy_install.py”, line 1700, in with_ei_usage
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\command\
easy_install.py”, line 1716, in <lambda>
File “C:\Python25\Lib\distutils\core.py”, line 151, in setup
dist.run_commands()
File “C:\Python25\Lib\distutils\dist.py”, line 974, in run_commands
self.run_command(cmd)
File “C:\Python25\Lib\distutils\dist.py”, line 994, in run_command
cmd_obj.run()
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\command\
easy_install.py”, line 211, in run
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\command\
easy_install.py”, line 446, in easy_install
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\command\
easy_install.py”, line 481, in install_item
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\command\
easy_install.py”, line 519, in process_distribution
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\pkg_resources.py”,
line 563, in resolve
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\pkg_resources.py”,
line 799, in best_match
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\pkg_resources.py”,
line 811, in obtain
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\command\
easy_install.py”, line 434, in easy_install
File “C:\env\lib\site-packages\setuptools-0.6c11-py2.5.egg\setuptools\package_
index.py”, line 475, in fetch_distribution
AttributeError: ‘NoneType’ object has no attribute ‘clone’
Searching for mapfish.plugin.client
Best match: mapfish.plugin.client 0.1.1
Processing mapfish.plugin.client-0.1.1-py2.5.egg
mapfish.plugin.client 0.1.1 is already the active version in easy-install.pth
Using c:\env\lib\site-packages\mapfish.plugin.client-0.1.1-py2.5.egg
Processing dependencies for mapfish.plugin.client
Finished processing dependencies for mapfish.plugin.client
Downloading http://www.mapfish.org/downloads/exe/psycopg2-2.0.10.win32-py2.5-pg8
.3.7-release.exe
Processing psycopg2 installation for windows
Installed C:\env\Lib\site-packages\psycopg2
Downloading http://www.mapfish.org/downloads/exe/Shapely-1.0.12.win32.exe
Processing shapely installation for windows
Installed C:\env\Lib\site-packages\shapely
C:\>
3. Untuk mengecek hasilnya gunakan perintah sebagai berikut :
C:\> env\Scripts\activate.bat
(env) $ paster create –list-templates
maka akan tampil keterangan sebagai berikut :
#=====================================================================
Available templates:
basic_package: A basic setuptools-enabled package
mapfish: MapFish application template
mapfish_client: MapFish client plugin template
paste_deploy: A web application deployed through paste.deploy
pylons: Pylons application template
pylons_minimal: Pylons minimal application template
#=====================================================================
berarti konfigurasi mapfish sudah benar dan berhasil
4. Membuat aplikasi mapfish pertamakali
Use:
(env) $ paster create -t mapfish MapFishApp
MapFishApp is the name of the MapFish application youre creating, you can pick any name of your choice. Well assume that you choose
MapFishApp in the rest of this quickstart.
When asked what template engine to use answer mako, which is the default. When asked if SQLAlchemy 0.5 configuration is to be included,
answer True, as your MapFish application will include web services relying on database tables.
You should now have a folder named MapFishApp. This folder contains your application files.
Now check that your MapFish application works. For this go into the MapFishApp folder and start the application:
(env) $ cd MapFishApp
(env) $ paster serve development.ini
This command starts your application in the Paster web server, which is a pure-Python web server commonly used during development.
Open http://localhost:5000 in your web browser, you should get the default page:
Perintah – perintah MapFish
===========================
1.Installing the JavaScript toolbox
(env) $ cd ..
(env) $ paster create -t mapfish_client MapFishApp
When asked whether to overwrite index.html answer y. This will overwrite the index.html page you saw in the last section by the one provided
by the mapfish_client template. When asked whether to overwrite favicon.png also answer y.
Start the application again:
(env) $ cd MapFishApp
(env) $ paster serve –reload development.ini
Open or reload http://localhost:5000 in your web browser, you should now get the default user interface:
2. Creating a web service
To set up the database connection edit development.ini and replace the line
sqlalchemy.url = sqlite:///%(here)s/development.db
by this one:
sqlalchemy.url = postgres://quickstart:quickstart@www.mapfish.org:5432/quickstart
The connection string specifies that the postgres driver must be used, the database system is located at www.mapfish.org on port 5432, and the
name of the database is quickstart.
Creating a web service is done in three steps:
1.create a layer configuration in the layers.ini file, in our case were going rely on the table named countries in the database, so the
configuration is:
[countries]
singular=country
plural=countries
table=countries
epsg=4326
geomcolumn=the_geom
singular provides a singular name for the layer. plural provides a plural name for the layer. Both are used by the code generator when
substituting variables. table provides the name of the database. epsg provides the coordinate system of the table data. geomcolumn provides
the name of the geometry column.
2. Generate the web service code with the mf-layer command:
(env) $ paster mf-layer countries
3.configure a route to the countries controller, this is done by adding the following statement after the CUSTOM ROUTES HERE comment in the
mapfishapp/config/routing.py file:
map.resource(“country”, “countries”)
Watch the indentation! 4 spaces are needed here.
If you stopped paster serve or if you did not add the –reload switch, restart MapFishApp with:
(env) $ paster serve –reload development.ini
You can now open http://localhost:5000/countries?limit=1 in your browser, you should see a GeoJSON representation of the first object in the
countries table: