Compare commits

..

8 Commits

Author SHA1 Message Date
Javier Goizueta
14bc873d0e Check removing explicit libgdal1h 2016-09-30 11:24:03 +02:00
Javier Goizueta
aad4c772f6 check revers install order 2016-09-30 11:13:06 +02:00
Javier Goizueta
a0021db87f force postgis scrips downgrade
package installation does not fail now but postgis is not available
2016-09-30 10:58:04 +02:00
Javier Goizueta
c73fcfcfa9 remove explicit postgresql-9.5-postgis-scripts 2016-09-30 10:45:21 +02:00
Javier Goizueta
1bebeb2bb6 remove pg 9.5 2016-09-30 10:31:08 +02:00
Javier Goizueta
a285f8741a fix package version 2016-09-30 10:25:12 +02:00
Javier Goizueta
636a298eda check libgdal1h
should be installed from ppa.launchpad.net/cartodb/gis/ubuntu/
2016-09-30 09:46:34 +02:00
Javier Goizueta
4c4ddd2047 Testing travis 2016-09-30 09:32:51 +02:00
2 changed files with 2 additions and 34 deletions

View File

@@ -38,11 +38,12 @@ before_install:
- sudo apt-get -y remove --purge postgis
- sudo apt-get -y autoremove
# - sudo apt-get -y install libgdal1h=1.11.0-0cdb1~precise3
- sudo apt-get -y install postgresql-9.5=9.5.2-2ubuntu1
- sudo apt-get -y install postgresql-server-dev-9.5=9.5.2-2ubuntu1
- sudo apt-get -y install postgresql-plpython-9.5=9.5.2-2ubuntu1
- sudo apt-get -y install postgresql-9.5-postgis-2.2=2.2.2.0-cdb2
- sudo apt-get -y install postgresql-9.5-postgis-scripts=2.2.2.0-cdb2
- sudo apt-get -y install postgresql-9.5-postgis-2.2=2.2.2.0-cdb2
# configure it to accept local connections from postgres
- echo -e "# TYPE DATABASE USER ADDRESS METHOD \nlocal all postgres trust\nlocal all all trust\nhost all all 127.0.0.1/32 trust" \

View File

@@ -1,33 +0,0 @@
CREATE OR REPLACE FUNCTION CDB_WeightedMedianCenter(geoms geometry[], vals numeric[])
RETURNS geometry(Point, 4326)
AS $$
DECLARE
i INT;
median_val numeric;
median_index INT;
BEGIN
-- find the median value
SELECT percentile_disc(0.5) WITHIN GROUP (ORDER BY v) INTO median_val
FROM unnest(vals) As x(v);
-- find the index of the median value
FOR i in 1..array_length(vals, 1)
LOOP
IF vals[i] < median_val
THEN
median_index := i;
EXIT;
END IF;
END LOOP;
-- return the geometry that has the median value of the dataset
IF ST_GeometryType(geoms[median_index]) <> 'ST_Point'
THEN
RETURN ST_Centroid(geoms[median_index]);
ELSE
RETURN geoms[median_index];
END IF;
END;
$$ LANGUAGE plpgsql;