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 (_draw == null) | |
{ | |
_draw = new Draw(BoundMap); //private class-level variable of type ESRI.ArcGIS.Client.Draw | |
_draw.DrawComplete += DrawCompleteHandler; //subscribe to the DrawComplete event | |
_activated = true; | |
_draw.IsEnabled = true; //enable the Draw object | |
} | |
_draw.DrawMode = DrawMode.Point; //set it to Point mode |
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
import requests | |
from pprint import pprint | |
r = requests.get('https://api.stackexchange.com/2.2/tags?page=1&pagesize=100&order=desc&sort=popular&site=gis') | |
data = r.json() | |
print "tag,count" | |
for tag in data["items"]: | |
print tag["name"] + "," + str(tag["count"]) |
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
gdalbuildvrt 6.vrt 6/*.png |
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
python tile_grab.py -b -158;21;-157;22 -d E:\tiles\oahu_img\a -i false -z 6 -u http://www.someserver.net/arcgis/rest/services/ImagerySvc/MapServer/tile/{z}/{y}/{x}.png |
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
app.get('/leonardtown/buildings/:geom', function (req, res, next) { | |
var client = new pg.Client(app.conString); | |
var geom = req.params.geom.toLowerCase(); | |
if ((geom != "features") && (geom != "geometry")) { | |
res.status(404).send("Resource '" + geom + "' not found"); | |
return; | |
} | |
var tablename = "leonardtown_bldgs"; | |
var schemaname = "public"; | |
var fullname = schemaname + "." + tablename; |
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
//SQL to retrieve schema | |
//var sql = "SELECT n.nspname as schemaname,c.relname as table_name,a.attname as column_name,format_type(a.atttypid, a.atttypmod) AS //type,col_description(a.attrelid, a.attnum) as comments"; | |
//sql = sql + " FROM pg_class c INNER JOIN pg_namespace n ON c.relnamespace = n.oid LEFT JOIN pg_attribute a ON a.attrelid = c.oid"; | |
//sql = sql + " WHERE a.attnum > 0 and c.relname = '" + tablename + "' and n.nspname = '" + schemaname + "';"; | |
//SQL to retrieve layer list | |
//sql = "SELECT 'geometry' AS geotype, * FROM geometry_columns UNION SELECT 'geography' as geotype, * FROM geography_columns;"; |
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
/** | |
* retrieve all features that intersect the input GeoJSON geometry | |
*/ | |
app.post('/vector/:schema/:table/:geom/intersect', function (req, res, next) { | |
//console.log(JSON.stringify(req.body)); | |
var queryshape = JSON.stringify(req.body); | |
//continue with the rest of app.post |
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
curl -X POST -d "{ \"type\": \"Point\", \"coordinates\": [-98.35, 39.7] }" -H "Content-Type: application/json" http://localhost:3000/vector/public/states_gen/features/intersect |
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
exports.getFeatureResult = function(result, spatialcol) { | |
var props = new Object; | |
var crsobj = { | |
"type" : "name", | |
"properties" : { | |
"name" : "urn:ogc:def:crs:EPSG:6.3:4326" | |
} | |
}; | |
//builds feature properties from database columns | |
for (var k in result) { |
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); |