Skip to content

Simple REST service to search for UBIGEO codes (geographical location codes for Peru). Reimplemented from something I tested a about a year ago on phpcloud, running now on pagodabox. Note: There is a more up-to-date version of this dataset at https://github.com/CONCYTEC/ubigeo-peru

License

Notifications You must be signed in to change notification settings

sisprotec/ubigeo-peru-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

title author date
ubigeo-peru
Jesus M. Castagnetto
20132014

ubigeo-peru: REST service for UBIGEO code search

REST services to query for Peru's UBIGEO (Peru's geographical location code)

Built using PHP closures with the Slim Framework.

Officially, the UBIGEO codes are assigned by INEI, but in practice the codes given by RENIEC are used (the codes do not match). I have matched the codes and normalize the names, so this web app gives both codes whenever possible.

Demo deployed at Pagodabox at the base URL:

http://ubigeo-peru.gopagoda.io/

If you go to the base URL, you will see the documentation of the services.

All the output is in JSON with utf-8 character encoding

Services

  • code:

    • /ubigeo/code/NNNNNN{/source} (N=0..9; source=reniec|inei|any)
    • Searches for the place with ubigeo code NNNNNN, from the source requested. Valid sources: reniec (default), inei, any
  • place:

    • /ubigeo/place/DEPARTMENT{/PROVINCE{/DISTRICT}}
    • Searches for the ubigeo codes (reniec, inei) for the place given as /DEPARTMENT{/PROVINCE{/DISTRICT}} (the last 2 parameters are optional)
  • like:

    • /ubigeo/like/PARTIALNAME
    • Searches for ubigeo codes (reniec, inei) for places that match PARTIALNAME
  • departments:

    • /ubigeo/departments
    • Lists the ubigeo codes for all departments
  • provinces:

    • /ubigeo/provinces/DEPARTMENT
    • Lists the ubigeo codes for all provinces in DEPARTMENT
  • districts:

    • /ubigeo/districts/DEPARTMENT/PROVINCE
    • Lists the ubigeo codes for all districts for a PROVINCE in a DEPARTMENT

Examples of use:

ubigeo-peru: Servicios REST para la búsqueda de UBIGEO

Servicios REST para buscar los códigos de UBIGEO Peruanos.

Construido empleando closures en PHP con Slim Framework.

Oficialmente, los códigos de UBIGEO son asignados por INEI, pero en la práctica todos usan los asignados por RENIEC (las codificaciones son distintas). He emparejado los códigos de ambas fuentes y normalizados los nombres, de manera que este aplicativo web produce ambos códigos cuando esto es posible.

El aplicativo se encuentra funcionando en Pagodabox en la URL de base:

http://ubigeo-peru.gopagoda.io/

Si navegas a la URL base, podrás ver la documentación de los servicios

Todas las salidas estan en JSON con codificación de caracteres utf-8

Servicios

  • código:

    • /ubigeo/codigo/NNNNNN{/fuente} (N=0..9; fuente=reniec|inei|cualquiera)
    • Busca el lugar con código de ubigeo NNNNNN, en la fuente indicada. Fuentes posibles: reniec (usada por defecto), inei, cualquiera
  • lugar:

    • /ubigeo/lugar/DEPARTAMENTO{/PROVINCIA{/DISTRITO}}
    • Busca los códigos de ubigeo (reniec, inei) para el lugar indicado por el /DEPARTAMENTO/PROVINCIA/DISTRITO (los últimos dos parámetros son opcionales)
  • parecido:

    • /ubigeo/parecido/NOMBREPARCIAL
    • Busca los códigos de ubigeo (reniec, inei) para el lugar con un nombre similar a NOMBREPARCIAL
  • departamentos:

    • /ubigeo/departamentos
    • Lista los códigos de ubigeo de todos los departamentos
  • provincias:

    • /ubigeo/provincias/DEPARTAMENTO
    • Lista los códigos de ubigeo de las provincias en DEPARTAMENTO
  • distritos:

    • /ubigeo/distritos/DEPARTAMENTO/PROVINCIA
    • Lista los códigos de ubigeo de los distritos en la PROVINCIA del DEPARTAMENTO

Ejemplos de uso:

License and Copyright

BSD 2-clause license

Copyright (c) 2013, Jesus M. Castagnetto All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

About

Simple REST service to search for UBIGEO codes (geographical location codes for Peru). Reimplemented from something I tested a about a year ago on phpcloud, running now on pagodabox. Note: There is a more up-to-date version of this dataset at https://github.com/CONCYTEC/ubigeo-peru

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 86.0%
  • Shell 14.0%