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
34cbd991
Commit
34cbd991
authored
Jun 01, 2018
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added state to json info
parent
9132f980
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
12 deletions
+30
-12
addState.py
catalog/management/commands/addState.py
+29
-0
views.py
catalog/views.py
+1
-12
db.sqlite3
db.sqlite3
+0
-0
No files found.
catalog/management/commands/addState.py
0 → 100644
View file @
34cbd991
#!/usr/bin/python
# -*- coding: utf-8 -*-
from
django.core.management.base
import
BaseCommand
,
CommandError
from
catalog.models
import
Polygon
import
json
,
unicodedata
import
math
class
Command
(
BaseCommand
):
def
handle
(
self
,
*
args
,
**
options
):
pList
=
Polygon
.
objects
.
all
()
state_parser
=
{
'01'
:
"Aguascalientes"
,
'02'
:
"Baja California"
,
'03'
:
"Baja California Sur"
,
'04'
:
"Campeche"
,
'05'
:
"Coahuila"
,
'06'
:
"Colima"
,
'07'
:
"Chiapas"
,
'08'
:
"Chihuahua"
,
'09'
:
"Ciudad de México"
,
'10'
:
"Durango"
,
'11'
:
"Guanajuato"
,
'12'
:
"Guerrero"
,
'13'
:
"Hidalgo"
,
'14'
:
"Jalisco"
,
'15'
:
"México"
,
'16'
:
"Michoacán"
,
'17'
:
"Morelos"
,
'18'
:
"Nayarit"
,
'19'
:
"Nuevo León"
,
'20'
:
"Oaxaca"
,
'21'
:
"Puebla"
,
'22'
:
"Querétaro"
,
'23'
:
"Quintana Roo"
,
'24'
:
"San Luis Potosí"
,
'25'
:
"Sinaloa"
,
'26'
:
"Sonora"
,
'27'
:
"Tabasco"
,
'28'
:
"Tamaulipas"
,
'29'
:
"Tlaxcala"
,
'30'
:
"Veracruz"
,
'31'
:
"Yucatán"
,
'32'
:
"Zacatecas"
}
for
p
in
pList
:
j
=
json
.
loads
(
p
.
json_info
)
j
[
'properties'
][
'ENT_NAME'
]
=
state_parser
[
j
[
'properties'
][
'CVE_ENT'
]]
p
.
json_info
=
json
.
dumps
(
j
,
ensure_ascii
=
True
)
p
.
save
()
\ No newline at end of file
catalog/views.py
View file @
34cbd991
...
@@ -112,17 +112,6 @@ def productList(request):
...
@@ -112,17 +112,6 @@ def productList(request):
class
SearchSubmitView
(
View
):
class
SearchSubmitView
(
View
):
template
=
'map.html'
template
=
'map.html'
# template = 'search_submit.html'
# template = 'search_submit.html'
state_parser
=
{
'01'
:
"Aguascalientes"
,
'02'
:
"Baja California"
,
'03'
:
"Baja California Sur"
,
'04'
:
"Campeche"
,
'05'
:
"Coahuila"
,
'06'
:
"Colima"
,
'07'
:
"Chiapas"
,
'08'
:
"Chihuahua"
,
'09'
:
"Ciudad de México"
,
'10'
:
"Durango"
,
'11'
:
"Guanajuato"
,
'12'
:
"Guerrero"
,
'13'
:
"Hidalgo"
,
'14'
:
"Jalisco"
,
'15'
:
"México"
,
'16'
:
"Michoacán"
,
'17'
:
"Morelos"
,
'18'
:
"Nayarit"
,
'19'
:
"Nuevo León"
,
'20'
:
"Oaxaca"
,
'21'
:
"Puebla"
,
'22'
:
"Querétaro"
,
'23'
:
"Quintana Roo"
,
'24'
:
"San Luis Potosí"
,
'25'
:
"Sinaloa"
,
'26'
:
"Sonora"
,
'27'
:
"Tabasco"
,
'28'
:
"Tamaulipas"
,
'29'
:
"Tlaxcala"
,
'30'
:
"Veracruz"
,
'31'
:
"Yucatán"
,
'32'
:
"Zacatecas"
}
def
strip_accents
(
self
,
s
):
def
strip_accents
(
self
,
s
):
return
''
.
join
((
c
for
c
in
unicodedata
.
normalize
(
'NFD'
,
s
)
if
unicodedata
.
category
(
c
)
!=
'Mn'
))
return
''
.
join
((
c
for
c
in
unicodedata
.
normalize
(
'NFD'
,
s
)
if
unicodedata
.
category
(
c
)
!=
'Mn'
))
...
@@ -151,7 +140,7 @@ class SearchSubmitView(View):
...
@@ -151,7 +140,7 @@ class SearchSubmitView(View):
list
.
append
({
list
.
append
({
'id'
:
str
(
polygon
.
id
),
'id'
:
str
(
polygon
.
id
),
'city'
:
polygonInfo
[
'properties'
][
'NOMGEO'
],
'city'
:
polygonInfo
[
'properties'
][
'NOMGEO'
],
'state'
:
self
.
state_parser
[
polygonInfo
[
'properties'
][
'CVE_ENT'
]
],
'state'
:
polygonInfo
[
'properties'
][
'ENT_NAME'
],
'geojson'
:
polygonInfo
,
'geojson'
:
polygonInfo
,
'wkt_polygon'
:
polygon
.
wkt_polygon
'wkt_polygon'
:
polygon
.
wkt_polygon
})
})
...
...
db.sqlite3
View file @
34cbd991
No preview for this file type
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