@@ -7,24 +7,120 @@ A lightweight Cloud Optimized GeoTIFF tile server.
7
7
8
8
# Deployment
9
9
10
- ** To Do**
10
+ The stack is deployed by the [ aws cdk] ( https://aws.amazon.com/cdk/ ) utility. It will handle tasks such as generating a docker image and packaging handlers automatically.
11
+
12
+ 1 . Instal cdk and set up CDK in your AWS account - Only need once per account
13
+ ``` bash
14
+ $ npm install cdk -g
15
+
16
+ $ cdk bootstrap # Deploys the CDK toolkit stack into an AWS environment
17
+ ```
18
+
19
+ 2 . Install dependencies
20
+
21
+ ``` bash
22
+ # Note: it's recommanded to use virtualenv
23
+ $ git clone https://github.com/developmentseed/titiler.git
24
+ $ cd titiler && pip install -e .[deploy]
25
+ ```
26
+
27
+ 3 . Pre-Generate CFN template
28
+ ``` bash
29
+ $ cdk synth # Synthesizes and prints the CloudFormation template for this stack
30
+ ```
31
+
32
+ 4 . Edit [ stack/config.py] ( stack/config.py )
33
+
34
+ ``` python
35
+ PROJECT_NAME = " titiler"
36
+ STAGE = os.environ.get(" STAGE" , " dev" )
37
+
38
+ # // Service config
39
+ # Min/Max Number of ECS images
40
+ MIN_ECS_INSTANCES = 2
41
+ MAX_ECS_INSTANCES = 50
42
+
43
+ # CPU value | Memory value
44
+ # 256 (.25 vCPU) | 0.5 GB, 1 GB, 2 GB
45
+ # 512 (.5 vCPU) | 1 GB, 2 GB, 3 GB, 4 GB
46
+ # 1024 (1 vCPU) | 2 GB, 3 GB, 4 GB, 5 GB, 6 GB, 7 GB, 8 GB
47
+ # 2048 (2 vCPU) | Between 4 GB and 16 GB in 1-GB increments
48
+ # 4096 (4 vCPU) | Between 8 GB and 30 GB in 1-GB increments
49
+ TASK_CPU = 1024
50
+ TASK_MEMORY = 2048
51
+ ```
52
+
53
+ 5 . Deploy
54
+ ``` bash
55
+ $ cdk deploy # Deploys the stack(s) named STACKS into your AWS account
56
+ ```
11
57
12
58
# Test locally
13
59
``` bash
60
+ $ git clone https://github.com/developmentseed/titiler.git
61
+
62
+ $ pip install -e .
14
63
$ uvicorn titiler.main:app --reload
15
64
```
16
-
17
- ### Docker
65
+ Or with Docker
18
66
```
19
67
$ docker-compose build
20
68
$ docker-compose up
21
69
```
22
70
23
- ## Authors
24
- Created by [ Development Seed] ( < http://developmentseed.org > )
71
+ # API
72
+
73
+ ### Doc
74
+
75
+ ` :endpoint:/docs `
76
+ ![ ] ( https://user-images.githubusercontent.com/10407788/78325903-011c9680-7547-11ea-853f-50e0fb0f4d92.png )
77
+
78
+ ### Tiles
79
+
80
+ ` :endpoint:/v1/{z}/{x}/{y}[@{scale}x][.{ext}] `
81
+ - ** z** : Mercator tiles's zoom level.
82
+ - ** x** : Mercator tiles's column.
83
+ - ** y** : Mercator tiles's row.
84
+ - ** scale** : Tile size scale, default is set to 1 (256x256). OPTIONAL
85
+ - ** ext** : Output image format, default is set to None and will be either JPEG or PNG depending on masked value. OPTIONAL
86
+ - ** url** : Cloud Optimized GeoTIFF URL. ** REQUIRED**
87
+ - ** bidx** : Coma (',') delimited band indexes. OPTIONAL
88
+ - ** nodata** : Overwrite internal Nodata value. OPTIONAL
89
+ - ** rescale** : Coma (',') delimited Min,Max bounds. OPTIONAL
90
+ - ** color_formula** : rio-color formula. OPTIONAL
91
+ - ** color_map** : rio-tiler color map name. OPTIONAL
92
+
93
+ ### Metadata
94
+
95
+ ` :endpoint:/v1/tilejson.json ` - Get tileJSON document
96
+ - ** url** : Cloud Optimized GeoTIFF URL. ** REQUIRED**
97
+ - ** tile_format** : Output image format, default is set to None and will be either JPEG or PNG depending on masked value.
98
+ - ** tile_scale** : Tile size scale, default is set to 1 (256x256). OPTIONAL
99
+ - ** kwargs** : Other options will be forwarded to the ` tiles ` url.
100
+
101
+ ` :endpoint:/v1/bounds ` - Get general image bounds
102
+ - ** url** : Cloud Optimized GeoTIFF URL. ** REQUIRED**
103
+
104
+ ` :endpoint:/v1/info ` - Get general image info
105
+ - ** url** : Cloud Optimized GeoTIFF URL. ** REQUIRED**
106
+
107
+ ` :endpoint:/v1/metadata ` - Get image statistics
108
+ - ** url** : Cloud Optimized GeoTIFF URL. ** REQUIRED**
109
+ - ** bidx** : Coma (',') delimited band indexes. OPTIONAL
110
+ - ** nodata** : Overwrite internal Nodata value. OPTIONAL
111
+ - ** pmin** : min percentile, default is 2. OPTIONAL
112
+ - ** pmax** : max percentile, default is 98. OPTIONAL
113
+ - ** max_size** : Max image size from which to calculate statistics, default is 1024. OPTIONAL
114
+ - ** histogram_bins** : Histogram bins, default is 20. OPTIONAL
115
+ - ** histogram_range** : Coma (',') delimited histogram bounds. OPTIONAL
25
116
117
+ ## UI
26
118
27
- ## Project structure
119
+ ` :endpoint:/index.html ` - Full UI (histogram, predefined rescaling, ...)
120
+
121
+ ` :endpoint:/simple_viewer.html ` - Simple UI (no histogram, manual rescaling, ...)
122
+
123
+ # Project structure
28
124
29
125
```
30
126
titiler/ - titiler python module.
@@ -44,9 +140,16 @@ titiler/ - titiler python module.
44
140
├── ressources/ - application ressources (enums, constants, ...).
45
141
├── templates/ - html/xml models.
46
142
├── main.py - FastAPI application creation and configuration.
47
- └── utils.py - utility functions.
48
- ```
143
+ ├── utils.py - utility functions.
144
+ │
145
+ stack/
146
+ ├── app.py - AWS Stack definition (vpc, cluster, ecs, alb ...)
147
+ ├── config.py - Optional parameters for the stack definition [EDIT THIS]
148
+ │
149
+ OpenAPI/
150
+ └── openapi.json - OpenAPI document.
49
151
152
+ ```
50
153
51
154
## Contribution & Development
52
155
@@ -67,3 +170,7 @@ This repo is set to use `pre-commit` to run *my-py*, *flake8*, *pydocstring* and
67
170
``` bash
68
171
$ pre-commit install
69
172
```
173
+
174
+ ## Authors
175
+ Created by [ Development Seed] ( < http://developmentseed.org > )
176
+
0 commit comments