Skip to content
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

An import script for official boundaries for Argentina #188

Closed
wants to merge 5 commits into from
Closed

Conversation

mhl
Copy link
Contributor

@mhl mhl commented May 12, 2015

No description provided.

@martinszy
Copy link

Hi, I have tried to run it in a newly configured mapit instance and this is the output:

# ./manage.py mapit_ar_import_boundaries   --provincias=argentina_data/provincias.shp --    departamentos=argentina_data/departamentos.shp
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/__init__.py",     line 338, in execute_from_command_line
    utility.execute()
  File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
    output = self.handle(*args, **options)
  File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 657, in handle
    return self.handle_noargs(**options)
  File "/root/mapit/mapit_ar/management/commands/mapit_ar_import_boundaries.py", line 66, in handle_noargs
    raise Exception("There's no inactive generation for the import")
Exception: There's no inactive generation for the import

Ok, I got it, I needed to run
./manage.py mapit_generation_create --desc "First data import" --commit

@martinszy
Copy link

Second error
# ./manage.py mapit_ar_import_boundaries --provincias=argentina_data/provincias.shp --departamentos=argentina_data/departamentos.shp
Traceback (most recent call last):
File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/init.py", line 338, in execute_from_command_line
utility.execute()
File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/init.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(_args, *_cmd_options)
File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(_args, _options)
File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 657, in handle
return self.handle_noargs(
_options)
File "/root/mapit/mapit_ar/management/commands/mapit_ar_import_boundaries.py", line 68, in handle_noargs
country = Country.objects.get(code='A')
File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(_args, **kwargs)
File "/root/mapit/.venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 334, in get
self.model._meta.object_name
mapit.models.DoesNotExist: Country matching query does not exist.

@mhl
Copy link
Contributor Author

mhl commented May 27, 2015

You'll need to run:

./manage.py loaddata mapit_ar/fixtures/argentina.json

... before running the import command.

@martinszy
Copy link

# ./manage.py mapit_ar_import_boundaries --provincias=argentina_data/provincias.shp --departamentos=argentina_data/departamentos.shp

DoesNotExist: Country matching query does not exist. Lookup parameters were {'code': 'AR'}

@mhl
Copy link
Contributor Author

mhl commented May 28, 2015

Have you made a local change to the script?

That error suggests that it's looking up the wrong country code - it should just be 'A', from this line: https://github.com/mysociety/mapit/pull/188/files#diff-4600dcc4127462d41cfed68b9cd76ea0R68

And the country with that code is created from here in the fixture: https://github.com/mysociety/mapit/blob/argentina/mapit_ar/fixtures/argentina.json#L2

@mhl mhl changed the title WiP: an import script for official boundaries for Argentina An import script for official boundaries for Argentina May 28, 2015
@dracos dracos force-pushed the master branch 3 times, most recently from f8a2f78 to bcb87c5 Compare June 7, 2016 17:10
mhl and others added 5 commits December 12, 2017 09:35
This is still work-in-progress because:

 - There's no area for the department of Lezama in the official
   department shapefiles that we've imported into MapIt.

 - The polygons should probably be simplified slightly before
   being saved - at least, the polygons are simplified away to
   nothing with reasonable settings of simplify_tolerance,
   which I suspect is related to this.
@codecov
Copy link

codecov bot commented Dec 12, 2017

Codecov Report

Merging #188 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #188   +/-   ##
=======================================
  Coverage   62.14%   62.14%           
=======================================
  Files          38       38           
  Lines        2140     2140           
=======================================
  Hits         1330     1330           
  Misses        810      810

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f268da6...b1d6b67. Read the comment docs.

@dracos dracos force-pushed the master branch 2 times, most recently from 21f5add to 8547a77 Compare March 5, 2020 19:23
@dracos
Copy link
Member

dracos commented Nov 5, 2020

Very out of date, don't think needed any longer; could be in own repo.

@dracos dracos closed this Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants