This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| +--- geo_processing | |
| | __init__ | |
| | elastic_search_connection.py | |
| | config.py | |
| | country.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def index_country_polygons(path_to_file): | |
| schema = { | |
| 'geometry': 'Polygon', | |
| } | |
| with fiona.open('{}'.format(path_to_file), 'r', | |
| 'ESRI Shapefile', schema) as polygon_feature: | |
| for geometry in polygon_feature: | |
| polygon = shape(geometry['geometry']) | |
| country = geometry['properties']['NM_MUNICIP'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import elasticsearch | |
| import elasticsearch_dsl | |
| from elasticsearch_dsl.connections import connections, get_connection | |
| import config as config_module | |
| config = config_module.get_config() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f = open('workfile' ,'r', encoding='utf-8') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| file_content = open('dados/some_sb.csv', encoding='utf-8', mode='w') | |
| new_content = '1,someContent' | |
| file_content.write(new_content) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f = open('workfile' ,'r') | |
| f.readline() | |
| f.readlines() | |
| f.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| file_content = open('dados/some_sb.csv', encoding='utf-8', mode='w') | |
| new_content = '1,someContent' | |
| file_content.write(new_content) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f = open('workfile' ,'w') | |
| new_content = 'someContent' | |
| f.write(new_content) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f = open('workfile' ,'w') | |
| new_content = 'someContent' | |
| f.write(new_content) | |
| f.seek(0) | |
| line = f.readline() | |
| print line | |
| >> someContent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f = open('workfile' ,'w') | |
| new_content = 'someContent' | |
| f.write(new_content) | |
| f.flush() | |
| ... |
OlderNewer