Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ejemplo python-mapnik
FROM ubuntu:20.04
RUN apt-get update -y && apt-get install -y apt-utils
RUN apt-get install -y python3-mapnik
WORKDIR /app
COPY . .
<Map background-color="blue" srs="+init=epsg:4326">
<Style name="My Style">
<Rule>
<PolygonSymbolizer fill="#f2eff9" />
<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="0.1" />
</Rule>
</Style>
<Layer name="world" srs="+init=epsg:4326">
<StyleName>My Style</StyleName>
<Datasource>
<Parameter name="type">postgis</Parameter>
<Parameter name="host">172.17.0.1</Parameter>
<Parameter name="dbname">curso</Parameter>
<Parameter name="user">curso</Parameter>
<Parameter name="password">curso</Parameter>
<Parameter name="table">(select geom from countries) as "table"</Parameter>
</Datasource>
</Layer>
</Map>
import mapnik
m = mapnik.Map(1024, 1024)
mapnik.load_map(m, "map.xml")
m.zoom_all()
mapnik.render_to_file(m, "map.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment