C:\Program Files\PostgreSQL\9.4\data
Russian, Russia
. When installing, you will also be asked for the password for the PostgreSQL server, you will need it, remember it.bin
PostgreSQL directory to PATH
. After adding, you need to log out and log in again (logoff-login) for the settings to be applied.localhost:5432
, connect. If it fails, most likely the service is not running. CREATE DATABASE template_postgis_20 WITH ENCODING='UTF8' OWNER=postgres CONNECTION LIMIT=-1 LC_COLLATE = 'Russian_Russia.1251' LC_CTYPE = 'Russian_Russia.1251' TABLESPACE=pg_default;
postgis
and postgis_topology
. Disconnect from this database.gis
database based on the template_postgis_20 template_postgis_20
: CREATE DATABASE gis WITH OWNER = postgres ENCODING = 'UTF8' TEMPLATE = template_postgis_20 TABLESPACE = pg_default LC_COLLATE = 'Russian_Russia.1251' LC_CTYPE = 'Russian_Russia.1251' CONNECTION LIMIT = -1;
C:\Users\red>psql -U postgres -d gis -f legacy-postgis-gist.sql CREATE OPERATOR CLASS
osm2pgsql
. Add this directory to the PATH
variable. Logoff-login. We check that everything works: C:\Users\red>osm2pgsql -h
default.style
from the github repository. C:\Users\red>osm2pgsql -d gis -U postgres -W -H localhost -P 5432 -s -SC:\osm2pgsql\default.style RU-MOW.osm.pbf
-s
, i.e. slim - the mode in which temporary data is stored in the database. This slows down the process, increases disk usage, but reduces the use of RAM. Osm2pgsql took 160s overall
C:\Users\red>python Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
Windows 32 bit Package
, download, unpack in C:\mapnik-v2.2.0
.lib
and bin
directories to the map in PATH
, this time. Create a new system variable PYTHONPATH
and assign it the path to C:\mapnik-v2.2.0\python\2.7\site-packages
, these are two. Put this vcredist , it's three. Logoff-login. C:\Users\red>python Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>import mapnik >>>
Possible errors are parsed on the wiki. But besides that, it is worth trying to move the paths to lib
and bin
to the top of the PATH
. C:\Users\red>cd C:\mapnik-v2.2.0\demo\python C:\mapnik-v2.2.0\demo\python>python rundemo.py Pycairo not available... will render Cairo formats using alternative method 12 maps have been rendered in the current directory: - demo.png - demo256.png - demo64_binary_transparency.png - demo128_colors_hextree_no_alpha.png - demo_high.jpg - demo_low.jpg - demo.tif - demo.pdf - demo.ps - demo.svg - demo_cairo_rgb.png - demo_cairo_argb.png Have a look!
Prebuilt Win32 executables, DLL including NAD27 grid shift files
. Download, unpack ( c:\proj
). In PATH
add the path to bin
, to the new variable PROJ_LIB
path to nad
. Logoff-login.c:\mapnik
.get-coastlines.sh
script for get-coastlines.sh
, but it is written in bash and under Windows will not work. But it is quite simple and short, so just repeat all the actions with handles.c:\mapnik\world_boundaries
.mapnik\inc
, rename the settings.xml.inc.template
file to settings.xml.inc
.fontset-settings.xml.inc.template
file in fontset-settings.xml.inc
.datasource-settings.xml.inc.template
file is in datasource-settings.xml.inc
and edit it: <Parameter name="type">postgis</Parameter> <Parameter name="password">password</Parameter> <Parameter name="host">localhost</Parameter> <Parameter name="port">5432</Parameter> <Parameter name="user">postgres</Parameter> <Parameter name="dbname">gis</Parameter> <Parameter name="estimate_extent">false</Parameter>
generate_tiles.py
script a bit: if __name__ == "__main__": home = os.environ['HOME'] try: mapfile = os.environ['MAPNIK_MAP_FILE'] except KeyError: mapfile = home + "/svn.openstreetmap.org/applications/rendering/mapnik/osm-local.xml" try: tile_dir = os.environ['MAPNIK_TILE_DIR'] except KeyError: tile_dir = home + "/osm/tiles/" if not tile_dir.endswith('/'): tile_dir = tile_dir + '/'
replace with if __name__ == "__main__": try: mapfile = os.environ['MAPNIK_MAP_FILE'] except KeyError: print('MAPNIK_MAP_FILE env var not found! Use default.') mapfile = 'C:/mapnik/osm.xml' # - try: tile_dir = os.environ['MAPNIK_TILE_DIR'] except KeyError: print('MAPNIK_TILE_DIR env var not found! Use default.') tile_dir = 'C:/tiles/' # - if not tile_dir.endswith('/'): tile_dir = tile_dir + '/'
bbox = (-180.0,-90.0, 180.0,90.0) render_tiles(bbox, mapfile, tile_dir, 0, 5, "World")
write (in our case Moscow) bbox = (37.32, 55.57, 37.88, 55.92) render_tiles(bbox, mapfile, tile_dir, 17, 17, "Moscow") exit() # ,
C:\mapnik>generate_tiles.py
Source: https://habr.com/ru/post/265329/
All Articles