Référence de l’API

Chaque route, ses paramètres, et une vraie réponse de chacune.

L’essentiel

Adresse
https://communes.pages.dev. Ni clé ni inscription. N’importe quel site peut l’appeler depuis le navigateur.
Identifiants
Une unité s’écrit de 4 façons, et chacune la trouve : 01.511.01.0, 001511010, 1511010, tanger.
Réponses
Chaque réponse contient data, meta et links. Une liste ajoute page, perPage, total et totalPages à meta, et une recherche ajoute total.
Où ça s’exécute
Un chemin en .json est un fichier statique. Le reste passe par un Worker, et l’en-tête X-Api-Tier dit lequel a répondu.
OpenAPI
Cette référence en document OpenAPI 3.1 : /api/openapi.json

Routes

GET /api/search

Trouver une unité administrative par son nom

Cherche dans les noms français, les noms arabes et les slugs. Les accents, les variantes des lettres arabes et les voyelles sont ramenés à une forme, et un lieu se trouve aussi par ses autres noms, comme Fez pour Fès.

qobligatoire
stringTexte à chercher, jusqu’à 100 caractères.
levels
stringNiveaux à inclure, séparés par des virgules. Tous quand il est absent.
limit10 par défaut
integer [1, 50]Nombre de résultats, jusqu’à 50.
  • 200Les résultats, du meilleur au moins bon.
  • 400q manque ou est trop long, ou un paramètre sort de ses bornes.
Exemple · GET /api/search?q=fez&limit=2
{
  "data": [
    {
      "code": "03.231.01.0",
      "level": "commune",
      "name": {
        "fr": "Fès",
        "ar": "فاس"
      },
      "slug": "fes",
      "score": 1000,
      "matched": "alias"
    },
    {
      "code": "08.201.03.09",
      "level": "commune",
      "name": {
        "fr": "Fezna",
        "ar": "فزنا"
      },
      "slug": "fezna",
      "score": 498,
      "matched": "prefix"
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 2
  },
  "links": {
    "self": "/api/search?q=fez&limit=2",
    "prev": null,
    "next": null
  }
}

GET /api/communes/at

La commune qui contient un point

Le point est comparé à la limite de chaque commune, conservée sur une grille de 2 à 6 m selon la taille de sa région. Dans les 6 villes divisées en arrondissements, arrondissement nomme celui où se trouve le point ; ailleurs, il vaut null. Sidi Mohamed Benmansour n’a pas de limite, et une zone d’environ 88 km² entre Ifrane et Boulemane n’en a pas non plus.

latobligatoire
number [−90, 90]Latitude, en degrés.
lngobligatoire
number [−180, 180]Longitude, en degrés.
  • 200La commune, avec l’arrondissement où se trouve le point.
  • 400Une coordonnée manque ou sort de ses bornes.
  • 404Aucune limite de commune ne contient le point : il est hors du Maroc, en mer, ou dans l’un des 2 endroits qui n’en ont pas.
Exemple · GET /api/communes/at?lat=35.786&lng=-5.8125
{
  "data": {
    "code": "01.511.01.0",
    "codeDigits": "001511010",
    "slug": "tanger",
    "nameFrRaw": "Commune de Tanger",
    "name": {
      "fr": "Tanger",
      "ar": "طنجة"
    },
    "type": "urban",
    "parents": {
      "region": "01",
      "province": "01.511",
      "cercle": null
    },
    "population": {
      "2014": {
        "total": 947952,
        "households": 239243
      },
      "2024": {
        "total": 1275428,
        "moroccan": 1268512,
        "foreign": 6916,
        "households": 362062
      },
      "change": {
        "absolute": 327476,
        "pct": 34.55,
        "basis": "arrondissement_sum"
      }
    },
    "urbanCentres": [],
    "centroid": {
      "lat": 35.75623595957031,
      "lng": -5.832718404101565
    },
    "bbox": [-5.9484121, 35.6995621, -5.7135397, 35.8259979],
    "areaKm2": 149.41,
    "density": 8536.51,
    "osm": {
      "relationId": 2758781,
      "wikidata": "Q126148"
    },
    "provenance": {
      "name": "hcp-2024",
      "population2024": "hcp-2024",
      "population2014": "hcp-2014:arrondissement_sum",
      "geometry": "osm-odbl"
    },
    "arrondissement": {
      "code": "01.511.01.07",
      "name": {
        "fr": "Médina",
        "ar": "المدينة"
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/01.511.01.0.json",
    "prev": null,
    "next": null
  }
}

GET /api/communes/near

Les communes dans un rayon autour d’un point

La distance se mesure jusqu’au centroïde de chaque commune, de la plus proche à la plus lointaine.

latobligatoire
number [−90, 90]Latitude, en degrés.
lngobligatoire
number [−180, 180]Longitude, en degrés.
radius10 par défaut
number (0, 100]Distance en km, jusqu’à 100.
limit10 par défaut
integer [1, 50]Nombre de résultats, jusqu’à 50.
  • 200Les communes dans le rayon, de la plus proche à la plus lointaine.
  • 400Une coordonnée ou le rayon manque ou sort de ses bornes.
Exemple · GET /api/communes/near?lat=33.5731&lng=-7.5898&radius=15&limit=2
{
  "data": [
    {
      "code": "06.141.01.81",
      "name": {
        "fr": "Méchouar de Casablanca",
        "ar": "مشور الدار البيضاء"
      },
      "slug": "mechouar-de-casablanca",
      "distanceKm": 1.627
    },
    {
      "code": "06.141.01.0",
      "name": {
        "fr": "Casablanca",
        "ar": "الدار البيضاء"
      },
      "slug": "casablanca",
      "distanceKm": 6.103
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 2
  },
  "links": {
    "self": "/api/communes/near?lat=33.5731&lng=-7.5898&radius=15&limit=2",
    "prev": null,
    "next": null
  }
}

GET /api/communes

Lister les communes, avec ou sans filtre

Paginé, 50 communes par page. Les filtres se combinent. q cherche plutôt les communes par nom, et ne s’emploie ni avec un filtre ni avec page.

region
stringUne région, par code ou slug.
province
stringUne province ou une préfecture, par code ou slug.
cercle
stringUn cercle, par code ou slug.
type
urban | ruralSeulement les communes urbaines, ou rurales.
min_population
integer [0, 10 000 000]Seulement les communes d’au moins autant d’habitants en 2024.
max_population
integer [0, 10 000 000]Seulement les communes d’au plus autant d’habitants en 2024.
sortcode par défaut
stringTrier par name, population en 2024, change depuis 2014, density ou area, ou par le chemin d’un indicateur du recensement, comme labour.unemploymentRate. Mettre 2014. devant le chemin trie sur le chiffre de 2014, et change. sur l’écart entre les deux recensements, comme change.illiteracy.rate10Plus ; les deux existent pour les chiffres que les recensements posent de la même façon. Un moins devant met les plus grands d’abord, et une commune sans valeur vient en dernier dans les deux sens. Triée par un indicateur, chaque commune porte indicator, sa valeur.
page1 par défaut
integer [1, 10 000]Numéro de page, à partir de 1.
q
stringCherche les communes par nom, jusqu’à 100 caractères, et renvoie jusqu’à 10 résultats. Ne prend aucun autre paramètre.
  • 200Une page de communes, ou les résultats de recherche quand q est donné.
  • 400Un filtre n’est pas un code valide ou désigne une unité du mauvais niveau, un paramètre sort de ses bornes, ou q est donné avec un autre paramètre.
  • 404Un filtre désigne une unité qui n’existe pas, ou la page est au-delà de la dernière.
Exemple · GET /api/communes?type=urban&sort=-population
{
  "data": [
    {
      "code": "06.141.01.0",
      "codeDigits": "006141010",
      "slug": "casablanca",
      "nameFrRaw": "Commune de Casablanca",
      "name": {
        "fr": "Casablanca",
        "ar": "الدار البيضاء"
      },
      "type": "urban",
      "parents": {
        "region": "06",
        "province": "06.141",
        "cercle": null
      },
      "population": {
        "2014": {
          "total": 3357173,
          "households": 819309
        },
        "2024": {
          "total": 3215935,
          "moroccan": 3169978,
          "foreign": 45957,
          "households": 909228
        },
        "change": {
          "absolute": -141238,
          "pct": -4.21,
          "basis": "arrondissement_sum"
        }
      },
      "urbanCentres": [],
      "centroid": {
        "lat": 33.55246299128418,
        "lng": -7.650829588842771
      },
      "bbox": [-7.751238, 33.493342, -7.4574165, 33.6409103],
      "areaKm2": 216.76,
      "density": 14836.29,
      "osm": {
        "relationId": 4072985,
        "wikidata": "Q7903"
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024",
        "population2014": "hcp-2014:arrondissement_sum",
        "geometry": "osm-odbl"
      }
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "page": 1,
    "perPage": 50,
    "total": 242,
    "totalPages": 5
  },
  "links": {
    "self": "/api/communes?type=urban&sort=-population",
    "prev": null,
    "next": "/api/communes?type=urban&sort=-population&page=2"
  }
}

1 ligne sur 50 affichée ici.

GET /api/communes/{code}

Une commune, quelle que soit l’écriture de son identifiant

codeobligatoire
stringUn code à points, les chiffres avec ou sans zéros de tête, ou un slug.
  • 200La commune.
  • 400Ce n’est pas un identifiant.
  • 404Aucune commune ne porte cet identifiant.
Exemple · GET /api/communes/tanger
{
  "data": {
    "code": "01.511.01.0",
    "codeDigits": "001511010",
    "slug": "tanger",
    "nameFrRaw": "Commune de Tanger",
    "name": {
      "fr": "Tanger",
      "ar": "طنجة"
    },
    "type": "urban",
    "parents": {
      "region": "01",
      "province": "01.511",
      "cercle": null
    },
    "population": {
      "2014": {
        "total": 947952,
        "households": 239243
      },
      "2024": {
        "total": 1275428,
        "moroccan": 1268512,
        "foreign": 6916,
        "households": 362062
      },
      "change": {
        "absolute": 327476,
        "pct": 34.55,
        "basis": "arrondissement_sum"
      }
    },
    "urbanCentres": [],
    "centroid": {
      "lat": 35.75623595957031,
      "lng": -5.832718404101565
    },
    "bbox": [-5.9484121, 35.6995621, -5.7135397, 35.8259979],
    "areaKm2": 149.41,
    "density": 8536.51,
    "osm": {
      "relationId": 2758781,
      "wikidata": "Q126148"
    },
    "provenance": {
      "name": "hcp-2024",
      "population2024": "hcp-2024",
      "population2014": "hcp-2014:arrondissement_sum",
      "geometry": "osm-odbl"
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/01.511.01.0.json",
    "prev": null,
    "next": null
  }
}

GET /api/communes/{code}/arrondissements.json

Les arrondissements d’une commune

Seules 6 communes ont des arrondissements ; pour toutes les autres, la liste est vide.

codeobligatoire
stringLe code à points de la commune.
  • 200Les arrondissements de la commune.
  • 404Aucune commune ne porte ce code.
Exemple · GET /api/communes/01.511.01.0/arrondissements.json
{
  "data": [
    {
      "code": "01.511.01.05",
      "codeDigits": "015110105",
      "name": {
        "fr": "Mghogha",
        "ar": "مغوغة"
      },
      "population": {
        "2024": {
          "total": 252656,
          "moroccan": 251850,
          "foreign": 806,
          "households": 70679
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024",
        "geometry": "osm-odbl"
      },
      "communeCode": "01.511.01.0",
      "prefectureOfArrondissementsCode": null,
      "centroid": {
        "lat": 35.76514231191407,
        "lng": -5.752523938476561
      },
      "bbox": [-5.8129665, 35.7226626, -5.7135397, 35.8259979],
      "areaKm2": 43.81,
      "density": 5767.67,
      "osm": {
        "relationId": 3544604,
        "wikidata": null
      }
    },
    {
      "code": "01.511.01.06",
      "codeDigits": "015110106",
      "name": {
        "fr": "Souani",
        "ar": "السواني"
      },
      "population": {
        "2024": {
          "total": 111772,
          "moroccan": 111120,
          "foreign": 652,
          "households": 33489
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024",
        "geometry": "osm-odbl"
      },
      "communeCode": "01.511.01.0",
      "prefectureOfArrondissementsCode": null,
      "centroid": {
        "lat": 35.76715592148438,
        "lng": -5.8238295160156275
      },
      "bbox": [-5.8411056, 35.7515914, -5.8021143, 35.7789764],
      "areaKm2": 5.09,
      "density": 21972.47,
      "osm": {
        "relationId": 3544606,
        "wikidata": null
      }
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 4
  },
  "links": {
    "self": "/api/communes/01.511.01.0/arrondissements.json",
    "prev": null,
    "next": null
  }
}

2 lignes sur 4 affichées ici.

GET /api/{collection}/{code}/indicators

Les chiffres d’une unité aux recensements de 2024 et 2014

Les indicateurs du HCP pour une région, une province, un cercle, une commune ou un arrondissement : âge, état matrimonial, fécondité, handicap, scolarisation, alphabétisation et langues, études et travail, et pour les ménages le logement, les équipements, les eaux usées, les déchets et le combustible de cuisson. Pour toute l’unité, sa partie urbaine et sa partie rurale, et pour les hommes et les femmes. Les parts et les taux sont en pourcentage. La plupart viennent du questionnaire long, posé à 20 % des ménages tirés au hasard dans les communes de 2 000 ménages ou plus : là, ce sont des estimations. Les chiffres de 2024 sont au premier niveau et le recensement de 2014 est sous 2014, null pour une unité qu’il n’a pas recensée. Le fichier d’une commune porte aussi les chiffres de ses centres urbains. /data/v1/indicators/fields.json nomme chaque champ avec l’intitulé du HCP, et /data/v1/indicators/2014/fields.json nomme ceux de 2014 et ce à quoi chacun se compare.

collectionobligatoire
regions | provinces | cercles | communes | arrondissementsLe niveau de l’unité.
codeobligatoire
stringUn code à points, les chiffres avec ou sans zéros de tête, ou un slug.
  • 200Les indicateurs de l’unité.
  • 400Ce n’est pas un identifiant.
  • 404Aucune unité ne porte cet identifiant, ou elle est dans une autre collection.
Exemple · GET /api/communes/tanger/indicators
{
  "data": {
    "2014": null,
    "code": "01.511.01.0",
    "codeDigits": "001511010",
    "level": "commune",
    "name": {
      "fr": "Tanger",
      "ar": "طنجة"
    },
    "fromLocalAdministration": false,
    "people": {
      "total": {
        "all": {
          "population": {
            "legal": 1275428,
            "municipal": 1272718
          },
          "labour": {
            "population15Plus": 940063,
            "active": 489284,
            "inactive": 449985,
            "activityRate": 52.1,
            "unemploymentRate": 15.3,
            "employed": 414399
          }
        },
        "male": {
          "population": {
            "municipal": 644380
          },
          "labour": {
            "population15Plus": 472773,
            "active": 350602,
            "inactive": 121457,
            "activityRate": 74.3,
            "unemploymentRate": 14.4,
            "employed": 300274
          }
        },
        "female": {
          "population": {
            "municipal": 628338
          },
          "labour": {
            "population15Plus": 467290,
            "active": 138682,
            "inactive": 328528,
            "activityRate": 29.7,
            "unemploymentRate": 17.7,
            "employed": 114125
          }
        }
      },
      "urban": {
        "all": {
          "population": {
            "legal": 1275428,
            "municipal": 1272718
          },
          "labour": {
            "population15Plus": 940063,
            "active": 489284,
            "inactive": 449985,
            "activityRate": 52.1,
            "unemploymentRate": 15.3,
            "employed": 414399
          }
        },
        "male": {
          "population": {
            "municipal": 644380
          },
          "labour": {
            "population15Plus": 472773,
            "active": 350602,
            "inactive": 121457,
            "activityRate": 74.3,
            "unemploymentRate": 14.4,
            "employed": 300274
          }
        },
        "female": {
          "population": {
            "municipal": 628338
          },
          "labour": {
            "population15Plus": 467290,
            "active": 138682,
            "inactive": 328528,
            "activityRate": 29.7,
            "unemploymentRate": 17.7,
            "employed": 114125
          }
        }
      },
      "rural": null
    },
    "households": {
      "total": {
        "amenities": {
          "kitchen": 98.7,
          "toilet": 99.8,
          "bathroom": 73.7,
          "electricity": 99.4,
          "runningWater": 98.8
        }
      },
      "urban": {
        "amenities": {
          "kitchen": 98.7,
          "toilet": 99.8,
          "bathroom": 73.7,
          "electricity": 99.4,
          "runningWater": 98.8
        }
      },
      "rural": null
    },
    "urbanCentres": []
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/01.511.01.0/indicators.json",
    "prev": null,
    "next": null
  }
}

Réduit ici à quelques thèmes. Le fichier les a tous.

GET /api/indicators.json

Les chiffres du Maroc aux recensements de 2024 et 2014

Les mêmes indicateurs pour l’ensemble du pays.

  • 200Les indicateurs du Maroc.
Exemple · GET /api/indicators.json
{
  "data": {
    "2014": {
      "people": {
        "total": {
          "all": {
            "population": {
              "legal": 33848242,
              "municipal": 33610084
            },
            "age": {
              "0-4": 10.2,
              "5-9": 9,
              "10-14": 9,
              "15-19": 8.9,
              "20-24": 9.1,
              "25-29": 8.3,
              "30-34": 7.8,
              "35-39": 7,
              "40-44": 6.4,
              "45-49": 5.4,
              "50-54": 5.3,
              "55-59": 4.1,
              "60-64": 3.4,
              "65-69": 1.9,
              "70-74": 1.7,
              "75+": 2.5
            },
            "maritalStatus": {
              "single": 53.2,
              "married": 41.4,
              "divorced": 1.6,
              "widowed": 3.9,
              "singulateMeanAgeAtMarriage": 28.5
            },
            "disability": {
              "prevalence": 5.1
            },
            "fertility": {
              "completedFertility": 3.46,
              "totalFertilityRate": 2.22
            },
            "schooling": {
              "rate7to12": 95.1
            },
            "illiteracy": {
              "rate10Plus": 32.2
            },
            "languageCombinations": {
              "arabicOnly": 30.9,
              "arabicAndFrench": 45.4,
              "arabicFrenchEnglish": 18.4,
              "other": 5.2
            },
            "education": {
              "none": 36.9,
              "preschool": 4.7,
              "primary": 28,
              "lowerSecondary": 14.3,
              "upperSecondary": 10,
              "higher": 6.1
            },
            "localLanguages": {
              "darija": 90.9,
              "tachelhit": 14.1,
              "tamazight": 7.9,
              "tarifit": 4,
              "hassania": 0.8
            },
            "labour": {
              "active": 11548464,
              "inactive": 22061620,
              "activityRate": 47.6,
              "unemploymentRate": 16.2
            },
            "employmentStatus": {
              "employer": 2.9,
              "selfEmployed": 29.8,
              "publicSector": 10.2,
              "privateSector": 47.6,
              "familyWorker": 6.5,
              "apprentice": 0.9,
              "cooperativeMember": 1.8,
              "other": 0.4
            },
            "commute": {
              "employed": 9619080,
              "walking": 47.1,
              "bikeOrMotorcycle": 9.1,
              "privateCar": 10.4,
              "bus": 8.2,
              "taxi": 10.7,
              "employerTransport": 4.5,
              "train": 0.4,
              "tram": 0.3,
              "other": 2.7,
              "worksAtHome": 3.1,
              "undetermined": 3.4
            },
            "workplace": {
              "atHome": 3.1,
              "ownNeighbourhood": 36.4,
              "otherNeighbourhood": 18.3,
              "otherCommune": 13.7,
              "otherProvince": 10.4,
              "noFixedPlace": 13.9,
              "elsewhere": 0.9,
              "undetermined": 3.3
            },
            "study": {
              "students": 8392290,
              "ownNeighbourhood": 48.9,
              "otherNeighbourhood": 26.7,
              "otherCommune": 8.8,
              "otherProvince": 5.3,
              "elsewhere": 0.2,
              "undetermined": 10.1
            },
            "studyCommute": {
              "walking": 69.3,
              "bikeOrMotorcycle": 2.5,
              "privateCar": 2.8,
              "bus": 6.3,
              "taxi": 3.4,
              "schoolTransport": 4.6,
              "train": 0.3,
              "tram": 0.3,
              "other": 0.9,
              "undetermined": 9.7
            },
            "profession": {
              "employed": 9627341,
              "managersAndProfessionals": 7,
              "technicians": 3.3,
              "clerks": 13.9,
              "traders": 7.6,
              "farmers": 10.4,
              "artisans": 22.5,
              "farmLabourers": 12.7,
              "machineOperators": 4,
              "labourers": 16.6,
              "unclassified": 1.9
            },
            "workSector": {
              "agriculture": 23.5,
              "industry": 11.8,
              "utilities": 0.6,
              "construction": 14.4,
              "commerce": 16,
              "transport": 5.2,
              "marketServices": 14,
              "publicServices": 11.6,
              "other": 2.8
            },
            "diploma": {
              "population10Plus": 27172768,
              "primary": 21.1,
              "lowerSecondary": 12.2,
              "upperSecondary": 6.6,
              "bachelor": 3.1,
              "masterOrDoctorate": 1.1,
              "undeclared": 0,
              "none": 55.9
            },
            "vocationalDiploma": {
              "specialisedTechnician": 1.7,
              "technician": 2.1,
              "qualification": 2.4,
              "specialisation": 0.6,
              "initiation": 0.6,
              "undeclared": 0,
              "none": 92.5
            }
          },
          "male": {
            "population": {
              "municipal": 16747522
            },
            "age": {
              "0-4": 10.4,
              "5-9": 9.2,
              "10-14": 9.3,
              "15-19": 8.9,
              "20-24": 9,
              "25-29": 8.2,
              "30-34": 7.7,
              "35-39": 6.8,
              "40-44": 6.3,
              "45-49": 5.3,
              "50-54": 5.3,
              "55-59": 4.2,
              "60-64": 3.4,
              "65-69": 1.9,
              "70-74": 1.6,
              "75+": 2.4
            },
            "maritalStatus": {
              "single": 57.9,
              "married": 40.8,
              "divorced": 0.7,
              "widowed": 0.6,
              "singulateMeanAgeAtMarriage": 31.3
            },
            "disability": {
              "prevalence": 5
            },
            "fertility": {
              "completedFertility": null,
              "totalFertilityRate": null
            },
            "schooling": {
              "rate7to12": 95.7
            },
            "illiteracy": {
              "rate10Plus": 22.2
            },
            "languageCombinations": {
              "arabicOnly": 31.8,
              "arabicAndFrench": 45.4,
              "arabicFrenchEnglish": 17.3,
              "other": 5.5
            },
            "education": {
              "none": 28.5,
              "preschool": 6.4,
              "primary": 30.6,
              "lowerSecondary": 16.7,
              "upperSecondary": 11,
              "higher": 6.8
            },
            "localLanguages": {
              "darija": 92.2,
              "tachelhit": 14.2,
              "tamazight": 7.9,
              "tarifit": 4,
              "hassania": 0.8
            },
            "labour": {
              "active": 9030773,
              "inactive": 7716749,
              "activityRate": 75.5,
              "unemploymentRate": 12.4
            },
            "employmentStatus": {
              "employer": 3.1,
              "selfEmployed": 33.4,
              "publicSector": 9.3,
              "privateSector": 45.3,
              "familyWorker": 5.6,
              "apprentice": 1,
              "cooperativeMember": 1.9,
              "other": 0.4
            },
            "commute": {
              "employed": 7862051,
              "walking": 48.4,
              "bikeOrMotorcycle": 10.8,
              "privateCar": 10.4,
              "bus": 8,
              "taxi": 10,
              "employerTransport": 3.6,
              "train": 0.4,
              "tram": 0.2,
              "other": 3,
              "worksAtHome": 2,
              "undetermined": 3.1
            },
            "workplace": {
              "atHome": 2,
              "ownNeighbourhood": 37.7,
              "otherNeighbourhood": 17.3,
              "otherCommune": 12.8,
              "otherProvince": 10.5,
              "noFixedPlace": 15.7,
              "elsewhere": 1,
              "undetermined": 3
            },
            "study": {
              "students": 4451894,
              "ownNeighbourhood": 48.5,
              "otherNeighbourhood": 26.8,
              "otherCommune": 9.5,
              "otherProvince": 5.6,
              "elsewhere": 0.2,
              "undetermined": 9.3
            },
            "studyCommute": {
              "walking": 69,
              "bikeOrMotorcycle": 3.4,
              "privateCar": 2.7,
              "bus": 6.3,
              "taxi": 3.6,
              "schoolTransport": 4.5,
              "train": 0.3,
              "tram": 0.3,
              "other": 1,
              "undetermined": 8.9
            },
            "profession": {
              "employed": 7868873,
              "managersAndProfessionals": 5.6,
              "technicians": 2.5,
              "clerks": 13.1,
              "traders": 8.7,
              "farmers": 12.1,
              "artisans": 22.9,
              "farmLabourers": 12.5,
              "machineOperators": 4.9,
              "labourers": 16,
              "unclassified": 1.7
            },
            "workSector": {
              "agriculture": 25,
              "industry": 9.7,
              "utilities": 0.6,
              "construction": 17.4,
              "commerce": 17.7,
              "transport": 5.9,
              "marketServices": 11.7,
              "publicServices": 9.4,
              "other": 2.5
            },
            "diploma": {
              "population10Plus": 13458638,
              "primary": 24.4,
              "lowerSecondary": 13.6,
              "upperSecondary": 7.1,
              "bachelor": 3.4,
              "masterOrDoctorate": 1.4,
              "undeclared": 0,
              "none": 50
            },
            "vocationalDiploma": {
              "specialisedTechnician": 1.8,
              "technician": 2.6,
              "qualification": 3,
              "specialisation": 0.8,
              "initiation": 0.6,
              "undeclared": 0,
              "none": 91.2
            }
          },
          "female": {
            "population": {
              "municipal": 16862562
            },
            "age": {
              "0-4": 9.9,
              "5-9": 8.8,
              "10-14": 8.8,
              "15-19": 8.8,
              "20-24": 9.1,
              "25-29": 8.4,
              "30-34": 8,
              "35-39": 7.2,
              "40-44": 6.5,
              "45-49": 5.6,
              "50-54": 5.4,
              "55-59": 4,
              "60-64": 3.3,
              "65-69": 1.9,
              "70-74": 1.8,
              "75+": 2.6
            },
            "maritalStatus": {
              "single": 48.4,
              "married": 42,
              "divorced": 2.4,
              "widowed": 7.1,
              "singulateMeanAgeAtMarriage": 25.7
            },
            "disability": {
              "prevalence": 5.1
            },
            "fertility": {
              "completedFertility": 3.46,
              "totalFertilityRate": 2.22
            },
            "schooling": {
              "rate7to12": 94.4
            },
            "illiteracy": {
              "rate10Plus": 42.1
            },
            "languageCombinations": {
              "arabicOnly": 29.7,
              "arabicAndFrench": 45.4,
              "arabicFrenchEnglish": 20,
              "other": 4.9
            },
            "education": {
              "none": 45.2,
              "preschool": 3,
              "primary": 25.4,
              "lowerSecondary": 12,
              "upperSecondary": 8.9,
              "higher": 5.4
            },
            "localLanguages": {
              "darija": 89.7,
              "tachelhit": 14.1,
              "tamazight": 8,
              "tarifit": 4.1,
              "hassania": 0.8
            },
            "labour": {
              "active": 2517691,
              "inactive": 14344871,
              "activityRate": 20.4,
              "unemploymentRate": 29.6
            },
            "employmentStatus": {
              "employer": 2,
              "selfEmployed": 14.5,
              "publicSector": 14,
              "privateSector": 57.3,
              "familyWorker": 10.3,
              "apprentice": 0.4,
              "cooperativeMember": 1,
              "other": 0.5
            },
            "commute": {
              "employed": 1757029,
              "walking": 41.4,
              "bikeOrMotorcycle": 1.5,
              "privateCar": 10.6,
              "bus": 9.1,
              "taxi": 13.4,
              "employerTransport": 8.3,
              "train": 0.5,
              "tram": 0.6,
              "other": 1.4,
              "worksAtHome": 8.4,
              "undetermined": 4.6
            },
            "workplace": {
              "atHome": 8.4,
              "ownNeighbourhood": 30.4,
              "otherNeighbourhood": 22.9,
              "otherCommune": 17.5,
              "otherProvince": 10,
              "noFixedPlace": 5.5,
              "elsewhere": 0.6,
              "undetermined": 4.6
            },
            "study": {
              "students": 3940396,
              "ownNeighbourhood": 49.4,
              "otherNeighbourhood": 26.7,
              "otherCommune": 8,
              "otherProvince": 4.9,
              "elsewhere": 0.2,
              "undetermined": 10.9
            },
            "studyCommute": {
              "walking": 69.6,
              "bikeOrMotorcycle": 1.4,
              "privateCar": 2.9,
              "bus": 6.3,
              "taxi": 3.2,
              "schoolTransport": 4.7,
              "train": 0.3,
              "tram": 0.4,
              "other": 0.7,
              "undetermined": 10.5
            },
            "profession": {
              "employed": 1758468,
              "managersAndProfessionals": 13.5,
              "technicians": 6.6,
              "clerks": 17.6,
              "traders": 2.7,
              "farmers": 2.8,
              "artisans": 20.4,
              "farmLabourers": 14,
              "machineOperators": 0.3,
              "labourers": 19.1,
              "unclassified": 3
            },
            "workSector": {
              "agriculture": 16.8,
              "industry": 21.3,
              "utilities": 0.6,
              "construction": 1.1,
              "commerce": 8.4,
              "transport": 1.8,
              "marketServices": 24.5,
              "publicServices": 21.4,
              "other": 4.1
            },
            "diploma": {
              "population10Plus": 13714130,
              "primary": 17.9,
              "lowerSecondary": 10.8,
              "upperSecondary": 6,
              "bachelor": 2.8,
              "masterOrDoctorate": 0.8,
              "undeclared": 0,
              "none": 61.6
            },
            "vocationalDiploma": {
              "specialisedTechnician": 1.6,
              "technician": 1.5,
              "qualification": 1.9,
              "specialisation": 0.4,
              "initiation": 0.6,
              "undeclared": 0,
              "none": 93.9
            }
          }
        },
        "urban": {
          "all": {
            "population": {
              "legal": null,
              "municipal": 20284436
            },
            "age": {
              "0-4": 9.4,
              "5-9": 8.4,
              "10-14": 8.3,
              "15-19": 8.4,
              "20-24": 9.1,
              "25-29": 8.5,
              "30-34": 8.1,
              "35-39": 7.3,
              "40-44": 6.9,
              "45-49": 6,
              "50-54": 5.9,
              "55-59": 4.5,
              "60-64": 3.5,
              "65-69": 1.9,
              "70-74": 1.6,
              "75+": 2.3
            },
            "maritalStatus": {
              "single": 52.5,
              "married": 41.6,
              "divorced": 2,
              "widowed": 4,
              "singulateMeanAgeAtMarriage": 29.2
            },
            "disability": {
              "prevalence": 4.8
            },
            "fertility": {
              "completedFertility": 2.93,
              "totalFertilityRate": 2.03
            },
            "schooling": {
              "rate7to12": 97.8
            },
            "illiteracy": {
              "rate10Plus": 22.6
            },
            "languageCombinations": {
              "arabicOnly": 25.6,
              "arabicAndFrench": 46.4,
              "arabicFrenchEnglish": 23.1,
              "other": 4.9
            },
            "education": {
              "none": 27.7,
              "preschool": 5.2,
              "primary": 26.6,
              "lowerSecondary": 17.2,
              "upperSecondary": 14.2,
              "higher": 9.2
            },
            "localLanguages": {
              "darija": 96.3,
              "tachelhit": 11.5,
              "tamazight": 5.1,
              "tarifit": 3.8,
              "hassania": 1.2
            },
            "labour": {
              "active": 7369399,
              "inactive": 12915037,
              "activityRate": 49.1,
              "unemploymentRate": 19.3
            },
            "employmentStatus": {
              "employer": 3.7,
              "selfEmployed": 25.2,
              "publicSector": 14.4,
              "privateSector": 52.3,
              "familyWorker": 1.2,
              "apprentice": 0.9,
              "cooperativeMember": 1.8,
              "other": 0.4
            },
            "commute": {
              "employed": 5932706,
              "walking": 38,
              "bikeOrMotorcycle": 9.7,
              "privateCar": 14.8,
              "bus": 8.5,
              "taxi": 12.3,
              "employerTransport": 6.6,
              "train": 0.6,
              "tram": 0.4,
              "other": 2.1,
              "worksAtHome": 3.1,
              "undetermined": 3.8
            },
            "workplace": {
              "atHome": 3.1,
              "ownNeighbourhood": 22.5,
              "otherNeighbourhood": 26.9,
              "otherCommune": 16.7,
              "otherProvince": 10.6,
              "noFixedPlace": 15.5,
              "elsewhere": 0.9,
              "undetermined": 3.7
            },
            "study": {
              "students": 5586730,
              "ownNeighbourhood": 46.1,
              "otherNeighbourhood": 31.8,
              "otherCommune": 6.8,
              "otherProvince": 5.5,
              "elsewhere": 0.2,
              "undetermined": 9.6
            },
            "studyCommute": {
              "walking": 68.7,
              "bikeOrMotorcycle": 1.7,
              "privateCar": 3.8,
              "bus": 7,
              "taxi": 2.6,
              "schoolTransport": 5.7,
              "train": 0.5,
              "tram": 0.5,
              "other": 0.4,
              "undetermined": 9.1
            },
            "profession": {
              "employed": 5932706,
              "managersAndProfessionals": 10.7,
              "technicians": 5,
              "clerks": 19,
              "traders": 9.4,
              "farmers": 1.3,
              "artisans": 26.3,
              "farmLabourers": 2.9,
              "machineOperators": 4.7,
              "labourers": 18.1,
              "unclassified": 2.5
            },
            "workSector": {
              "agriculture": 4.4,
              "industry": 15.7,
              "utilities": 0.9,
              "construction": 13.1,
              "commerce": 20.3,
              "transport": 6.5,
              "marketServices": 18.7,
              "publicServices": 16.8,
              "other": 3.6
            },
            "diploma": {
              "population10Plus": 16684508,
              "primary": 23.2,
              "lowerSecondary": 16.5,
              "upperSecondary": 9.5,
              "bachelor": 4.6,
              "masterOrDoctorate": 1.8,
              "undeclared": 0,
              "none": 44.4
            },
            "vocationalDiploma": {
              "specialisedTechnician": 2.6,
              "technician": 3.1,
              "qualification": 3.6,
              "specialisation": 0.9,
              "initiation": 0.9,
              "undeclared": 0,
              "none": 88.9
            }
          },
          "male": {
            "population": {
              "municipal": 10034689
            },
            "age": {
              "0-4": 9.7,
              "5-9": 8.6,
              "10-14": 8.6,
              "15-19": 8.5,
              "20-24": 9,
              "25-29": 8.3,
              "30-34": 7.9,
              "35-39": 7.1,
              "40-44": 6.7,
              "45-49": 5.8,
              "50-54": 5.8,
              "55-59": 4.7,
              "60-64": 3.7,
              "65-69": 1.9,
              "70-74": 1.5,
              "75+": 2.1
            },
            "maritalStatus": {
              "single": 57.2,
              "married": 41.4,
              "divorced": 0.8,
              "widowed": 0.6,
              "singulateMeanAgeAtMarriage": 32.1
            },
            "disability": {
              "prevalence": 4.6
            },
            "fertility": {
              "completedFertility": null,
              "totalFertilityRate": null
            },
            "schooling": {
              "rate7to12": 97.8
            },
            "illiteracy": {
              "rate10Plus": 14
            },
            "languageCombinations": {
              "arabicOnly": 26,
              "arabicAndFrench": 46.8,
              "arabicFrenchEnglish": 21.9,
              "other": 5.3
            },
            "education": {
              "none": 20.4,
              "preschool": 6.5,
              "primary": 29,
              "lowerSecondary": 19,
              "upperSecondary": 15.3,
              "higher": 10
            },
            "localLanguages": {
              "darija": 96.7,
              "tachelhit": 12,
              "tamazight": 5.1,
              "tarifit": 3.7,
              "hassania": 1.2
            },
            "labour": {
              "active": 5390506,
              "inactive": 4644183,
              "activityRate": 73.4,
              "unemploymentRate": 15.2
            },
            "employmentStatus": {
              "employer": 4.1,
              "selfEmployed": 28.9,
              "publicSector": 13.7,
              "privateSector": 48.4,
              "familyWorker": 1.2,
              "apprentice": 1.1,
              "cooperativeMember": 2.1,
              "other": 0.4
            },
            "commute": {
              "employed": 4559158,
              "walking": 39,
              "bikeOrMotorcycle": 12.2,
              "privateCar": 15.2,
              "bus": 8,
              "taxi": 11.3,
              "employerTransport": 5.6,
              "train": 0.6,
              "tram": 0.3,
              "other": 2.4,
              "worksAtHome": 2,
              "undetermined": 3.4
            },
            "workplace": {
              "atHome": 2,
              "ownNeighbourhood": 22.9,
              "otherNeighbourhood": 26.4,
              "otherCommune": 15.6,
              "otherProvince": 10.5,
              "noFixedPlace": 18.3,
              "elsewhere": 1,
              "undetermined": 3.4
            },
            "study": {
              "students": 2872466,
              "ownNeighbourhood": 46.2,
              "otherNeighbourhood": 32.1,
              "otherCommune": 6.9,
              "otherProvince": 5.6,
              "elsewhere": 0.3,
              "undetermined": 9
            },
            "studyCommute": {
              "walking": 69.1,
              "bikeOrMotorcycle": 2.4,
              "privateCar": 3.8,
              "bus": 6.7,
              "taxi": 2.4,
              "schoolTransport": 5.6,
              "train": 0.5,
              "tram": 0.4,
              "other": 0.4,
              "undetermined": 8.5
            },
            "profession": {
              "employed": 4559158,
              "managersAndProfessionals": 8.9,
              "technicians": 4.1,
              "clerks": 18.4,
              "traders": 11.4,
              "farmers": 1.6,
              "artisans": 27.5,
              "farmLabourers": 2.9,
              "machineOperators": 6,
              "labourers": 17.1,
              "unclassified": 2.3
            },
            "workSector": {
              "agriculture": 4.8,
              "industry": 13.3,
              "utilities": 0.9,
              "construction": 16.6,
              "commerce": 23.5,
              "transport": 7.8,
              "marketServices": 15.7,
              "publicServices": 14,
              "other": 3.3
            },
            "diploma": {
              "population10Plus": 8195220,
              "primary": 26,
              "lowerSecondary": 17.9,
              "upperSecondary": 10.1,
              "bachelor": 5,
              "masterOrDoctorate": 2.3,
              "undeclared": 0,
              "none": 38.7
            },
            "vocationalDiploma": {
              "specialisedTechnician": 2.8,
              "technician": 3.8,
              "qualification": 4.2,
              "specialisation": 1.1,
              "initiation": 0.8,
              "undeclared": 0,
              "none": 87.2
            }
          },
          "female": {
            "population": {
              "municipal": 10249747
            },
            "age": {
              "0-4": 9.1,
              "5-9": 8.1,
              "10-14": 8.1,
              "15-19": 8.4,
              "20-24": 9.2,
              "25-29": 8.6,
              "30-34": 8.3,
              "35-39": 7.6,
              "40-44": 7,
              "45-49": 6.1,
              "50-54": 5.9,
              "55-59": 4.3,
              "60-64": 3.3,
              "65-69": 1.9,
              "70-74": 1.7,
              "75+": 2.4
            },
            "maritalStatus": {
              "single": 47.9,
              "married": 41.8,
              "divorced": 3.1,
              "widowed": 7.3,
              "singulateMeanAgeAtMarriage": 26.4
            },
            "disability": {
              "prevalence": 5
            },
            "fertility": {
              "completedFertility": 2.93,
              "totalFertilityRate": 2.03
            },
            "schooling": {
              "rate7to12": 97.9
            },
            "illiteracy": {
              "rate10Plus": 31
            },
            "languageCombinations": {
              "arabicOnly": 25,
              "arabicAndFrench": 46,
              "arabicFrenchEnglish": 24.5,
              "other": 4.5
            },
            "education": {
              "none": 34.9,
              "preschool": 4.1,
              "primary": 24.2,
              "lowerSecondary": 15.4,
              "upperSecondary": 13.1,
              "higher": 8.4
            },
            "localLanguages": {
              "darija": 95.9,
              "tachelhit": 11,
              "tamazight": 5.2,
              "tarifit": 3.8,
              "hassania": 1.2
            },
            "labour": {
              "active": 1978893,
              "inactive": 8270854,
              "activityRate": 25.8,
              "unemploymentRate": 30.5
            },
            "employmentStatus": {
              "employer": 2.3,
              "selfEmployed": 13.2,
              "publicSector": 16.9,
              "privateSector": 64.5,
              "familyWorker": 1.2,
              "apprentice": 0.4,
              "cooperativeMember": 0.9,
              "other": 0.5
            },
            "commute": {
              "employed": 1373548,
              "walking": 34.8,
              "bikeOrMotorcycle": 1.7,
              "privateCar": 13.2,
              "bus": 10.5,
              "taxi": 15.7,
              "employerTransport": 9.9,
              "train": 0.6,
              "tram": 0.8,
              "other": 1.2,
              "worksAtHome": 6.9,
              "undetermined": 4.9
            },
            "workplace": {
              "atHome": 6.9,
              "ownNeighbourhood": 21.2,
              "otherNeighbourhood": 28.4,
              "otherCommune": 20.5,
              "otherProvince": 11.2,
              "noFixedPlace": 6.2,
              "elsewhere": 0.7,
              "undetermined": 4.9
            },
            "study": {
              "students": 2714264,
              "ownNeighbourhood": 46,
              "otherNeighbourhood": 31.5,
              "otherCommune": 6.6,
              "otherProvince": 5.4,
              "elsewhere": 0.2,
              "undetermined": 10.2
            },
            "studyCommute": {
              "walking": 68.2,
              "bikeOrMotorcycle": 1,
              "privateCar": 3.9,
              "bus": 7.3,
              "taxi": 2.8,
              "schoolTransport": 5.8,
              "train": 0.5,
              "tram": 0.5,
              "other": 0.4,
              "undetermined": 9.7
            },
            "profession": {
              "employed": 1373548,
              "managersAndProfessionals": 16.6,
              "technicians": 8.1,
              "clerks": 21.3,
              "traders": 3,
              "farmers": 0.3,
              "artisans": 22.5,
              "farmLabourers": 2.7,
              "machineOperators": 0.4,
              "labourers": 21.7,
              "unclassified": 3.3
            },
            "workSector": {
              "agriculture": 3.1,
              "industry": 23.7,
              "utilities": 0.8,
              "construction": 1.2,
              "commerce": 9.8,
              "transport": 2.2,
              "marketServices": 28.7,
              "publicServices": 26,
              "other": 4.6
            },
            "diploma": {
              "population10Plus": 8489288,
              "primary": 20.5,
              "lowerSecondary": 15.2,
              "upperSecondary": 9,
              "bachelor": 4.2,
              "masterOrDoctorate": 1.3,
              "undeclared": 0,
              "none": 49.8
            },
            "vocationalDiploma": {
              "specialisedTechnician": 2.5,
              "technician": 2.4,
              "qualification": 3,
              "specialisation": 0.7,
              "initiation": 1,
              "undeclared": 0,
              "none": 90.6
            }
          }
        },
        "rural": {
          "all": {
            "population": {
              "legal": null,
              "municipal": 13325648
            },
            "age": {
              "0-4": 11.3,
              "5-9": 10,
              "10-14": 10.1,
              "15-19": 9.5,
              "20-24": 9.1,
              "25-29": 8.1,
              "30-34": 7.4,
              "35-39": 6.5,
              "40-44": 5.6,
              "45-49": 4.6,
              "50-54": 4.5,
              "55-59": 3.5,
              "60-64": 3.1,
              "65-69": 1.9,
              "70-74": 1.9,
              "75+": 2.8
            },
            "maritalStatus": {
              "single": 54.2,
              "married": 41.2,
              "divorced": 0.9,
              "widowed": 3.7,
              "singulateMeanAgeAtMarriage": 27.5
            },
            "disability": {
              "prevalence": 5.5
            },
            "fertility": {
              "completedFertility": 4.53,
              "totalFertilityRate": 2.53
            },
            "schooling": {
              "rate7to12": 91.6
            },
            "illiteracy": {
              "rate10Plus": 47.5
            },
            "languageCombinations": {
              "arabicOnly": 43.5,
              "arabicAndFrench": 43,
              "arabicFrenchEnglish": 7.5,
              "other": 6
            },
            "education": {
              "none": 50.9,
              "preschool": 3.8,
              "primary": 30.2,
              "lowerSecondary": 10,
              "upperSecondary": 3.6,
              "higher": 1.5
            },
            "localLanguages": {
              "darija": 82.7,
              "tachelhit": 18.2,
              "tamazight": 12.2,
              "tarifit": 4.4,
              "hassania": 0.3
            },
            "labour": {
              "active": 4179065,
              "inactive": 9146583,
              "activityRate": 45.1,
              "unemploymentRate": 10.5
            },
            "employmentStatus": {
              "employer": 1.5,
              "selfEmployed": 37.5,
              "publicSector": 3.2,
              "privateSector": 39.7,
              "familyWorker": 15.4,
              "apprentice": 0.7,
              "cooperativeMember": 1.6,
              "other": 0.5
            },
            "commute": {
              "employed": 3686374,
              "walking": 61.8,
              "bikeOrMotorcycle": 8.2,
              "privateCar": 3.5,
              "bus": 7.7,
              "taxi": 8,
              "employerTransport": 1.1,
              "train": 0.2,
              "tram": 0,
              "other": 3.7,
              "worksAtHome": 3.2,
              "undetermined": 2.7
            },
            "workplace": {
              "atHome": 3.2,
              "ownNeighbourhood": 58.7,
              "otherNeighbourhood": 4.6,
              "otherCommune": 8.8,
              "otherProvince": 10,
              "noFixedPlace": 11.3,
              "elsewhere": 0.8,
              "undetermined": 2.6
            },
            "study": {
              "students": 2805560,
              "ownNeighbourhood": 54.5,
              "otherNeighbourhood": 16.6,
              "otherCommune": 12.8,
              "otherProvince": 4.9,
              "elsewhere": 0.2,
              "undetermined": 11
            },
            "studyCommute": {
              "walking": 70.4,
              "bikeOrMotorcycle": 4,
              "privateCar": 0.6,
              "bus": 5,
              "taxi": 4.9,
              "schoolTransport": 2.4,
              "train": 0.1,
              "tram": 0,
              "other": 1.8,
              "undetermined": 10.7
            },
            "profession": {
              "employed": 3694635,
              "managersAndProfessionals": 1.1,
              "technicians": 0.6,
              "clerks": 5.6,
              "traders": 4.7,
              "farmers": 25.1,
              "artisans": 16.2,
              "farmLabourers": 28.6,
              "machineOperators": 3,
              "labourers": 14.1,
              "unclassified": 1
            },
            "workSector": {
              "agriculture": 54.3,
              "industry": 5.7,
              "utilities": 0.2,
              "construction": 16.6,
              "commerce": 9,
              "transport": 3.1,
              "marketServices": 6.5,
              "publicServices": 3.2,
              "other": 1.5
            },
            "diploma": {
              "population10Plus": 10488260,
              "primary": 17.9,
              "lowerSecondary": 5.3,
              "upperSecondary": 1.8,
              "bachelor": 0.7,
              "masterOrDoctorate": 0.1,
              "undeclared": 0,
              "none": 74.2
            },
            "vocationalDiploma": {
              "specialisedTechnician": 0.2,
              "technician": 0.4,
              "qualification": 0.6,
              "specialisation": 0.2,
              "initiation": 0.2,
              "undeclared": 0,
              "none": 98.3
            }
          },
          "male": {
            "population": {
              "municipal": 6712833
            },
            "age": {
              "0-4": 11.5,
              "5-9": 10.1,
              "10-14": 10.2,
              "15-19": 9.6,
              "20-24": 9.1,
              "25-29": 8.1,
              "30-34": 7.4,
              "35-39": 6.5,
              "40-44": 5.6,
              "45-49": 4.5,
              "50-54": 4.4,
              "55-59": 3.5,
              "60-64": 3.1,
              "65-69": 1.9,
              "70-74": 1.8,
              "75+": 2.8
            },
            "maritalStatus": {
              "single": 59,
              "married": 40,
              "divorced": 0.4,
              "widowed": 0.6,
              "singulateMeanAgeAtMarriage": 30.1
            },
            "disability": {
              "prevalence": 5.6
            },
            "fertility": {
              "completedFertility": null,
              "totalFertilityRate": null
            },
            "schooling": {
              "rate7to12": 93
            },
            "illiteracy": {
              "rate10Plus": 34.9
            },
            "languageCombinations": {
              "arabicOnly": 43.8,
              "arabicAndFrench": 42.5,
              "arabicFrenchEnglish": 7.7,
              "other": 5.9
            },
            "education": {
              "none": 40.6,
              "preschool": 6.4,
              "primary": 33,
              "lowerSecondary": 13.4,
              "upperSecondary": 4.7,
              "higher": 2
            },
            "localLanguages": {
              "darija": 85.4,
              "tachelhit": 17.5,
              "tamazight": 12.2,
              "tarifit": 4.3,
              "hassania": 0.3
            },
            "labour": {
              "active": 3640267,
              "inactive": 3072566,
              "activityRate": 78.8,
              "unemploymentRate": 8.3
            },
            "employmentStatus": {
              "employer": 1.6,
              "selfEmployed": 39.7,
              "publicSector": 3.2,
              "privateSector": 40.8,
              "familyWorker": 11.9,
              "apprentice": 0.7,
              "cooperativeMember": 1.6,
              "other": 0.5
            },
            "commute": {
              "employed": 3302893,
              "walking": 61.4,
              "bikeOrMotorcycle": 9,
              "privateCar": 3.8,
              "bus": 8.1,
              "taxi": 8.3,
              "employerTransport": 0.9,
              "train": 0.2,
              "tram": 0,
              "other": 3.9,
              "worksAtHome": 1.9,
              "undetermined": 2.6
            },
            "workplace": {
              "atHome": 1.9,
              "ownNeighbourhood": 58.2,
              "otherNeighbourhood": 4.8,
              "otherCommune": 9,
              "otherProvince": 10.5,
              "noFixedPlace": 12.3,
              "elsewhere": 0.8,
              "undetermined": 2.5
            },
            "study": {
              "students": 1579428,
              "ownNeighbourhood": 52.7,
              "otherNeighbourhood": 17.2,
              "otherCommune": 14.3,
              "otherProvince": 5.8,
              "elsewhere": 0.2,
              "undetermined": 9.9
            },
            "studyCommute": {
              "walking": 68.8,
              "bikeOrMotorcycle": 5.2,
              "privateCar": 0.7,
              "bus": 5.5,
              "taxi": 5.6,
              "schoolTransport": 2.5,
              "train": 0.1,
              "tram": 0,
              "other": 2.1,
              "undetermined": 9.6
            },
            "profession": {
              "employed": 3309715,
              "managersAndProfessionals": 1,
              "technicians": 0.5,
              "clerks": 5.8,
              "traders": 5.1,
              "farmers": 26.6,
              "artisans": 16.6,
              "farmLabourers": 25.6,
              "machineOperators": 3.3,
              "labourers": 14.6,
              "unclassified": 0.9
            },
            "workSector": {
              "agriculture": 52.9,
              "industry": 4.8,
              "utilities": 0.2,
              "construction": 18.4,
              "commerce": 9.6,
              "transport": 3.4,
              "marketServices": 6.1,
              "publicServices": 3.1,
              "other": 1.4
            },
            "diploma": {
              "population10Plus": 5263418,
              "primary": 22,
              "lowerSecondary": 6.9,
              "upperSecondary": 2.4,
              "bachelor": 1,
              "masterOrDoctorate": 0.1,
              "undeclared": 0,
              "none": 67.4
            },
            "vocationalDiploma": {
              "specialisedTechnician": 0.3,
              "technician": 0.6,
              "qualification": 1,
              "specialisation": 0.3,
              "initiation": 0.2,
              "undeclared": 0,
              "none": 97.5
            }
          },
          "female": {
            "population": {
              "municipal": 6612815
            },
            "age": {
              "0-4": 11.1,
              "5-9": 9.9,
              "10-14": 9.9,
              "15-19": 9.5,
              "20-24": 9,
              "25-29": 8.2,
              "30-34": 7.5,
              "35-39": 6.6,
              "40-44": 5.7,
              "45-49": 4.7,
              "50-54": 4.7,
              "55-59": 3.5,
              "60-64": 3.2,
              "65-69": 1.9,
              "70-74": 1.9,
              "75+": 2.8
            },
            "maritalStatus": {
              "single": 49.3,
              "married": 42.5,
              "divorced": 1.4,
              "widowed": 6.8,
              "singulateMeanAgeAtMarriage": 24.8
            },
            "disability": {
              "prevalence": 5.3
            },
            "fertility": {
              "completedFertility": 4.53,
              "totalFertilityRate": 2.53
            },
            "schooling": {
              "rate7to12": 90.1
            },
            "illiteracy": {
              "rate10Plus": 60.1
            },
            "languageCombinations": {
              "arabicOnly": 43.1,
              "arabicAndFrench": 43.8,
              "arabicFrenchEnglish": 7,
              "other": 6.1
            },
            "education": {
              "none": 61.3,
              "preschool": 1.3,
              "primary": 27.4,
              "lowerSecondary": 6.6,
              "upperSecondary": 2.5,
              "higher": 0.9
            },
            "localLanguages": {
              "darija": 80,
              "tachelhit": 18.9,
              "tamazight": 12.3,
              "tarifit": 4.5,
              "hassania": 0.3
            },
            "labour": {
              "active": 538798,
              "inactive": 6074017,
              "activityRate": 11.4,
              "unemploymentRate": 26.2
            },
            "employmentStatus": {
              "employer": 0.9,
              "selfEmployed": 19.1,
              "publicSector": 3.1,
              "privateSector": 30.2,
              "familyWorker": 44.4,
              "apprentice": 0.3,
              "cooperativeMember": 1.7,
              "other": 0.3
            },
            "commute": {
              "employed": 383481,
              "walking": 65.2,
              "bikeOrMotorcycle": 1.1,
              "privateCar": 1.4,
              "bus": 4.4,
              "taxi": 5.2,
              "employerTransport": 2.8,
              "train": 0.2,
              "tram": 0,
              "other": 2.3,
              "worksAtHome": 13.9,
              "undetermined": 3.7
            },
            "workplace": {
              "atHome": 13.9,
              "ownNeighbourhood": 63.4,
              "otherNeighbourhood": 3.3,
              "otherCommune": 6.9,
              "otherProvince": 5.8,
              "noFixedPlace": 3,
              "elsewhere": 0.4,
              "undetermined": 3.5
            },
            "study": {
              "students": 1226132,
              "ownNeighbourhood": 56.9,
              "otherNeighbourhood": 15.8,
              "otherCommune": 10.9,
              "otherProvince": 3.8,
              "elsewhere": 0.1,
              "undetermined": 12.5
            },
            "studyCommute": {
              "walking": 72.5,
              "bikeOrMotorcycle": 2.4,
              "privateCar": 0.6,
              "bus": 4.3,
              "taxi": 4.1,
              "schoolTransport": 2.3,
              "train": 0.1,
              "tram": 0,
              "other": 1.5,
              "undetermined": 12.2
            },
            "profession": {
              "employed": 384920,
              "managersAndProfessionals": 2.3,
              "technicians": 1.3,
              "clerks": 4.2,
              "traders": 1.4,
              "farmers": 11.9,
              "artisans": 12.8,
              "farmLabourers": 54.1,
              "machineOperators": 0.2,
              "labourers": 9.9,
              "unclassified": 1.8
            },
            "workSector": {
              "agriculture": 65.9,
              "industry": 12.7,
              "utilities": 0.1,
              "construction": 1,
              "commerce": 3.4,
              "transport": 0.3,
              "marketServices": 9.6,
              "publicServices": 4.7,
              "other": 2.2
            },
            "diploma": {
              "population10Plus": 5224842,
              "primary": 13.7,
              "lowerSecondary": 3.7,
              "upperSecondary": 1.3,
              "bachelor": 0.4,
              "masterOrDoctorate": 0,
              "undeclared": 0,
              "none": 80.9
            },
            "vocationalDiploma": {
              "specialisedTechnician": 0.2,
              "technician": 0.2,
              "qualification": 0.2,
              "specialisation": 0.1,
              "initiation": 0.1,
              "undeclared": 0,
              "none": 99.2
            }
          }
        }
      },
      "households": {
        "total": {
          "households": {
            "municipalPopulation": 33610084,
            "count": 7313806,
            "averageSize": 4.6,
            "peoplePerRoom": 1.4,
            "distanceToPavedRoadKm": 3
          },
          "dwellingType": {
            "villa": 3.2,
            "apartment": 11.6,
            "moroccanHouse": 56.8,
            "basicOrSlum": 4.5,
            "rural": 22.8,
            "other": 1
          },
          "occupancy": {
            "owner": 71.9,
            "tenant": 18.8,
            "other": 9.2
          },
          "dwellingAge": {
            "under10": 20.1,
            "10-19": 22.2,
            "20-49": 37.4,
            "50+": 20.3
          },
          "amenities": {
            "kitchen": 93.5,
            "toilet": 93.7,
            "bathroom": 54,
            "electricity": 91.6,
            "runningWater": 73
          },
          "wastewater": {
            "publicSewer": 58.9,
            "septicTank": 23.2,
            "other": 17.9
          },
          "householdWaste": {
            "municipalBin": 46.1,
            "truck": 19.3,
            "otherOrOpen": 34.6
          },
          "cookingFuel": {
            "gas": 96.9,
            "electricity": 4.8,
            "charcoal": 1.5,
            "firewood": 10.2,
            "animalWaste": 4.3
          },
          "equipment": {
            "television": 92.5,
            "radio": 52.6,
            "mobilePhone": 94.3,
            "landline": 13.5,
            "internet": 19.3,
            "computer": 25.4,
            "satelliteDish": 84,
            "refrigerator": 85.1
          }
        },
        "urban": {
          "households": {
            "municipalPopulation": 20284436,
            "count": 4807743,
            "averageSize": 4.2,
            "peoplePerRoom": 1.3,
            "distanceToPavedRoadKm": null
          },
          "dwellingType": {
            "villa": 4.5,
            "apartment": 17.5,
            "moroccanHouse": 70.4,
            "basicOrSlum": 5.2,
            "rural": 1.3,
            "other": 1
          },
          "occupancy": {
            "owner": 62.7,
            "tenant": 27.6,
            "other": 9.6
          },
          "dwellingAge": {
            "under10": 20.7,
            "10-19": 23.6,
            "20-49": 40.8,
            "50+": 14.9
          },
          "amenities": {
            "kitchen": 94.9,
            "toilet": 99,
            "bathroom": 58.3,
            "electricity": 95.2,
            "runningWater": 91.3
          },
          "wastewater": {
            "publicSewer": 88.2,
            "septicTank": 9.6,
            "other": 2.2
          },
          "householdWaste": {
            "municipalBin": 68.3,
            "truck": 26.6,
            "otherOrOpen": 5.1
          },
          "cookingFuel": {
            "gas": 99.6,
            "electricity": 6.5,
            "charcoal": 1.1,
            "firewood": 1.4,
            "animalWaste": 0.8
          },
          "equipment": {
            "television": 96.1,
            "radio": 55.4,
            "mobilePhone": 96.5,
            "landline": 19.7,
            "internet": 27.5,
            "computer": 35.7,
            "satelliteDish": 90.4,
            "refrigerator": 91.4
          }
        },
        "rural": {
          "households": {
            "municipalPopulation": 13325648,
            "count": 2506063,
            "averageSize": 5.3,
            "peoplePerRoom": 1.6,
            "distanceToPavedRoadKm": 3
          },
          "dwellingType": {
            "villa": 0.8,
            "apartment": 0.3,
            "moroccanHouse": 30.7,
            "basicOrSlum": 3.1,
            "rural": 64.1,
            "other": 1
          },
          "occupancy": {
            "owner": 89.6,
            "tenant": 1.9,
            "other": 8.5
          },
          "dwellingAge": {
            "under10": 19,
            "10-19": 19.3,
            "20-49": 30.9,
            "50+": 30.7
          },
          "amenities": {
            "kitchen": 90.8,
            "toilet": 83.4,
            "bathroom": 45.9,
            "electricity": 84.6,
            "runningWater": 37.8
          },
          "wastewater": {
            "publicSewer": 2.9,
            "septicTank": 49.2,
            "other": 47.9
          },
          "householdWaste": {
            "municipalBin": 3.4,
            "truck": 5.3,
            "otherOrOpen": 91.3
          },
          "cookingFuel": {
            "gas": 91.7,
            "electricity": 1.7,
            "charcoal": 2.3,
            "firewood": 27.1,
            "animalWaste": 11.2
          },
          "equipment": {
            "television": 85.7,
            "radio": 47.3,
            "mobilePhone": 90.3,
            "landline": 1.5,
            "internet": 3.6,
            "computer": 5.7,
            "satelliteDish": 71.8,
            "refrigerator": 73
          }
        }
      }
    },
    "code": null,
    "codeDigits": null,
    "level": "country",
    "name": {
      "fr": "Maroc",
      "ar": "المغرب"
    },
    "fromLocalAdministration": false,
    "people": {
      "total": {
        "all": {
          "fertility": {
            "totalFertilityRate": 1.97,
            "completedFertility": 2.8
          },
          "localLanguages": {
            "darija": 91.9,
            "tachelhit": 14.2,
            "tamazight": 7.4,
            "tarifit": 3.2,
            "hassania": 0.8
          }
        },
        "male": {
          "localLanguages": {
            "darija": 92.7,
            "tachelhit": 14.2,
            "tamazight": 7.4,
            "tarifit": 3.1,
            "hassania": 0.8
          }
        },
        "female": {
          "fertility": {
            "totalFertilityRate": 1.97,
            "completedFertility": 2.8
          },
          "localLanguages": {
            "darija": 91.1,
            "tachelhit": 14.2,
            "tamazight": 7.5,
            "tarifit": 3.3,
            "hassania": 0.8
          }
        }
      },
      "urban": {
        "all": {
          "fertility": {
            "totalFertilityRate": 1.77,
            "completedFertility": 2.5
          },
          "localLanguages": {
            "darija": 96.3,
            "tachelhit": 11.7,
            "tamazight": 5.1,
            "tarifit": 3,
            "hassania": 1.1
          }
        },
        "male": {
          "localLanguages": {
            "darija": 96.6,
            "tachelhit": 11.9,
            "tamazight": 5.1,
            "tarifit": 2.9,
            "hassania": 1.1
          }
        },
        "female": {
          "fertility": {
            "totalFertilityRate": 1.77,
            "completedFertility": 2.5
          },
          "localLanguages": {
            "darija": 95.9,
            "tachelhit": 11.5,
            "tamazight": 5.2,
            "tarifit": 3.1,
            "hassania": 1.1
          }
        }
      },
      "rural": {
        "all": {
          "fertility": {
            "totalFertilityRate": 2.37,
            "completedFertility": 3.4
          },
          "localLanguages": {
            "darija": 84.5,
            "tachelhit": 18.5,
            "tamazight": 11.3,
            "tarifit": 3.5,
            "hassania": 0.3
          }
        },
        "male": {
          "localLanguages": {
            "darija": 86.3,
            "tachelhit": 18,
            "tamazight": 11.2,
            "tarifit": 3.3,
            "hassania": 0.3
          }
        },
        "female": {
          "fertility": {
            "totalFertilityRate": 2.37,
            "completedFertility": 3.4
          },
          "localLanguages": {
            "darija": 82.7,
            "tachelhit": 19,
            "tamazight": 11.5,
            "tarifit": 3.6,
            "hassania": 0.3
          }
        }
      }
    },
    "households": {
      "total": {
        "households": {
          "municipalPopulation": 36490591,
          "count": 9275038,
          "averageSize": 3.9,
          "sedentary": 9263270,
          "peoplePerRoom": 1.4,
          "distanceToPavedRoadKm": 1.5
        }
      },
      "urban": {
        "households": {
          "municipalPopulation": 22921202,
          "count": 6173930,
          "averageSize": 3.7,
          "sedentary": 6166796,
          "peoplePerRoom": 1.3,
          "distanceToPavedRoadKm": null
        }
      },
      "rural": {
        "households": {
          "municipalPopulation": 13569389,
          "count": 3101108,
          "averageSize": 4.4,
          "sedentary": 3096474,
          "peoplePerRoom": 1.7,
          "distanceToPavedRoadKm": 1.5
        }
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/indicators.json",
    "prev": null,
    "next": null
  }
}

Réduit ici à quelques thèmes. Le fichier les a tous.

GET /api/{collection}/{code}/economy

Les établissements économiques d’une unité, recensés en 2024

Combien d’établissements les équipes du HCP ont relevés dans une région, une province, un cercle, une commune ou un arrondissement, combien sont des services publics, des associations ou des entreprises, et combien d’emplois permanents ces entreprises portent. Les entreprises sont réparties par secteur, par nombre d’employés et par année de création, chaque répartition les couvrant toutes. Les souks hebdomadaires actifs sont comptés à côté. L’agriculture n’y est pas : tous les autres secteurs le sont. Les 6 villes à arrondissements sont comptées par arrondissement : leurs chiffres sont la somme de ceux-ci, signalée par basis. /data/v1/economy/fields.json nomme chaque champ avec l’intitulé du HCP.

collectionobligatoire
regions | provinces | cercles | communes | arrondissementsLe niveau de l’unité.
codeobligatoire
stringUn code à points, les chiffres avec ou sans zéros de tête, ou un slug.
  • 200Les établissements de l’unité.
  • 400Ce n’est pas un identifiant.
  • 404Aucune unité ne porte cet identifiant, ou elle est dans une autre collection.
Exemple · GET /api/communes/tiznit/economy
{
  "data": {
    "code": "09.581.01.07",
    "codeDigits": "095810107",
    "level": "commune",
    "name": {
      "fr": "Tiznit",
      "ar": "تيزنيت"
    },
    "topics": {
      "establishments": {
        "total": 5079,
        "publicServices": 211,
        "nonProfit": 137,
        "weeklySouks": 1,
        "business": 4731,
        "jobs": 8219
      },
      "sector": {
        "industry": 503,
        "construction": 256,
        "commerce": 2600,
        "services": 1372
      },
      "size": {
        "1": 3391,
        "2-3": 1081,
        "4-9": 205,
        "10-49": 47,
        "50+": 7
      },
      "founded": {
        "before1956": 2,
        "1956-1980": 131,
        "1981-1990": 211,
        "1991-2000": 440,
        "2001-2010": 801,
        "2011-2019": 1816,
        "2020+": 1330
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/09.581.01.07/economy.json",
    "prev": null,
    "next": null
  }
}

GET /api/economy.json

Les établissements économiques du Maroc, recensés en 2024

Le même comptage pour l’ensemble du pays.

  • 200Les établissements du Maroc.
Exemple · GET /api/economy.json
{
  "data": {
    "code": null,
    "codeDigits": null,
    "level": "country",
    "name": {
      "fr": "Maroc",
      "ar": "المغرب"
    },
    "topics": {
      "establishments": {
        "total": 1304564,
        "publicServices": 147062,
        "nonProfit": 27481,
        "weeklySouks": 1022,
        "business": 1130021,
        "jobs": 3585475
      },
      "sector": {
        "industry": 154979,
        "construction": 39522,
        "commerce": 587177,
        "services": 348343
      },
      "size": {
        "1": 637834,
        "2-3": 371110,
        "4-9": 90677,
        "10-49": 24961,
        "50+": 5439
      },
      "founded": {
        "before1956": 7446,
        "1956-1980": 32106,
        "1981-1990": 34954,
        "1991-2000": 84809,
        "2001-2010": 191285,
        "2011-2019": 416003,
        "2020+": 363418
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/economy.json",
    "prev": null,
    "next": null
  }
}

GET /api/{collection}/{code}/housing

Le parc logement urbain d'une unité, recensé en 2024

Combien de logements urbains compte une unité, combien sont occupés, vacants ou secondaires, de quel type ils sont, de quel âge, en quoi sont faits leurs murs et leurs toits, combien sont raccordés aux réseaux publics d'électricité, d'eau et d'assainissement, et le déficit en logement du HCP. Tous les chiffres sauf le nombre de logements sont des pourcentages des logements urbains de l'unité. On compte ici des logements et non des ménages : un appartement vacant est ici et dans la fiche de recensement de personne. Une unité sans partie urbaine n'a pas de fichier. /data/v1/housing/fields.json nomme chaque champ avec l'intitulé du classeur.

collectionobligatoire
regions | provinces | cercles | communes | arrondissementsLe niveau de l'unité.
codeobligatoire
stringUn code à points, les chiffres avec ou sans zéros de tête, ou un slug.
  • 200Le parc logement urbain de l'unité.
  • 400Ce n'est pas un identifiant.
  • 404Aucune unité ne porte cet identifiant, elle est dans une autre collection, ou elle n'a pas de logements urbains.
Exemple · GET /api/communes/tiznit/housing
{
  "data": {
    "code": "09.581.01.07",
    "codeDigits": "095810107",
    "level": "commune",
    "name": {
      "fr": "Tiznit",
      "ar": "تيزنيت"
    },
    "topics": {
      "dwellings": {
        "total": 34570,
        "deficitRate": 0.9
      },
      "occupancy": {
        "occupied": 67.2,
        "vacant": 15.2,
        "seasonal": 17.6,
        "unoccupied": 32.8
      },
      "type": {
        "villa": 1.7,
        "apartment": 10.1,
        "traditional": 1.9,
        "modern": 85.7,
        "sound": 99.4,
        "slum": 0.1,
        "ruralType": 0.1,
        "other": 0.3,
        "precarious": 0.6
      },
      "age": {
        "under20": 55.9,
        "20-49": 40.7,
        "50+": 3.3
      },
      "ageByType": {
        "villaUnder20": 76.7,
        "villa20to49": 23.1,
        "villa50Plus": 0.2,
        "apartmentUnder20": 59.2,
        "apartment20to49": 39.5,
        "apartment50Plus": 1.3,
        "traditionalUnder20": 24.8,
        "traditional20to49": 46.6,
        "traditional50Plus": 28.6,
        "modernUnder20": 56,
        "modern20to49": 41,
        "modern50Plus": 3,
        "soundUnder20": 56,
        "sound20to49": 40.7,
        "sound50Plus": 3.3,
        "slumUnder20": 83.3,
        "slum20to49": 16.7,
        "slum50Plus": 0,
        "ruralTypeUnder20": 10.7,
        "ruralType20to49": 89.3,
        "ruralType50Plus": 0,
        "otherUnder20": 40.2,
        "other20to49": 47.4,
        "other50Plus": 12.3,
        "precariousUnder20": 39.1,
        "precarious20to49": 53.6,
        "precarious50Plus": 7.3
      },
      "walls": {
        "concreteOrBrick": 99.1,
        "stone": 0.8,
        "other": 0.1
      },
      "roofs": {
        "slab": 98.4,
        "woodOrTiles": 1.5,
        "sheetMetal": 0,
        "other": 0
      },
      "networks": {
        "electricity": 95,
        "water": 96,
        "sewerage": 84.9
      }
    },
    "urbanCentres": []
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/09.581.01.07/housing.json",
    "prev": null,
    "next": null
  }
}

GET /api/communes/{code}/neighbours

Les communes voisines d’une commune

Chacune avec ses noms et la longueur de la limite que les deux partagent, en km, mesurée le long de leurs limites OpenStreetMap. Sidi Mohamed Benmansour n’a pas de limite, sa liste est donc vide.

codeobligatoire
stringUn code à points, les chiffres avec ou sans zéros de tête, ou un slug.
  • 200Les communes qu’elle borde.
  • 400Ce n’est pas un identifiant.
  • 404Aucune commune ne porte cet identifiant.
Exemple · GET /api/communes/tiznit/neighbours
{
  "data": [
    {
      "code": "09.581.11.07",
      "name": {
        "fr": "El Maader El Kabir",
        "ar": "المعدر الكبير"
      },
      "km": 4.38
    },
    {
      "code": "09.581.11.09",
      "name": {
        "fr": "Ouijjane",
        "ar": "وجان"
      },
      "km": 9.83
    },
    {
      "code": "09.581.11.11",
      "name": {
        "fr": "Reggada",
        "ar": "الركادة"
      },
      "km": 5.98
    },
    {
      "code": "09.581.11.15",
      "name": {
        "fr": "Tnine Aglou",
        "ar": "اثنين أكلو"
      },
      "km": 20.76
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 4
  },
  "links": {
    "self": "/api/communes/09.581.01.07/neighbours.json",
    "prev": null,
    "next": null
  }
}

GET /api/housing.json

Le parc logement urbain du Maroc, recensé en 2024

Les mêmes chiffres pour toutes les villes du pays réunies.

  • 200Le parc logement urbain du Maroc.
Exemple · GET /api/housing.json
{
  "data": {
    "code": null,
    "codeDigits": null,
    "level": "country",
    "name": {
      "fr": "Maroc",
      "ar": "المغرب"
    },
    "topics": {
      "dwellings": {
        "total": 8336782,
        "deficitRate": 4.9
      },
      "occupancy": {
        "occupied": 71.1,
        "vacant": 13.4,
        "seasonal": 15.5,
        "unoccupied": 28.9
      },
      "type": {
        "villa": 3.2,
        "apartment": 31.7,
        "traditional": 2.5,
        "modern": 59.2,
        "sound": 96.6,
        "slum": 2.2,
        "ruralType": 0.6,
        "other": 0.6,
        "precarious": 3.4
      },
      "age": {
        "under20": 59.8,
        "20-49": 33.9,
        "50+": 6.2
      },
      "ageByType": {
        "villaUnder20": 60.3,
        "villa20to49": 34.2,
        "villa50Plus": 5.5,
        "apartmentUnder20": 77.5,
        "apartment20to49": 20,
        "apartment50Plus": 2.5,
        "traditionalUnder20": 22,
        "traditional20to49": 40.7,
        "traditional50Plus": 37.4,
        "modernUnder20": 53.5,
        "modern20to49": 40.2,
        "modern50Plus": 6.3,
        "soundUnder20": 60.8,
        "sound20to49": 33.4,
        "sound50Plus": 5.8,
        "slumUnder20": 28.5,
        "slum20to49": 53,
        "slum50Plus": 18.5,
        "ruralTypeUnder20": 30.7,
        "ruralType20to49": 46.1,
        "ruralType50Plus": 23.2,
        "otherUnder20": 46.2,
        "other20to49": 40.7,
        "other50Plus": 13.1,
        "precariousUnder20": 32,
        "precarious20to49": 49.6,
        "precarious50Plus": 18.4
      },
      "walls": {
        "concreteOrBrick": 98.2,
        "stone": 1.2,
        "other": 0.6
      },
      "roofs": {
        "slab": 96.7,
        "woodOrTiles": 1.6,
        "sheetMetal": 0.8,
        "other": 0.9
      },
      "networks": {
        "electricity": 96.3,
        "water": 95.2,
        "sewerage": 92.6
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/housing.json",
    "prev": null,
    "next": null
  }
}

GET /api/regions.json

Les 12 régions

  • 200Toutes les régions.
Exemple · GET /api/regions.json
{
  "data": [
    {
      "code": "01",
      "codeDigits": "01",
      "name": {
        "fr": "Tanger-Tétouan-Al Hoceima",
        "ar": "طنجة-تطوان-الحسيمة"
      },
      "population": {
        "2024": {
          "total": 4030222,
          "moroccan": 4020545,
          "foreign": 9677,
          "households": 1048860
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "provinceCount": 8,
      "communeCount": 146
    },
    {
      "code": "02",
      "codeDigits": "02",
      "name": {
        "fr": "Oriental",
        "ar": "الشرق"
      },
      "population": {
        "2024": {
          "total": 2294665,
          "moroccan": 2291040,
          "foreign": 3625,
          "households": 575015
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "provinceCount": 8,
      "communeCount": 124
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 12
  },
  "links": {
    "self": "/api/regions.json",
    "prev": null,
    "next": null
  }
}

2 lignes sur 12 affichées ici.

GET /api/provinces.json

Toutes les provinces et préfectures

  • 200Toutes les provinces et préfectures.
Exemple · GET /api/provinces.json
{
  "data": [
    {
      "code": "01.511",
      "codeDigits": "01511",
      "name": {
        "fr": "Tanger-Assilah",
        "ar": "طنجة-أصيلة"
      },
      "population": {
        "2024": {
          "total": 1494413,
          "moroccan": 1487175,
          "foreign": 7238,
          "households": 418844
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "type": "prefecture",
      "regionCode": "01",
      "cercleCount": 2,
      "communeCount": 12
    },
    {
      "code": "01.573",
      "codeDigits": "01573",
      "name": {
        "fr": "M'diq-Fnideq",
        "ar": "المضيق-الفنيدق"
      },
      "population": {
        "2024": {
          "total": 254064,
          "moroccan": 253388,
          "foreign": 676,
          "households": 67797
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "type": "prefecture",
      "regionCode": "01",
      "cercleCount": 0,
      "communeCount": 5
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 83
  },
  "links": {
    "self": "/api/provinces.json",
    "prev": null,
    "next": null
  }
}

2 lignes sur 83 affichées ici.

GET /api/cercles.json

Tous les cercles

  • 200Tous les cercles.
Exemple · GET /api/cercles.json
{
  "data": [
    {
      "code": "01.511.05",
      "codeDigits": "0151105",
      "name": {
        "fr": "Tanger",
        "ar": "طنجة"
      },
      "population": {
        "2024": {
          "total": 60807,
          "moroccan": 60765,
          "foreign": 42,
          "households": 14102
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "regionCode": "01",
      "provinceCode": "01.511",
      "communeCount": 5
    },
    {
      "code": "01.511.03",
      "codeDigits": "0151103",
      "name": {
        "fr": "Assilah",
        "ar": "أصيلة"
      },
      "population": {
        "2024": {
          "total": 33463,
          "moroccan": 33434,
          "foreign": 29,
          "households": 7896
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "regionCode": "01",
      "provinceCode": "01.511",
      "communeCount": 4
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 213
  },
  "links": {
    "self": "/api/cercles.json",
    "prev": null,
    "next": null
  }
}

2 lignes sur 213 affichées ici.

GET /api/version.json

Version du jeu de données, nombre d’enregistrements et date de chaque source

  • 200Le document de version.
Exemple · GET /api/version.json
{
  "data": {
    "api": "v1",
    "counts": {
      "regions": 12,
      "provinces": 83,
      "cercles": 213,
      "communes": 1503,
      "arrondissements": 41
    },
    "sources": {
      "datasetVersion": "1.8.0",
      "sources": [
        {
          "id": "hcp-2024",
          "url": "https://www.hcp.ma/file/242341/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "7e9d3d402cc2fd0d9c4fc941c4f23c6a5e5ddcbefbba80b7540267f8e2728dca",
          "retrievedAt": "2026-09-17"
        },
        {
          "id": "hcp-2024-indicators",
          "url": "https://www.hcp.ma/file/242671/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024, Indicateurs démographiques et socioéconomiques. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "f3d96fcae3c10a2c194b2fe97ee8352a242fb3f36b1b63d4d2a7006176dc7c3e",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2014",
          "url": "https://www.hcp.ma/file/230057/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "e0a7e308c0c1e185e5bec0c080d10635b19e83216d0bf91656554c707bbf0709",
          "retrievedAt": "2026-09-17"
        },
        {
          "id": "hcp-2014-indicators-people",
          "url": "https://www.hcp.ma/file/230045/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs démographiques et socioéconomiques de la population. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "c20c1f7d08c1089bf4610f81a0eac89516a278fddb24b8577588284e2fc9a2d0",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2014-indicators-households",
          "url": "https://www.hcp.ma/file/230042/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs sur les ménages et les conditions d'habitation. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "2fde794a15d0d98889875316666d918f1044f8055610bfb909d056a15fe878a1",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2024-commute",
          "url": "https://www.hcp.ma/file/248301/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024, Indicateurs communaux sur le mode de transport domicile-lieu de travail des actifs occupés. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "30e8fc0047fe7ada2cb1db36e127e8d31966da2e775183b9bb0c7eeffd540027",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2014-mobility",
          "url": "https://www.hcp.ma/file/230011/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs sur la mobilité et le transport par commune. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "ed3c24c0c9dba69cac98c03bf27235211ffdf66e6edd97a84b61d9f0c64aa957",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2024-establishments",
          "url": "https://www.hcp.ma/file/242672/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024, Cartographie des établissements économiques. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "33887f36154129e9fc8eceb6d5393d5b26fae0851f153cdb1ed6358e0aed38ee",
          "retrievedAt": "2026-09-20"
        },
        {
          "id": "hcp-2014-professions",
          "url": "https://www.hcp.ma/file/230028/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs sur les professions et les secteurs d'activité de la population active occupée. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "c3b94173217e306fa14ce628269bd6b1f0855ccf03eb3503e5da08340c58c644",
          "retrievedAt": "2026-09-20"
        },
        {
          "id": "hcp-2014-diplomas",
          "url": "https://www.hcp.ma/file/230031/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs sur les diplômes de la population. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "5b6e4785caa3ef42265d4af4b4e1390195d7c114bbf58a1d9867866826329ad6",
          "retrievedAt": "2026-09-20"
        },
        {
          "id": "hcp-2024-housing",
          "url": "https://www.hcp.ma/file/246208/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024, Indicateurs communaux du parc logement urbain. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "c5ca0d86eef04cac4692cc0fff691e81f77e73726515b12eb17a0d7f3a8ff421",
          "retrievedAt": "2026-09-20"
        },
        {
          "id": "osm",
          "via": "Overpass API",
          "licence": "ODbL-1.0",
          "attribution": "© OpenStreetMap contributors, opendatacommons.org/licenses/odbl/1-0/",
          "snapshot": {
            "earliest": "2026-09-17T16:53:06.964Z",
            "latest": "2026-09-19T02:18:14.612Z",
            "regions": 12
          }
        }
      ]
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/version.json",
    "prev": null,
    "next": null
  }
}

Autres fichiers

Des fichiers statiques pour ce que les routes ci-dessus ne couvrent pas. Comme tout chemin en .json, ils ne coûtent rien.

CheminContenu
/api/regions/{code}.jsonUne région
/api/regions/{code}/provinces.jsonLes provinces et préfectures d’une région
/api/regions/{code}/communes/page/{n}.jsonLes communes d’une région, 50 par page
/api/provinces/{code}.jsonUne province ou une préfecture
/api/provinces/{code}/cercles.jsonLes cercles d’une province
/api/provinces/{code}/communes/page/{n}.jsonLes communes d’une province, 50 par page
/api/cercles/{code}.jsonUn cercle
/api/cercles/{code}/communes/page/{n}.jsonLes communes d’un cercle, 50 par page
/api/communes/page/{n}.jsonToutes les communes, 50 par page
/api/communes/type/{type}/page/{n}.jsonLes communes urbaines ou rurales, par page
/api/communes/{code}.jsonUne commune, par code à points
/api/arrondissements.jsonTous les arrondissements
/api/arrondissements/{code}.jsonUn arrondissement
/api/communes/{code}/boundary.geojsonLa limite d’une commune, en Feature GeoJSON
/api/communes/{code}/neighbours.jsonLes communes qu’une commune touche, et la limite partagée avec chacune
/api/communes/{code}/arrondissements.geojsonLes arrondissements d’une ville, en FeatureCollection GeoJSON
/api/arrondissements/{code}/boundary.geojsonLa limite d’un arrondissement
/api/provinces/{code}/boundary.geojsonLe contour d’une province, obtenu par fusion de ses communes
/api/regions/{code}/boundary.geojsonLe contour d’une région, obtenu par fusion de ses communes
/api/regions/indicators.jsonLes chiffres du recensement de chaque région, pour les comparer
/api/provinces/indicators.jsonLes chiffres du recensement de chaque province, pour les comparer
/api/regions/economy.jsonLes établissements de chaque région, pour les comparer
/api/provinces/economy.jsonLes établissements de chaque province, pour les comparer
/api/arrondissements/indicators.jsonLes chiffres du recensement de chaque arrondissement, l’échelle à laquelle les 6 villes sont comptées
/api/arrondissements/economy.jsonLes établissements de chaque arrondissement, de la même façon
/api/regions/housing.jsonLe parc logement urbain de chaque région, pour les comparer
/api/provinces/housing.jsonLe parc logement urbain de chaque province, pour les comparer
/api/tiles/{z}/{x}/{y}.jsonLes limites découpées en tuiles, que lit /api/communes/at

Erreurs

Une erreur revient sous forme de document problem RFC 9457, de type application/problem+json. Son champ type renvoie à sa description ci-dessous, et detail dit en toutes lettres ce qui ne va pas.

not-found 404
Resource not found. L’identifiant est bien formé mais ne désigne rien, la page est au-delà de la dernière, ou le chemin n’est pas une route.
invalid-code 400
Malformed code or slug. L’identifiant ne se lit ni comme un code ni comme un slug.
invalid-query 400
Invalid query parameter. Un paramètre manque, sort de ses bornes, ou ne va pas avec un autre.
À quoi ça ressemble
{
  "type": "https://<host>/docs/api/#not-found",
  "title": "Resource not found",
  "status": 404,
  "detail": "no unit has code 99.999",
  "instance": "/api/communes/99.999"
}