This content moved here: https://exploringjs.com/impatient-js/ch_arrays.html#quickref-arrays
This file contains hidden or 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 psycopg2 | |
| from rasterio.io import MemoryFile | |
| conn = pscopg2.connect("<connection string>") | |
| cur = conn.cursor() | |
| # ensure that the GTiff driver is available, | |
| # see https://postgis.net/docs/postgis_gdal_enabled_drivers.html | |
| cur.execute(''' | |
| SET postgis.gdal_enabled_drivers TO 'GTiff'; | |
| SELECT ST_AsGDALRaster(rast, 'GTiff') FROM raster.table; |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link href="https://unpkg.com/leaflet@1.0.2/dist/leaflet.css" rel="stylesheet"> | |
| <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> | |
| <script src="https://unpkg.com/leaflet@1.0.2/dist/leaflet.js"> | |
| </script> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> | |
| <script src="leaflet-iiif.js"> |
Get NZ parcels data over Auckland region in SHP: https://data.linz.govt.nz/x/CLzEZU
ogr2ogr -f MBTILES parcels.mbtiles nz-primary-parcels.shp -dsco MAXZOOM=14
This file contains hidden or 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
| # MIT License | |
| # | |
| # Copyright (c) 2017 Daniele Andreis <daniele.andreis@gmail.com> | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: |
This file contains hidden or 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'); | |
| var path = require('path'); | |
| var favicon = require('serve-favicon'); | |
| var logger = require('morgan'); | |
| var cookieParser = require('cookie-parser'); | |
| var bodyParser = require('body-parser'); | |
| var index = require('./routes/index'); | |
| var user = require('./routes/user'); | |
| var auth = require('./routes/auth'); |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
- There are always 24 hours in a day.
- February is always 28 days long.
- Any 24-hour period will always begin and end in the same day (or week, or month).
This file contains hidden or 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
| -- Allow to list all layers with no spatial index | |
| -- To get the list | |
| -- SELECT * FROM create_missing_spatial_indexes(True); | |
| -- To create automatically the missing spatial indexes | |
| -- SELECT * FROM create_missing_spatial_indexes(False); | |
| DROP FUNCTION IF EXISTS create_missing_spatial_indexes(); | |
| DROP FUNCTION IF EXISTS create_missing_spatial_indexes( BOOLEAN ); | |
| CREATE OR REPLACE FUNCTION create_missing_spatial_indexes(simulate BOOLEAN DEFAULT FALSE) | |
| RETURNS TABLE ( |
This file contains hidden or 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
| # Instruct the interpreter to create a network request and create an object representing the request state. This can be done using the urllib module. | |
| import urllib.request | |
| import tarfile | |
| thetarfile = "http://file.tar.gz" | |
| ftpstream = urllib.request.urlopen(thetarfile) | |
| thetarfile = tarfile.open(fileobj=ftpstream, mode="r|gz") | |
| thetarfile.extractall() | |
| # The ftpstream object is a file-like that represents the connection to the ftp server. Then the tarfile module can access this stream. Since we do not pass the filename, we have to specify the compression in the mode parameter. |
This file contains hidden or 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 | |
| import csv | |
| import datetime | |
| import calendar | |
| import time | |
| i=0 | |
| # Change the range depending on how long you like to record the data | |
| for i in range (0,50): | |