Skip to content

Instantly share code, notes, and snippets.

@ramiroaznar
Created January 5, 2017 10:23
Show Gist options
  • Save ramiroaznar/6250dae6487d215aa7de7a836d163bdf to your computer and use it in GitHub Desktop.
Save ramiroaznar/6250dae6487d215aa7de7a836d163bdf to your computer and use it in GitHub Desktop.
Obtener geometrías de los datos brutos de datos.gob.es
# Cáceres
update arboles_caceres
set the_geom = cdb_latlng(geo_lat, geo_long);
# Valencia
update arboles_valencia
set the_geom = ST_Transform(ST_SetSrid(ST_MakePoint(x, y), 32630), 4326)
# Castilla y León
with a as(
select
cartodb_id,
arbol_geometria,
(trim(both '(' from (string_to_array(arbol_geometria, ' '))[2]))::numeric as x,
(trim(both ')' from (string_to_array(arbol_geometria, ' '))[3]))::numeric as y
from arboles_cyl
)
update arboles_cyl b
set x = a.x --- y = a.y
from a
where b.cartodb_id = a.cartodb_id
update arboles_cyl
set the_geom = ST_Transform(ST_SetSrid(ST_MakePoint(x, y), 32630), 4326)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment