{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Read data from a GeoJSON file\n", "\n", "This example illustrates how to read data from a GeoJSON file using GeoPandas." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
cartodb_idfield_1nameaddressrevenuegeometry
010Franklin Ave & Eastern Pkwy341 Eastern Pkwy,Brooklyn, NY 112381321040.772POINT (-73.95901 40.67109)
121607 Brighton Beach Ave607 Brighton Beach Avenue,Brooklyn, NY 112351268080.418POINT (-73.96122 40.57796)
23265th St & 18th Ave6423 18th Avenue,Brooklyn, NY 112041248133.699POINT (-73.98976 40.61912)
343Bay Ridge Pkwy & 3rd Ave7419 3rd Avenue,Brooklyn, NY 112091185702.676POINT (-74.02744 40.63152)
454Caesar's Bay Shopping Center8973 Bay Parkway,Brooklyn, NY 112141148427.411POINT (-74.00098 40.59321)
\n", "
" ], "text/plain": [ " cartodb_id field_1 name \\\n", "0 1 0 Franklin Ave & Eastern Pkwy \n", "1 2 1 607 Brighton Beach Ave \n", "2 3 2 65th St & 18th Ave \n", "3 4 3 Bay Ridge Pkwy & 3rd Ave \n", "4 5 4 Caesar's Bay Shopping Center \n", "\n", " address revenue \\\n", "0 341 Eastern Pkwy,Brooklyn, NY 11238 1321040.772 \n", "1 607 Brighton Beach Avenue,Brooklyn, NY 11235 1268080.418 \n", "2 6423 18th Avenue,Brooklyn, NY 11204 1248133.699 \n", "3 7419 3rd Avenue,Brooklyn, NY 11209 1185702.676 \n", "4 8973 Bay Parkway,Brooklyn, NY 11214 1148427.411 \n", "\n", " geometry \n", "0 POINT (-73.95901 40.67109) \n", "1 POINT (-73.96122 40.57796) \n", "2 POINT (-73.98976 40.61912) \n", "3 POINT (-74.02744 40.63152) \n", "4 POINT (-74.00098 40.59321) " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from geopandas import read_file\n", "\n", "gdf = read_file('https://libs.cartocdn.com/cartoframes/samples/starbucks_brooklyn_geocoded.geojson')\n", "gdf.head()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", " None\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", " Static map image\n", " \n", " \n", "
\n", "
\n", "
\n", " \n", " \n", "
\n", "
\n", "
\n", "\n", " \n", "\n", "
\n", "
\n", " :\n", "
\n", " \n", " \n", "
\n", "
\n", "\n", "
\n", " StackTrace\n", "
    \n", "
    \n", "
    \n", "\n", "\n", "\n", "\n", "\n", "\">\n", "\n", "" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from cartoframes.viz import Layer\n", "\n", "Layer(gdf)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.7" } }, "nbformat": 4, "nbformat_minor": 2 }