Skip to content

Instantly share code, notes, and snippets.

View dooman87's full-sized avatar
🤟
Having fun!

Dmitry N. Pokidov dooman87

🤟
Having fun!
View GitHub Profile
version: '2'
services:
postgis:
build: ./postgis
volumes:
- ./data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=gis
renderer:
build: ./renderer
<!DOCTYPE HTML>
<title>OpenLayers Simplest Example</title>
<div id="demoMap" style="height:250px"></div>
<script src="OpenLayers.js"></script>
<script>
map = new OpenLayers.Map("demoMap");
map.addLayer(new OpenLayers.Layer.OSM());
map.zoomToMaxExtent();
</script>
FROM mdillon/postgis:9.5
WORKDIR /
RUN apt-get update && \
apt-get install -y osm2pgsql git wget && \
rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/dooman87/openstreetmap-carto.git && \
wget https://s3.amazonaws.com/metro-extracts.mapzen.com/melbourne_australia.osm.pbf
#!/bin/sh
set -e
# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"
# Create the 'template_postgis' template db
psql --dbname="$POSTGRES_DB" <<- 'EOSQL'
CREATE DATABASE template_postgis;
@dooman87
dooman87 / Dockerfile
Created December 28, 2016 03:46
renderer/Dockerfile
FROM dpokidov/gopnik
RUN apt-get update && \
apt-get install -y git curl unzip node-carto mapnik-utils fontconfig && \
rm -rf /var/lib/apt/lists/*
WORKDIR /
RUN wget https://github.com/adobe-fonts/source-sans-pro/archive/2.020R-ro/1.075R-it.tar.gz && \
tar -xzvf 1.075R-it.tar.gz && \
mkdir /usr/share/fonts/truetype/sourcepro-ttf/ && \
@dooman87
dooman87 / entrypoint.sh
Created December 28, 2016 03:52
renderer/entrypoint.sh
#!/usr/bin/env bash
sh /scripts/compile_style.sh
while [ ! -e /var/lib/postgresql/data/DB_INITED ]
do
sleep 5
echo "Waiting while database is initializing..."
done
# OsmType Tag DataType Flags
node,way access text linear
node,way addr:housename text linear
node,way addr:housenumber text linear
node,way addr:interpolation text linear
node,way admin_level text linear
node,way aerialway text linear
node,way aeroway text polygon
node,way amenity text polygon
node capital text linear
@dooman87
dooman87 / index.html
Created December 29, 2016 22:53
web/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.css" />
<script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.js"></script>
<style type="text/css">
html, body, #map {
width: 100%;
height: 100%;
@dooman87
dooman87 / Component.ts
Created January 2, 2017 21:09
TS2532: Object is possibly 'undefined'.
function mapStateToProps(state: State, ownProps?: TApiKeyProps): TApiKeyProps {
return {
apiKeys: state.apiKey.data.apiKeys,
//ERROR: TS2532: Object is possibly 'undefined'.
onAddApiKey: ownProps.onAddApiKey,
//ERROR: TS2532: Object is possibly 'undefined'.
onDeleteApiKey: ownProps.onDeleteApiKey
} as TApiKeyProps
}
export function apiKey(state: ApiKeyState, action: BaseAction) : ApiKeyState {
let newState: ApiKeyState;
switch (action.type) {
case 'ADD_API_KEY':
newState = Object.assign({}, state);
newState.data.apiKeys = [
...state.data.apiKeys,
action.payload.Key
] as string[];