# Demographics LatLon

This service returns the variables with socioeconomic and demographic information of the requested latitude, longitude location. Said location can come from a GPS type device of a cell phone, Laptop, PC, etc. Or information stored in their data repositories.

Required parameters in a Demographics request:

  • latlon: the latitude and longitude values ​​that specify the location for which you want to get Demographics information.
  • key: the API key of your application. This key identifies your application for quota management purposes. Learn to get API key.

# LatLon Demographics Example

The following base service request would have the following structure:

https://apis.geodir.co/demographics/v1/json?latlon=-12.059888,-77.049072&key=YOUR_KEY

Note: Make sure that there is no space between the latitude and longitude values ​​when passed in the latlon parameter.

{
    "status": "OK",
    "groups": [
        {
            "name": "grid_code",
            "description": "Codigo de Identificación Unica",
            "fields": [
                {
                    "name": "grid_code",
                    "value": 660136,
                    "typeField": "integer",
                    "description": "Codigo de Identificación Única"
                }
            ]
        },
        {
            "name": "socioeconomic_level",
            "description": "Nivel Socioeconomico",
            "fields": [
                {
                    "name": "socioeconomic_level",
                    "value": B,
                    "typeField": "text",
                    "description": "Nivel Socioeconomico"
                },
                {
                    "name": "income",
                    "value": 5531.0,
                    "typeField": "double",
                    "description": "Ingreso Promedio Familiar"
                }
            ]
        },
        {
            "name": "population",
            "description": "Población",
            "fields": [
                {
                    "name": "total_population",
                    "value": 387,
                    "typeField": "integer",
                    "description": "Población Total"
                },
                {
                    "name": "male_population",
                    "value": 185,
                    "typeField": "integer",
                    "description": "Según sexo Hombre"
                },
                {
                    "name": "female_population",
                    "value": 202,
                    "typeField": "integer",
                    "description": "Según sexo Mujer"
                }
            ]
        },
        
    ]
}


# Answers from Demographics LatLon

A continuación se muestran los códigos de estado posibles en una respuesta de Demographics.

Below are the possible status codes in a Demographics response.

# Demographics LatLon State Codes

The "status" field within the demographics response object contains the status of the request and may contain debugging information to help you figure out why it isn't working. The "status" field can contain the following values:

  • "OK" indicates that the demographics service produced no errors; the service performed the action correctly.
  • "ZERO_RESULTS" indicates that the demographics service succeeded but returned no results. This can happen if the geocoder was passed a non-existent latlon or out of zone.
  • "OVER_QUERY_LIMIT" indicates that you have exceeded your quota.
  • "REQUEST_DENIED" indicates that your request was denied.
  • "INVALID_REQUEST" generally indicates one of the following:
    • Missing query (address, groups or latlon).
    • Invalid groups or demographics_type was provided.
  • "UNKNOWN_ERROR" indicates that the request could not be processed due to a server error. The request may be successful if you try again.

# Optional Parameters

Optional parameters:

  • Groups: Is a filter with elements separated by a pipe (|). The group filter is also accepted as an optional parameter. Each element consists of a group pair which is a value and completely restricts the demographics results. See more information about the Group filtering.
  • info: is a series of values ​​useful to the client to store complementary information or metadata, these elements must be separated by a pipe (|).

# Group filtering

In a Demographics response, the Demographics API can return results restricted to a specific area. You can specify the restriction using the groups filter. A filter consists of a list of group:value pairs separated by a pipe (|). Filter values ​​support the same partial matching and spell checking methods as other Demographics requests.

The following groups can be used to influence the results, but will not be applied:

  • locality matches locality and sublocality types.

Notes on group filtering:

  • Results are consistent with Geodir Maps, which occasionally produces ZERO_RESULTS responses.
  • For each address segment, specify it in the group parameter.
https://apis.geodir.co/demographics/v1/json?latlon=-12.059888,-77.049072&groups=locality_id:150105&info=cod_peticion:1020|canal:abc|origen_sistema:cde
Last updated: 09/18/2023, 10:30:49 PM