Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit ca91829

Browse files
committed
Expose raster_size in create_export method of project model. Resolve conflicts with dev branch.
1 parent 3bca78d commit ca91829

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

README.rst

+11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ Usage
2121
# Get TMS URl without token
2222
one_project.tms()
2323
24+
Versions
25+
~~~~~~~~
26+
27+
The latest version of `rasterfoundry` always points to the most recently released swagger spec in
28+
the raster-foundry/raster-foundy-api-spec repository. If you need to point to a different spec
29+
version, either install a version of the python client that refers to the appropriate spec, or
30+
set the `RF_API_SPEC_PATH` environment variable to a url or local file path pointing to the
31+
version of the spec that you want to use.
32+
33+
Generally this shouldn't matter, because the Raster Foundry API shouldn't have breaking changes.
34+
2435

2536
Installation
2637
------------

rasterfoundry/api.py

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
import os
21
import json
2+
import os
33
import uuid
44

5-
from bravado.requests_client import RequestsClient
65
from bravado.client import SwaggerClient
7-
from bravado.swagger_model import load_file
6+
from bravado.requests_client import RequestsClient
7+
from bravado.swagger_model import load_file, load_url
88
from simplejson import JSONDecodeError
99

10+
1011
from .models import Project, MapToken, Analysis, Export
11-
from .exceptions import RefreshTokenException
1212
from .aws.s3 import str_to_file
13+
from .exceptions import RefreshTokenException
1314
from .settings import RV_TEMP_URI
1415

15-
SPEC_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)),
16-
'spec.yml')
16+
try:
17+
from urllib.parse import urlparse
18+
except ImportError:
19+
from urlparse import urlparse
20+
21+
22+
SPEC_PATH = os.getenv(
23+
'RF_API_SPEC_PATH',
24+
'https://raw.githubusercontent.com/raster-foundry/raster-foundry-api-spec/master/spec.yml'
25+
)
1726

1827

1928
class API(object):
@@ -34,7 +43,10 @@ def __init__(self, refresh_token=None, api_token=None,
3443
self.http = RequestsClient()
3544
self.scheme = scheme
3645

37-
spec = load_file(SPEC_PATH)
46+
if urlparse(SPEC_PATH).netloc:
47+
spec = load_url(SPEC_PATH)
48+
else:
49+
spec = load_file(SPEC_PATH)
3850

3951
self.app_host = host
4052
spec['host'] = host

rasterfoundry/models/project.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def get_thumbnail(self, bbox, zoom, export_format, raw):
123123
response.raise_for_status()
124124
return response
125125

126-
def create_export(self, bbox, zoom=10):
126+
def create_export(self, bbox, zoom=10, raster_size=4000):
127127
"""Create an export job for this project
128128
129129
Args:
@@ -133,7 +133,8 @@ def create_export(self, bbox, zoom=10):
133133
Returns:
134134
Export
135135
"""
136-
return Export.create_export(self.api, bbox=bbox, zoom=zoom, project=self)
136+
return Export.create_export(
137+
self.api, bbox=bbox, zoom=zoom, project=self, raster_size=raster_size)
137138

138139
def geotiff(self, bbox, zoom=10, raw=False):
139140
"""Download this project as a geotiff

0 commit comments

Comments
 (0)