This file contains hidden or 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
CREATE OR REPLACE FUNCTION test(VARIADIC param_geoms geometry[]) | |
RETURNS geometry AS | |
$$ | |
DECLARE result geometry := param_geoms[1]; | |
BEGIN | |
IF array_upper(param_geoms,1)>1 AND NOT ST_IsEmpty(param_geoms[1]) THEN | |
FOr i IN2 .. array_upper(param_geoms,1) LOOP | |
result := ST_Intersection(result, param_geoms[i]); | |
IF ST_IsEmpty(result) THEN |
This file contains hidden or 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
SELECT | |
sum(cast(pob2013 as real)) | |
FROM iaac_parcelar02 |
This file contains hidden or 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
with markets as ( | |
select * from iaac_cac where bcn3 = 'MERCATS') | |
, | |
nonmarkets as ( | |
select * from iaac_cac where bcn3 != 'MERCATS' | |
) | |
select | |
row_number() over() as cartodb_id, | |
count(*), | |
markets.the_geom_webmercator as the_geom_webmercator |
This file contains hidden or 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
# sudo -u postgres psql | |
could not change directory to "/root" | |
psql (9.1.11) | |
Type "help" for help. | |
postgres=# \password | |
Enter new password: | |
Enter it again: | |
postgres=# \q | |
# |
This file contains hidden or 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
https://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21UbuntuPGSQL93Apt | |
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04 | |
apt-get install postgresql-9.4 | |
sudo apt-get install postgresql-9.4-postgis-2.1 pgadmin3 postgresql-contrib | |
createuser -d -E -i -l -P -r -s uekeueke |
This file contains hidden or 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
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04 | |
How To Install and Use PostgreSQL on Ubuntu 14.04 | |
How To Install and Use PostgreSQL on Ubuntu 14.04 | |
Apr 28, 2014 PostgreSQL Ubuntu | |
Introduction | |
Relational database management systems are a key component of many web sites and applications. They provide a structured way to store, organize, and access information. |
This file contains hidden or 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
Uninstall just postgis | |
sudo apt-get remove postgis | |
This will remove just the postgis package itself. | |
Uninstall postgis and it's dependencies | |
sudo apt-get remove --auto-remove postgis | |
This will remove the postgis package and any other dependant packages which are no longer needed. | |
Purging your config/data too | |
If you also want to delete your local/config files for postgis then this will work. |
This file contains hidden or 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
-- Table: "cpMad" | |
-- DROP TABLE "cpMad"; | |
CREATE TABLE "cpMad" | |
( | |
id serial NOT NULL, | |
geom geometry(MultiPolygon,25830), | |
id_cp character varying(254), | |
postal_cod character varying(254), |
This file contains hidden or 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
-- Table: categorias25830 | |
-- DROP TABLE categorias25830; | |
CREATE TABLE categorias25830 | |
( | |
pid serial NOT NULL, | |
geom geometry(Point,25830), | |
merchant_category_key character varying, | |
merchant_sub_category_key character varying, |
This file contains hidden or 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
-- Table: agg_barrio_dis_mens | |
-- DROP TABLE agg_barrio_dis_mens; | |
CREATE TABLE agg_barrio_dis_mens | |
( | |
geom geometry(MultiPolygon,25830), | |
geocodigo character varying(15), | |
sum_dif double precision, | |
es_barsandrestaurants double precision, |
NewerOlder