Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
46ddf6e8
Commit
46ddf6e8
authored
May 22, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save polygon model in db
parent
85265b14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
populate_db.py
catalog/management/commands/populate_db.py
+9
-2
No files found.
catalog/management/commands/populate_db.py
View file @
46ddf6e8
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
from
catalog.models
import
State
,
City
from
catalog.models
import
Polygon
import
json
,
unicodedata
import
json
,
unicodedata
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
...
@@ -14,7 +14,14 @@ class Command(BaseCommand):
...
@@ -14,7 +14,14 @@ class Command(BaseCommand):
for
index
in
range
(
1
,
33
):
for
index
in
range
(
1
,
33
):
with
open
(
base_path
+
str
(
index
)
+
'.geojson'
)
as
f
:
with
open
(
base_path
+
str
(
index
)
+
'.geojson'
)
as
f
:
data
=
json
.
load
(
f
)
data
=
json
.
load
(
f
)
print
"Estado: "
,
data
[
'name'
]
# print "Estado: ", data['name']
for
feat
in
data
[
'feature'
]:
polygon
=
Polygon
(
name
=
feat
[
'properties'
][
'NOMGEO'
]
json_info
=
feat
)
polygon
.
save
()
# print ("============= "+ data['name'] + " ===================")
# print ("============= "+ data['name'] + " ===================")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment