diff --git a/scripts/BufferPoint.js b/scripts/BufferPoint.js new file mode 100644 index 00000000..8a4958e6 --- /dev/null +++ b/scripts/BufferPoint.js @@ -0,0 +1,34 @@ +var GEOM = require("../lib/geoscript/geom"); + +print("Point - X: 0, Y: 0"); //http://geoscript.org/js/api/geom/point.html +var Point = new GEOM.Point([0, 0]); //Create a new point at the coordinates [X, Y]. + +print("=========================="); +print(" - [Number] Point.x: " + Point.x); //The first coordinate value. +print(" - [Number] Point.y: " + Point.y); //The second coordinate value. +print(" - [geom.bounds] Point.bounds: " + Point.bounds); //The bounds defined by minimum and maximum x and y values in this geometry. + +print("PointBuffer - bufferDistance: 10"); +//Point.buffer(dist,options) +// - dist: Width of buffer. May be positive, negative, or zero. +// - options: Options for the buffer operation. +// - geom.BUFFER_CAP_BUTT: Used to calculate butt caps for buffer operations. +// - geom.BUFFER_CAP_ROUND: Used to calculate round caps for buffer operations. +// - geom.BUFFER_CAP_SQUARE: Used to calculate square caps for buffer operations. +var bufferDistance = 10; +var bufferOptions = {segs: 8, caps: GEOM.BUFFER_CAP_ROUND, single: false }; +var PointBuffer = Point.buffer(bufferDistance, bufferOptions); + +print("=========================="); +print(" - [Number] PointBuffer.x: " + PointBuffer.x); //The first coordinate value. +print(" - [Number] PointBuffer.y: " + PointBuffer.y); //The second coordinate value. +print(" - [geom.bounds] PointBuffer.bounds: " + PointBuffer.bounds); //The bounds defined by minimum and maximum x and y values in this geometry. + +print("PointBuffer - bufferDistance: 5"); +bufferDistance = 5; +PointBuffer = Point.buffer(bufferDistance, bufferOptions); + +print("=========================="); +print(" - [Number] PointBuffer.x: " + PointBuffer.x); //The first coordinate value. +print(" - [Number] PointBuffer.y: " + PointBuffer.y); //The second coordinate value. +print(" - [geom.bounds] PointBuffer.bounds: " + PointBuffer.bounds); //The bounds defined by minimum and maximum x and y values in this geometry. \ No newline at end of file diff --git a/scripts/Impassable.js b/scripts/Impassable.js new file mode 100644 index 00000000..9193c900 --- /dev/null +++ b/scripts/Impassable.js @@ -0,0 +1,85 @@ +var GEOM = require("../lib/geoscript/geom"); +var FEATURE = require("../lib/geoscript/feature"); +var FILTER = require("../lib/geoscript/filter"); +var PROJ = require("../lib/geoscript/proj"); +var LAYER = require("../lib/geoscript/layer"); +var WORKSPACE = require("../lib/geoscript/workspace"); +var VIEWER = require("../lib/geoscript/viewer"); +var STYLE = require("../lib/geoscript/style"); +var MAP = require("../lib/geoscript/map"); + +print("Opening PostGIS Workspace..."); //http://geoscript.org/js/api/workspace.html + +var PostGIS_Database= new WORKSPACE.PostGIS({database: "GeoScript_Test", host: "192.168.10.140", password: "p0stGISAdm!n", port: "5432", schema: "public", user: "postgres"}); +print(PostGIS_Database); + +var TableDemElevation = PostGIS_Database.get("demelevation"); +//print(Elevation.bounds); +//print(Elevation.count); + +//var Map = new MAP.Map(); +//Map.add(Raster); +//Map.render(); + +//VIEWER.draw(TestLayer); + +TableDemElevation.features.forEach(function(feature) { + print(feature.toString()); + VIEWER.draw(feature); +}); + +//var rect = new FEATURE.Feature({ +// values: { +// geom: new GEOM.Polygon([ +// [ [-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45] ] +// ]), +// name: "Rectangle" +// } +//}); +//VIEWER.draw(rect); +//var RectLayer = PostGIS_Database.get("Rectangle"); +//RectLayer.add(rect); + +//print("Rect.bounds: " + rect.bounds); + +//var Point = new GEOM.Point([0, 0]); //Create a new point at the coordinates [X, Y]. +//var bufferDistance = 3; +//var bufferOptions = {segs: 8, caps: GEOM.BUFFER_CAP_ROUND, single: false }; +//var PointBuffer = Point.buffer(bufferDistance, bufferOptions); +//VIEWER.draw(PointBuffer); + +//var point = new FEATURE.Feature({ +// values: { +// geom: new GEOM.Point([-3, -3]).buffer(bufferDistance, bufferOptions), +// name: "Point" +// } +//}); +//var PointLayer = PostGIS_Database.get("Circle"); +//PointLayer.add(point); + +//TestLayer.query("INTERSECTS(geom, POINT(0 0))").forEach(function(feature) { +// print(feature.toString()); +//}); + +//TestLayer.query("SELECT *").forEach(function(feature) { +// print(feature.toString()); +//}); + +//TestLayer.update(); + +//TestLayer.query("name = 'Metropolis'").forEach(function(feature) { +// print(feature.toString()); +//}); + +//var layer = new LAYER.Layer({name: "Rectangle"}); +//print("layer.name: " + layer.name); +//PostGIS_Database.add(layer); + +//VIEWER.draw(PointLayer); + +PostGIS_Database.close(); //close the connection when we are done. +print("PostGIS Workspace Closed."); + +//var Map = new MAP.Map(); +//Map.add(Elevation); +//Map.render(); \ No newline at end of file diff --git a/scripts/Raster/medford_dem.tif b/scripts/Raster/medford_dem.tif new file mode 100755 index 00000000..61cde26a Binary files /dev/null and b/scripts/Raster/medford_dem.tif differ diff --git a/scripts/TestConnecion.js b/scripts/TestConnecion.js index 39b91cb9..5a735834 100644 --- a/scripts/TestConnecion.js +++ b/scripts/TestConnecion.js @@ -40,7 +40,7 @@ var meta = { connection: null, driver: new Packages.org.postgresql.Driver, setUp: function() { - var uri = "jdbc:postgresql://localhost:5432/postgres"; + var uri = "jdbc:postgresql://localhost:54321/postgres"; var params = new java.util.Properties(); params.setProperty("user", "postgres"); params.setProperty("password", "postgres"); diff --git a/target/jars/postgresql-8.4-701.jdbc3.jar b/target/jars/postgresql-8.4-701.jdbc3.jar index c64b709e..078f3793 100644 Binary files a/target/jars/postgresql-8.4-701.jdbc3.jar and b/target/jars/postgresql-8.4-701.jdbc3.jar differ diff --git a/target/jars/postgresql-8.4-701.jdbc3.jar.BAK b/target/jars/postgresql-8.4-701.jdbc3.jar.BAK new file mode 100644 index 00000000..c64b709e Binary files /dev/null and b/target/jars/postgresql-8.4-701.jdbc3.jar.BAK differ