Code Monkey home page Code Monkey logo

node_postgis_express's Introduction

PostGIS Minimalist Express viewer for Node

Lightweight PostGIS query viewer built on Node

================ This web application for viewing PostGIS http://postgis.net raster queries, geometry via X3D and other output functions like ST_AsSVG utilizing PostGIS 2.0+, X3DOM http://www.x3dom.org/ , JQuery http://jquery.com, and Node.JS

Node.JS libraries - https://github.com/brianc/node-postgres-pure Express - http://expressjs.com/

Requirements

  1. PostGIS 2.0+ (PostGIS 2.1+ with SFCGAL is preferred).
    Note: if you are on windows, we do have http://postgis.net/windows_downloads for upcoming PostGIS 2.2 that have SFCGAL https://github.com/Oslandia/SFCGAL built-in.
  2. Node.JS installed

Installation

  1. Extract
  2. edit the Settings.js (connString variable to point to your postgress database)
  3. At OS shell prompt cd into the extracted folder
  4. Run (only need to do this once)
npm install express
npm install pg.js 
  1. Still in OS shell type: which should launch the web server node postgis_express.js

  2. In a web browser go to: http://localhost:3030

  3. Run the ``` SELECT 1`` example which should out 1


Examples

For Plain Text you can output SVG for example or any text query:

#Raster Example Change to PNG (it usally can handle JPEG also)

SELECT ST_AsPNG(
  ST_AsRaster(
    ST_Buffer(
        ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'), 10,'join=bevel'), 
        200,200,ARRAY['8BUI', '8BUI', '8BUI'], ARRAY[118,154,118], ARRAY[0,0,0]));

#SVG Example

SELECT '<svg width="600" height="600">
 <path fill="none" stroke="red" stroke-width="3" transform="translate(' || 
   (-ST_XMin(geom))::text || ', '  || 
  (ST_YMax(geom))::text || ')" d="' || ST_ASSVG(geom) || '"></path>
  </svg>' As svg
FROM (SELECT 
 'LINESTRING(100 200, 250 220, 300 300, 350 100)'::geometry) As f(geom);

#X3D Example Toggle output to X3d and run -- click a if image doesn't come into view

SELECT '<shape><appearance>
  <material ambientintensity="0.200" containerfield="material" shininess="0.200" diffusecolor="1 0.5 0.6" />
  </appearance>' 
    || replace(ST_AsX3D('TIN(
    ((0 0 0, 1 0 0, 0 1 0, 0 0 0)),
    ((0 0 0, 1 0 0, 0 0 1, 0 0 0)),
    ((0 0 0, 0 0 1, 0 1 0, 0 0 0)),
    ((0 0 1, 1 0 0, 0 1 0, 0 0 1))
            )'::geometry),  
   '<IndexedTriangleSet', '<IndexedTriangleSet solid="false" ') || '</shape>';

node_postgis_express's People

Contributors

robe2 avatar

Watchers

 avatar  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.