Compare commits
No commits in common. "6f2c71891efe90da7cd19c9e1d0f19f13b6ec7cd" and "329500f1eda4c75652506307afb3fce261e85bc9" have entirely different histories.
6f2c71891e
...
329500f1ed
10
.idea/.gitignore
generated
vendored
10
.idea/.gitignore
generated
vendored
@ -1,10 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Ignored default folder with query files
|
|
||||||
/queries/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
6
.idea/inspectionProfiles/profiles_settings.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
||||||
7
.idea/misc.xml
generated
7
.idea/misc.xml
generated
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Black">
|
|
||||||
<option name="sdkName" value="Python 3.14" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.14 (toposhirt)" project-jdk-type="Python SDK" />
|
|
||||||
</project>
|
|
||||||
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/toposhirt.iml" filepath="$PROJECT_DIR$/.idea/toposhirt.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
10
.idea/toposhirt.iml
generated
10
.idea/toposhirt.iml
generated
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PYTHON_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="jdk" jdkName="Python 3.14 (toposhirt)" jdkType="Python SDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@ -7,32 +7,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import time
|
import time
|
||||||
import pycountry
|
|
||||||
from country_bounding_boxes import country_subunits_by_iso_code
|
|
||||||
from country_iso2ify import get_resolver
|
|
||||||
|
|
||||||
resolver = get_resolver()
|
|
||||||
|
|
||||||
|
|
||||||
def get_mainland_bbox(country_name):
|
|
||||||
# Returns the main continental/primary bounding box
|
|
||||||
iso_code = resolver.resolve(country_name)
|
|
||||||
countries = country_subunits_by_iso_code(iso_code)
|
|
||||||
logging.debug("Country is [{}] iso code is [{}]".format(country_name,iso_code))
|
|
||||||
# The library is designed to return the main body of the country
|
|
||||||
# in the first result or by filtering for largest area.
|
|
||||||
item = None
|
|
||||||
if countries:
|
|
||||||
for item in countries:
|
|
||||||
logging.debug(item.subunit+str(item.bbox))
|
|
||||||
item = None
|
|
||||||
countries = country_subunits_by_iso_code(iso_code)
|
|
||||||
if countries:
|
|
||||||
for item in countries:
|
|
||||||
if item.subunit == country_name:
|
|
||||||
return item.bbox
|
|
||||||
return None
|
|
||||||
# foo
|
|
||||||
|
|
||||||
class Timerlog:
|
class Timerlog:
|
||||||
|
|
||||||
@ -85,7 +60,7 @@ parser.add_argument(
|
|||||||
"--country",
|
"--country",
|
||||||
dest='country',
|
dest='country',
|
||||||
metavar='country',
|
metavar='country',
|
||||||
default='US',
|
default='United States',
|
||||||
action='store',
|
action='store',
|
||||||
help="country to get topo image for")
|
help="country to get topo image for")
|
||||||
|
|
||||||
@ -126,8 +101,4 @@ logging.debug(t.end().report())
|
|||||||
logging.debug("Country is [{}]".format(args.country))
|
logging.debug("Country is [{}]".format(args.country))
|
||||||
logging.debug("Region is [{}]".format(args.region))
|
logging.debug("Region is [{}]".format(args.region))
|
||||||
|
|
||||||
iso_code = resolver.resolve(args.country)
|
|
||||||
logging.debug("iso_code for [{}] is [{}]".format(args.country, iso_code))
|
|
||||||
|
|
||||||
bbox=get_mainland_bbox(args.country)
|
|
||||||
logging.debug("BBOX is [{}]".format(bbox))
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user