-
Notifications
You must be signed in to change notification settings - Fork 1
Added support for Layer Package (lpk) imports #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
nikmolnar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, nice work! Please add a test for this new method. You can use the test for import_netcdf for guidance. Otherwise, just a few minor cleanup items.
See: https://github.com/consbio/python-databasin/blob/master/tests/test_client.py#L153
databasin/client.py
Outdated
| raise | ||
|
|
||
| def create_job(self, name, job_args={}, block=False): | ||
| #MG self.build_url(JOB_CREATE_PATH) = https://databasin.org/api/v1/jobs/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete this line.
databasin/client.py
Outdated
|
|
||
| def import_lpk(self, lpk_file): | ||
| if lpk_file.endswith('.lpk'): | ||
| f = open(lpk_file, 'a+b') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this isn't written to, it should be opened in read-only:
f = open(lpk_file, 'rb')
databasin/client.py
Outdated
| else: | ||
| raise ValueError('File must be an ArcGIS Layer Package with a .lpk extension') | ||
|
|
||
| filename = '{0}.lpk'.format(os.path.splitext(os.path.basename(lpk_file))[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If lpk_file already ends with .lpk (as enforced on L155), why not just grab the basename?
filename = os.path.basename(lpk_file)
databasin/client.py
Outdated
| 'dataset_type': 'ArcGIS_Native' | ||
| } | ||
|
|
||
| tmp_job = self.create_job('create_import_job', job_args=tmp_job_args, block=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tmp_job is a misnomer. It's really an "import" job, but simply job would be fine, too.
No description provided.