This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (ImageFormat.Jpeg.Equals(image.RawFormat)) | |
{ | |
// JPEG | |
} | |
else if (ImageFormat.Png.Equals(image.RawFormat)) | |
{ | |
// PNG | |
} | |
else if (ImageFormat.Gif.Equals(image.RawFormat)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
############################################################################### | |
# $Id$ | |
# | |
# Project: GDAL2Tiles, Google Summer of Code 2007 & 2008 | |
# Global Map Tiles Classes | |
# Purpose: Convert a raster into TMS tiles, create KML SuperOverlay EPSG:4326, | |
# generate a simple HTML viewers based on Google Maps and OpenLayers | |
# Author: Klokan Petr Pridal, klokan at klokan dot cz | |
# Web: http://www.klokan.cz/projects/gdal2tiles/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def WorldFileParameters(self, tx, ty, zoom): | |
"Returns world file (affine transofrmation) parameters of the given tile." | |
bounds = self.TileBounds( tx, ty, zoom) | |
moriginx = bounds[3] + (self.Resolution(zoom) / 2) | |
moriginy = bounds[0] - (self.Resolution(zoom) / 2) | |
return (self.Resolution(zoom), 0.0, 0.0, self.Resolution(zoom) * -1, moriginy, moriginx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
geo = require('./routes/geo'); | |
var app = express(); | |
app.get('/countries/:id/bbox', geo.bbox); | |
app.get('/countries/:id/bbox/:srid', geo.bboxSrid); | |
app.get('/countries/:id/polygon', geo.polygon); | |
app.get('/countries/:id/polygon/:srid', geo.polygonSrid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pg = require('pg'); | |
var conString = "postgres://username:password@hostname.rds.amazonaws.com:5432/database"; //TODO: point to RDS instance | |
exports.bbox = function(req, res) { | |
var client = new pg.Client(conString); | |
client.connect(); | |
var crsobj = {"type": "name","properties": {"name": "urn:ogc:def:crs:EPSG:6.3:4326"}}; | |
var idformat = "'" + req.params.id + "'"; | |
idformat = idformat.toUpperCase(); | |
var query = client.query("select st_asgeojson(st_envelope(shape)) as geojson from ne_countries where iso_a3 = " + idformat + ";"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "feature", | |
"crs": { | |
"type": "name", | |
"properties": { | |
"name": "urn:ogc:def:crs:EPSG:6.3:4326" | |
} | |
}, | |
"geometry": { | |
"type": "Polygon", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dynamically include routes (Controller) | |
fs.readdirSync('./controllers').forEach(function (file) { | |
if(file.substr(-3) == '.js') { | |
route = require('./controllers/' + file); | |
route.controller(app); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var meta = client.query("select * from geometry_columns where f_table_name = '" + tablename + "' and f_table_schema = '" + schemaname + "';"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
meta.on('row', function (row) { | |
var query; | |
var coll; | |
spatialcol = row.f_geometry_column; | |
if (geom == "features") { | |
query = client.query("select st_asgeojson(st_transform(" + spatialcol + ",4326)) as geojson, * from " + fullname + ";"); | |
coll = { | |
type : "FeatureCollection", | |
features : [] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/roll up the results | |
query.on('row', function (result) { | |
if (!result) { | |
return res.send('No data found'); | |
} else { | |
if (geom == "features") { | |
coll.features.push(geojson.getFeatureResult(result, spatialcol)); //use helper function | |
} else if (geom == "geometry") { | |
var shape = JSON.parse(result.geojson); | |
coll.geometries.push(shape); |
OlderNewer