Created
December 26, 2012 20:34
-
-
Save drnextgis/4382927 to your computer and use it in GitHub Desktop.
mapnik.MemoryDatasource
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mapnik | |
# Массив векторных данных | |
geometries = [ | |
(0, "POLYGON ((0 0, 5 0, 5 5, 0 5, 0 0))"), | |
(1, "POLYGON((1 5, 4 5, 4 6, 1 6, 1 5))") | |
] | |
# Создаём хранилище | |
ds = mapnik.MemoryDatasource() | |
# Объект контекста | |
ctx = mapnik.Context() | |
# Заполняем хранилище | |
for id, wkt in geometries: | |
f = mapnik.Feature(ctx, id) | |
f.add_geometries_from_wkt(wkt) | |
ds.add_feature(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment