Documentación de la API

GeoJSON listo para Leaflet/Mapbox. Endpoints idempotentes, GET-only.

API base https://chartismx.com/api

Quickstart

Leaflet

// JS (ejemplo básico)
fetch('https://chartismx.com/api/getGeomDigitalMaps?layerName=municipio&entidad=19&municipio=039')
  .then(r => r.json())
  .then(geo => L.geoJSON(geo).addTo(map));

cURL

curl "https://chartismx.com/api/pointToSeccion?lat=25.67&lng=-100.31"
curl "https://chartismx.com/api/getSeccionesByMunicipio?entidad=19&municipio=039"

Endpoints

Método Ruta Descripción Parámetros
GET /api/entidad2 Lista entidades
GET /api/getDistritos Distritos por entidad entidad
GET /api/getMunicipios Municipios por entidad entidad
GET /api/getLocalidades Localidades por municipio entidad, municipio
GET /api/getColonias Colonias por municipio entidad, municipio
GET /api/getSecciones Secciones por entidad entidad
GET /api/getGeomDigitalMaps GeoJSON por capa layerName + llaves (ver abajo)
GET /api/getSeccionLabels Labels materializados (opcional)
GET /api/getSeccionesByMunicipio Secciones de un municipio entidad, municipio
GET /api/getSeccionesByDistrito Secciones de un distrito entidad, distrito
GET /api/getSeccionesByLocalidad Secciones que tocan una localidad entidad, municipio, localidad
GET /api/getSeccionesByColonia Secciones que tocan una colonia (GID) entidad, municipio, colonia
GET /api/pointToSeccion Punto → sección lat, lng
GET /api/pointContext Contexto administrativo del punto lat, lng

Parámetros por capa (getGeomDigitalMaps)

GeoJSON por capa

  • layerName=entidadentidad
  • layerName=distritoentidad, distrito
  • layerName=municipioentidad, municipio
  • layerName=localidadentidad, municipio, localidad
  • layerName=coloniaentidad, municipio, colonia(gid)
  • layerName=seccionentidad, seccion

Point → Sección

Si el punto cae en borde, se aplica un buffer de 5 m (EPSG:3857) como fallback.

GET https://chartismx.com/api/pointToSeccion?lat=25.67&lng=-100.31

Autenticación

Si necesitas token para entornos públicos, escríbenos a hola@chartismx.com. Habilitamos claves y rate limits por proyecto.

CORS

En producción limita Access-Control-Allow-Origin a tus dominios (p. ej. https://chartismx.com). Las peticiones GET admiten preflight OPTIONS.

Estado del servicio

Endpoint de salud:

GET https://chartismx.com/status