Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Korver mwkorver

View GitHub Profile
View mapserver-gdal-vsis3-docker.txt
#cloud-boothook
#!/bin/bash
set -x
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
# fix for "unable to resolve host" error even when dns hostnames/resolution are turned on for VPC
echo "127.0.0.1 $(hostname)" >> /etc/hosts
# copy shapefiles from S3 bucket
@mwkorver
mwkorver / leaflet_example.html
Last active Mar 12, 2016
Workshop leaflet example HTML
View leaflet_example.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Tile-maker Demo using NAIP on S3</title>
<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
@mwkorver
mwkorver / s3redirect
Last active Mar 25, 2016
S3 redirect for TMS
View s3redirect
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>403</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>maptilerworkshop.elasticbeanstalk.com</HostName>
<ReplaceKeyPrefixWith>?tile=</ReplaceKeyPrefixWith>
<HttpRedirectCode>303</HttpRedirectCode>
</Redirect>
@mwkorver
mwkorver / mapserver.user-data
Last active Aug 24, 2016
EC2 user data script to deploy MapServer container mounting USDA NAIP data (about 100TB) in aws-naip bucket.
View mapserver.user-data
#cloud-boothook
#!/bin/bash
set -x
# This EC2 user-data file will run a Mapserver docker container.
# Still working on getting it to reboot properly. See this link for more info on user-data scripts
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts
# Because this setup uses data stored in an S3 bucket located in the standard region, it needs to be run in us-east-1 (Virginia Region).
# It mounts S3 data by using danilop/yas3fs. USDA CONUS NAIP data, Mapfile and shapefile indexes are made available to Mapserver in this way.
# Just running this instance will give you access to all of the NAIP data via the EC2 instance's filesystem.
# One caveat is that the combination of mapfile and UTM projected geotifs only supports WMS requests near native 1m/pixel resolution or level 17,
You can’t perform that action at this time.