Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
SpatialDev - vector tiling fra PostGIS
#!/usr/bin/env bash
COLOR="\033[;35m"
COLOR_RST="\033[0m"
sudo apt-get update
sudo apt-get -y install python-software-properties build-essential curl
#echo -e "${COLOR}--- Installing PHP5 ---${COLOR_RST}"
#sudo apt-get install -y php5 php5-curl
#sudo apt-get install -y libapache2-mod-php5
echo -e "${COLOR}--- Installing PGRestAPI ---${COLOR_RST}"
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install g++ curl libssl-dev apache2-utils git-core
sudo apt-get -y install make
sudo apt-add-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get -y install nodejs
sudo add-apt-repository -y ppa:mapnik/nightly-2.3
sudo apt-get update
sudo apt-get -y install libmapnik libmapnik-dev mapnik-utils python-mapnik
# also install datasource plugins if you need them
sudo apt-get -y install mapnik-input-plugin-gdal
sudo apt-get -y install mapnik-input-plugin-postgis
cd /home/vagrant
git clone https://github.com/spatialdev/PGRestAPI.git
cd PGRestAPI
sudo npm install
##Change settings in /settings/settings.js
ln -s /home/vagrant/PGRestAPI/settings/settings.js /vagrant/settings.js
sudo locale-gen UTF-8
sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales
export LC_ALL="en_US.UTF-8"
#start with:
#sudo node app.js
//Settings.js is not part of the repository. However, it should be deployed with the application and contain deployment-specific settings.
//there is a settings.js.example file that should match the structure and properties of this file that IS checked in to the repo.
var settings = {}
settings.pg = {};
settings.application = {};
settings.tilestream = {};
//application port settings
settings.application.port = 3001;
//settings.application.ip = "localhost"; //Typically localhost. If deploying on Amazon EC2 Ubuntu, comment out this line.
//SSL Settings
//settings.ssl = {};
//settings.ssl.pfx = 'mypfx.pfx';
//settings.ssl.password = 'foo';
//Settings for postgres DB
settings.pg.username = 'username';
settings.pg.password = 'password';
settings.pg.server = 'XXX.XX.XXX.XXX';
settings.pg.port = '5432';
settings.pg.database = 'dbname';
settings.pg.featureLimit = 1000; //how many features to return by default
//settings.otherSchemas = ['sandbox']; //Optionally list postgres schemas other than 'public' to read
//Should the API display postgres views?
settings.displayViews = false;
//Should the API display postgres tables?
settings.displayTables = true;
//Should the API hide any postgres tables or views?
settings.pg.noFlyList = ["att_0"];
//The list of formats to be returned by the Table Query REST endpoint. If ogr2ogr is installed, .shp will be added automatically.
settings.application.formatList =[ 'html', 'GeoJSON', 'esriJSON'];
//Where to write out GeoJSON files?
settings.application.geoJsonOutputFolder = "/public/geojson/output/";
//Optional. If you're using port forwarding or URL rewriting, but need to display full URLs to your assets, this will stand in for the host.
settings.application.publichost = ""; //like myhost.com. Keep this empty if you want to use the default host
settings.application.publicport = "80";
//Epxress Session Secret
settings.epxressSessionSecret = "secret";
//MongoDB Authentication
settings.mongodb = {};
settings.mongodb.db = "mongodb://localhost/authentication";
//Facebook App ID
settings.facebook = {};
settings.facebook.appid = "12345";
settings.facebook.secret = "secret";
//Leaflet version reference
settings.leaflet = {};
settings.leaflet.js = 'http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js?2';
settings.leaflet.css = 'http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css';
settings.jquery = {};
settings.jquery.js = 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js';
// For middleware that checks the referrer header of incoming requests
settings.acceptableReferrers = [];
settings.referrerCheckHints = [];
module.exports = settings;
-- Alle tabeller må være i 4326 og VACUUM ANALYZED og registrert som geometritabeller i PostGIS
--registrere som postgis-geometri med srid http://postgis.net/docs/UpdateGeometrySRID.html
select updategeometrysrid('vector_n50_adminflate','geometri',3857)
--transformere til 4326
ALTER TABLE public.md_friluftomr
ALTER COLUMN wkb_geometry TYPE geometry(geometry,4326) USING ST_Transform(wkb_geometry,4326);
--kjører på hele databasen
VACUUM ANALYZE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment