Project at http://github.com/azavea/opentreemap
- A RESTful API that accepts and returns JSON with endpoints for:
- Tree searching, filtering.
Project at http://github.com/azavea/opentreemap
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Easy example | CartoDB.js</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" /> | |
<style> | |
html, body, #map { | |
height: 100%; |
... | |
<body> | |
<div id="map-container"> | |
<input id="pac-input" class="controls" type="text" | |
placeholder="Enter a location"> | |
<div id="map-canvas"></div> | |
</div> | |
<div id="store-info"> | |
<p>Search an address in the box above, which will autocomplete for you. The nearest 5 store locations will be displayed here with selected details about each location.</p> | |
</div> |
-- union neighboring counties together into one polygon | |
SELECT 1 as cartodb_id, ST_Union(ST_SnapToGrid(the_geom,0.0001)) as the_geom FROM public.cb_2018_us_county_500k where name in ('Tompkins', 'Tioga', 'Broome') and statefp = '36' | |
-- want to update one column with multiple values in the same query? And use a function in a CASE? | |
UPDATE loan_data_copy | |
SET the_geom = ( | |
CASE | |
WHEN city = 'Columbus ' THEN ST_GeomFromText('POINT(33.12 -87.12)', 4326) | |
WHEN city = 'Meridian ' THEN ST_GeomFromText('POINT(33.123 -88.123)', 4326) | |
WHEN city = 'Tuscaloosa' THEN ST_GeomFromText('POINT(33.321 -88.312)', 4326) |
[{"name":101,"address":"5022 Hartley Peavey Dr","city":"Meridian","state":"MS","zip":39305,"loan_balance":750000,"payoff_date":2017,"interest_rate":null,"consumer_commercial":"Commercial ","type_of_loan":null,"employer":"C","the_geom":"0101000020E6100000F901FEDFC72C56C0BE9B1320AF344040","created_at":"2015-05-29T17:17:26Z","updated_at":"2015-06-01T23:08:04Z","the_geom_webmercator":"0101000020110F00007DF9DCAB4AD562C17B27E370FA1F4D41","cartodb_georef_status":true,"cartodb_id":101,"lng":-88.6996994,"lat":32.4115944},{"name":19,"address":"1211 University Blvd","city":"Tuscaloosa","state":"AL","zip":35401,"loan_balance":750000,"payoff_date":2040,"interest_rate":"","consumer_commercial":"Consumer ","type_of_loan":"Mortgage ","employer":"C","the_geom":"0101000020E61000007EDC234072E355C053AD2AA0F59A4040","created_at":"2015-04-22T21:23:03Z","updated_at":"2015-06-01T23:08:04Z","the_geom_webmercator":"0101000020110F0000A273E939029762C17C18E8ECAEEE4D41","cartodb_georef_status":true,"cartodb_id":19,"lng":-87.5538483,"lat": |
https://gist.githubusercontent.com/andrewbt/ad553ea50079b69d5f25/raw/784b7792ba28c8dd7c01a1295b1505dc0c4c750c/commercial-data.json |
Andrews-CartoDB-MacBook-Pro:blog athompson$ grunt serve | |
Running "serve" task | |
Running "clean:dist" (clean) task | |
Cleaning .sass-cache...OK | |
Cleaning .tmp...OK | |
Cleaning _site/404.html...OK | |
Cleaning _site/TrendMap...OK | |
Cleaning _site/academy-torque-js...OK | |
Cleaning _site/allow-robots.txt...OK |
#!/bin/sh | |
CDB_USER=$1 | |
API_KEY=$2 | |
v1=$(uname) | |
if [[ -z $CDB_USER ]] | |
then | |
echo "Missing user" |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Lesson 2 | CARTO.js | CartoDB</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<link rel="shortcut icon" href="https://carto.com/favicon.ico" /> | |
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css"> | |
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" /> |
{ | |
"query": [ | |
"SELECT * INTO carto_geocode FROM (SELECT cdb_geocode_street_point('201 moore st, brooklyn, ny') as the_geom, 'CARTO HQ' as name) AS job", | |
"SELECT * INTO carto_pa_airports FROM (SELECT a.*, b.name state, b.postal FROM states_table b JOIN athompson.ne_10m_airports a ON ST_Contains(b.the_geom, a.the_geom) WHERE postal = 'PA') AS job", | |
"SELECT * INTO carto_nearest_airport FROM (SELECT pa.* FROM carto_pa_airports pa, carto_geocode hq ORDER BY hq.the_geom <-> pa.the_geom LIMIT 1) AS job", | |
"SELECT * INTO carto_philly_route FROM (SELECT r.duration, r.length, r.shape as the_geom FROM carto_geocode g, carto_driveable_airports d, cdb_route_point_to_point(g.the_geom::geometry,d.the_geom::geometry, 'car') r) AS job", | |
"SELECT cdb_cartodbfytable('athompson', 'carto_philly_route')", | |
"SELECT cdb_cartodbfytable('athompson', 'carto_nearest_airport')", | |
"SELECT cdb_cartodbfytable('athompson', 'carto_pa_airports')", | |
"SELECT cdb_cartodbfytable('athompson', 'carto_geocode')" |