Georeference by Longitude and Latitude

Describes how to georeference addresses or location coordinates with CARTO Builder.

Georeferencing is a CARTO service that gathers location data, from many different sources, to get the geographical coordinates associated with latitude/longitude columns, city names, postal codes, administrative boundaries, IP addresses, or street addresses. Since CARTO uses coordinates to plot data, the more finite your data (such as an address), the better your results (versus a city name).

CHEATSHEET: Geocode Types

The following types of location text can be geocoded and applied to your data:

  • Latitude and Longitude: Generates location points using two parameter columns, one for latitude values and one for longitude values.
  • Cities: Generates location points using a single parameter column with city name values. For greater accuracy, you can specify a column to be used for the Administrative Region names, or alternatively, specify a column for country names. For both Administrative Regions and country names, you can enter custom values by typing in the name (if the data is within a single region or country. For example, manually type in and select `United States`).
  • Countries: Requires a single parameter column with country names to generate location border geometries as polygons.
  • Administrative Regions: Requires a single parameter column with administrative region names to generate location points. You can also specify a column to be used for country names (if all are unique), or alternatively, type in the custom country name.
  • Postal Codes: If your dataset consists of a column with postal codes, this option geocodes those values to generate location points. Your input data must be a text column. You can also specify a column to be used as a country names, similar to the Administrative Regions option. For specific details about how CARTO geocodes US zip codes, see the Postal Code Geocoder section in the Data Servies API documentation.
  • IP Addresses: Geocodes your data into point geometries for IP addresses. This is useful if you are analyzing location data based on a set of user’s IP addresses.
  • Street Addresses: Geocodes your data into a point geometry for a street address. You can specify the column to be used for the street addresses, in addition to the columns to be used for the city, state and country. You can also specify custom fields using the Advanced Mode.

The Geocode analysis is subject to quota limitations and extra fees may apply. Please request a demo if you are interested in enabling this service for your account.

The Georeference analysis in CARTO Builder enables you to generate location coordinates directly from a map layer. For this guide, let’s convert the location of Paris addresses by latitude and longitude.

Geocode Data into Point Geometries

We will use the location of Paris addresses, provided by openaddresses.io. This example displays the intense flooding that occurred in Paris; similar to the flood that occurred in 1910. The data is derived from Open Data of Paris, and the results are applied as point coordinates.

  1. Import the template .carto file, packaged from “Download resources” of this guide and create the map. Builder opens with Paris data as the first map layer, Natural_water as the second map layer, and Flood_zone as the third map layer.

    Click on “Download resources” from this guide to download the zip file to your local machine. Extract the zip file to view the .carto file(s) used for this guide.

    Notice that the Paris map layer does not identify what type of geometry the data contains.

    Paris layer with no geometries

  2. Switch to the Data View of the Paris map layer and you will notice that there are various columns with address information.

    The Data View and Map View appear as icons on your map visualization when a map layer is selected. Click to switch between viewing your connected dataset as a table, or show the map view of your data.

    Since the original data is in French, the translation of languages may complicate the geocoding of data. We will use the lon and lat columns from our dataset to georeference all of the geometry coordinates.

  3. Click the ANALYSIS tab to add an analysis to the Paris map layer.

  4. Select Georeference from the Add a new analysis options.

    • Keep Longitude and Latitude selected as the Georeference TYPE.

    • You must enter the LATITUDE and LONGITUDE parameters before applying the analysis. For this example, select the lat and lon columns from the Paris dataset.

    • Click APPLY. The analysis confirmation dialog appears, which you can use to apply styling.

    Georeference result

  5. Click STYLE THIS ANALYSIS to visually enhance the buildings within the flood-zone.

    • Change the POINT SIZE to 1.5.
    • Change the POINT COLOR to black.
    • Change the STROKE SIZE to 0.

    Style the analysis

    Optionally, download the final .carto file from the “Download resources” of this guide to see the styling options that were applied.

The analysis geocoded the Paris data into point geometries, and the Georeference analysis is linked to the map layer. You can continue to explore the point geometry data for Paris.

Georeference analysis applied to Paris layer

Geocode with the API

If you are a developer and have access to the CARTO Engine’s to manage your data, view the Geocoding Functions that can be applied with the Data Services API.