Last active
January 3, 2016 09:09
-
-
Save andrewxhill/8440409 to your computer and use it in GitHub Desktop.
Moving Alaska and Hawaii in CartoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The SQL below was used to tweak a normal dataset of the USA. If you want to download the | |
-- already modified version, head over to, | |
-- https://andrew.cartodb.com/tables/cd113_01_shift/map | |
--Alaska, move and rotate | |
UPDATE cd113_01_shift SET the_geom = ST_Transform(ST_Scale(ST_Translate(the_geom_webmercator,-13000000,-4000000),0.5,0.5),4326) WHERE statefp='02'; | |
UPDATE cd113_01_shift SET the_geom = ST_Transform(ST_Rotate(the_geom_webmercator,pi()/8,-16500000,2800000),4326) WHERE statefp='02' | |
--Hawaii, shift right and scale | |
UPDATE cd113_01_shift SET the_geom = ST_Multi(ST_Transform(ST_Scale(ST_Translate(the_geom_webmercator,-6000000,3000000), 0.5, 0.5),4326)) WHERE statefp='15' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<title>Shifted Alaska/Hawaii | 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, iframe { | |
height: 100%; | |
padding: 0; | |
margin: 0; | |
} | |
</style> | |
</head> | |
<body> | |
<iframe width='100%' height='100%' frameborder='0' src='http://andrew.cartodb.com/viz/84cc0972-7e0c-11e3-a4e1-3085a9a9563c/embed_map?title=true&description=true&search=false&shareable=true&cartodb_logo=true&layer_selector=false&legends=false&scrollwheel=true&sublayer_options=1&sql=&zoom=3¢er_lat=34.95799531086792¢er_lon=-102.216796875'></iframe> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment