Code Monkey home page Code Monkey logo

vectorosm's Introduction

  • INSTALL POSTGRES + POSTGIS:

sudo apt-get install python-software-properties

sudo apt-add-repository ppa:sharpie/for-science

sudo apt-add-repository ppa:sharpie/postgis-stable

sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable

sudo apt-get update

sudo apt-get install postgresql-9.1-postgis2 postgresql-contrib-9.1

  • CREATE DATABASE IN POSTGRESQL WITH "OSMUSER" AS OWNER:

sudo -u postgres -i -H

createuser -SdR osmuser

createdb -E UTF8 -O osmuser osm

  • ADD SPATIAL CAPABILITIES TO OSM DATABASE:

createlang plpgsql osm

psql -d osm -f /usr/share/postgresql/contrib/postgis-2.0/postgis.sql

psql -d osm -f /usr/share/postgresql/contrib/postgis-2.0/spatial_ref_sys.sql

psql osm -c "CREATE EXTENSION hstore"

psql osm -c "ALTER TABLE geometry_columns OWNER TO osmuser"

psql osm -c "ALTER TABLE spatial_ref_sys OWNER TO osmuser"

exit

  • INSTALL OSM2PGSQL:

sudo add-apt-repository ppa:kakrueger/openstreetmap

sudo apt-get update

sudo apt-get install osm2pgsql

(When installing it will create a database in PostGIS. If you want to have access to it when asking which users should have access, type "osmuser" after www-data : "www-data osmuser")

  • DOWNLOAD LATEST OSM WORLD PBF FILE:

http://planet.osm.org/pbf/planet-latest.osm.pbf

  • IMPORT OSM FILE TO POSTGRES:

osm2pgsql -m -s -c --drop -j -v --cache-strategy dense --flat-nodes tempFileErase -d osm -U osmuser --unlogged --number-processe 12 -C 12000 --hstore-add-index --exclude-invalid-polygon -r pbf planet-latest.osm.pbf

  • INSTALL NODEJS:

sudo apt-get update

sudo apt-get install python-software-properties python g++ make

sudo add-apt-repository ppa:chris-lea/node.js

sudo apt-get update

sudo apt-get install nodejs

  • INSTALL NODE MODULES THROUGH NPM (Node Package Manager):

(go to project directory "vectorosm" and install the modules locally there. When using NPM, this will download the modules in the current directory. However, it has a -g flag for installing modules globally.)

npm install express

npm install pg

npm install colors

npm install body-parser

  • MAKE PG MODULE ABLE TO CONNECT TO POSTGRES:

(In tileCreator.js type the connection string "anything://user:password@host:port/database")

conString = 'tcp://osmuser:osmpassword@localhost:5432/osm';

  • MODIFY IF NEEDED THE QUERIES FOR EACH ZOOM LEVEL:

(In queryCreator.js queries can be modified to show more or less data for each zoom level if needed)

  • RUN VECTOR TILE SERVER:

node server.js

vectorosm's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.