# Reading Features From CartoDB using GeoJSON

protocol, script, cartodb

Demonstrates how to load features on OpenLayers using CartoDB SQL API.

CartoDB is an Open Source Geopatial Database on the cloud. It allows you to import your data in shapefiles, KML, OpenStreeMap files, CSV, etc. and then analyze and visualize it. Internally CartoDB uses PostGIS 2.0 so all functionality in PostGIS can be used straight away. CartoDB exposes two APIS. One to generate maps as tiles with interactivity, and another SQL API to retrieve vector data using among other formats, GeoJSON. In this example we do a very simple query to obtain all protected areas in Costa Rica from a public table. You can adapt the SQL to include where clauses or complicate geospatial queries.

View the source code of this page to see how this is done. And check the table on CartoDB for Protected Areas in Costa Rica