-
-
Save juanignaciosl/4f155f047f254f71e5b0d34abcb30c4b to your computer and use it in GitHub Desktop.
Ejemplo python-mapnik
This file contains 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
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 . . |
This file contains 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
<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> |
This file contains 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 | |
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