{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\nRio de Janeiro (city) districts\n===============================\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "This example will explore the case of getting data from another\nArcGIS server.\n\nWe will use a `server <https://pgeo3.rio.rj.gov.br/arcgis/rest/services/>`__ that\nprovides data on the city of Rio de Janeiro. Let's, for example, plot the district\ndivisions.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from mapsbr import arcgis\n\ndistricts = arcgis.get_map(\n    service=\"Basicos/mapa_basico_UTM\",\n    layer=15,\n    baseurl=\"https://pgeo3.rio.rj.gov.br/arcgis/rest/services/\",\n)\n\nimport matplotlib.pyplot as plt\n\ndistricts.plot(color=\"w\", edgecolor=\"steelblue\")\nplt.title(\"Rio de Janeiro city districts\")\nplt.gca().axis(\"off\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        ".. note:\n\n   This function unfortunately is considerably unreliable and only tested\n   in these two hosts. I'll surely put some work on improving it.\n\nFrom the same service, you could also plot some interesting things like\nthe geographical distribution of municipal hospitals.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "rj_districts = districts.plot(color=\"w\", edgecolor=\"steelblue\")\n\narcgis.get_map(\n    service=\"Basicos/mapa_basico_UTM\",\n    layer=7,\n    baseurl=\"https://pgeo3.rio.rj.gov.br/arcgis/rest/services/\",\n).plot(ax=rj_districts, color=\"black\", marker=\"x\", markersize=10)\n\nplt.gca().axis(\"off\")\nplt.title(\"Municipal hospitals in Rio de Janeiro\")"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}