Skip to content

Instantly share code, notes, and snippets.

@mehak-sachdeva
mehak-sachdeva / Leaflet_working.html
Last active October 16, 2019 15:08
Interactive Map with Leaflet.js
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Layers Control Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://npmcdn.com/leaflet@1.0.0-rc.3/dist/leaflet.css" />

#Carto.js - Lesson 3: Basic Interactivity divided into steps for designing

##Link to the gist: http://bit.ly/ccleaflet

##Data file to use

We will create the visualization using GeoJSON which is a format for encoding a variety of geographic data structure. It follows the following structure:

{
        "type": "Feature",
        "geometry": {

Analyze and Edit using CARTO Builder!

As an introduction to the Builder, the easiest way to delve into the analysis and get accustomed to the new interface is to complete this guided lesson. This lesson, consiting of exercises and subparts, can be accomplished through a CARTO account. The 5 exercises have been defined in a manner that let you go through in a systematic manner to create the following and similar spatial analysis, given the dataset you are exploring and the question you wish to ask with your data.

Have you ever found yourself start with a rich dataset but often at a loss of direction for the questions that can solved through that data? Or inversely, with an insightful question that you wished you could explore with data and analysis, but aren't sure where to begin? We at CARTO, are striving to approach these gaps and through these guided lessons wish to help achieve just that. In this lesson, we explore the question "Which Starbucks stores are the closest to subway stations in Manhattan?"

@mehak-sachdeva
mehak-sachdeva / README.md
Last active September 16, 2016 00:40
U.S. Primary Election Data - 2016

##Link to the gist: http://bit.ly/ccleaflet

##Data file to use

We will create the visualization using GeoJSON which is a format for encoding a variety of geographic data structure. It follows the following structure:

{
        "type": "Feature",
        "geometry": {

Primary Election Results 2016 (County-level data)

The data was downloaded as a .csv file from kaagle.com (https://www.kaggle.com/benhamner/2016-us-election) The geometries were added to this map, using the Data Observatory and populating the counties using the Fips code in the dataset. Please note: Some states and their codes are not in the standard format and hence, despite the existing data, we could not populate the geometries.

##Exloring the dataset As you see, the data consists of votes and vote-fractions for each candidate of each party for the counties of United States.

UPDATE election_results

The data was obtained in the form of a .json file (called Primary.json).

It had the following keys:

[u'dates',
u'processing_time',
u'generated',
u'races',
u'national_summary',
u'load_time',
u'data_load_time']

##URL for the gist : http://bit.ly/2dxJxUM

##Data Observatory: We will query the real-estate data for Los Angeles, CA. We start with an empty map and rename the table to LA:

INSERT INTO LA(the_geom, name)
SELECT *
FROM OBS_GetBoundariesByPointAndRadius(
@mehak-sachdeva
mehak-sachdeva / Chart.js
Last active September 23, 2021 13:36
Interactive Charts
/*!
* Chart.js
* http://chartjs.org/
* Version: 2.3.0
*
* Copyright 2016 Nick Downie
* Released under the MIT license
* https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Chart = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,modul