wiki:TaiwanSettings

Version 3 (modified by marr, 11 years ago) ( diff )

--

Taiwan Settings

Here are example configuration and settings for Taiwan development and deployment.

Basic Settings

After bzr checking out the codes, edit eden/models/000_config.py first. Remember to set FINISHED_EDITING_CONFIG_FILE = True. Here are some recommended settings:

  deployment_settings.L10n.countries = ["TW"]
  deployment_settings.L10n.utc_offset = "UTC +0800"
  deployment_settings.gis.edit_L0 = False
  deployment_settings.gis.edit_L1 = False
  deployment_settings.gis.edit_L2 = False
  deployment_settings.gis.edit_L3 = False
  deployment_settings.gis.locations_hierarchy = {
      "L0":T("Country"),
      "L1":T("Province"),
      "L2":T("District"),
      "L3":T("Town"),
  #   "L4":T("Village"),
      "L5":T("Location"), # Street Address
      "XX":T("Imported")
  }

To Import Admin Names for Taiwan

Usually this is the initial and one-time work. Enter the CLI environment to run commands:

  $ python web2py.py -S eden -M

Make sure modules/s3gis.py containing utf8_csv_reader(), which is included since rev1413. Place L1.csv, L2.csv, L3.csv in the top level of web2py directory.

  >>> tablename = "gis_location"
  >>> table = db[tablename]
  # Example to look for a record's id
  >>> db(table.name == "Taiwan").select().first().id
  215
  # L0
  >>> db(table.name != "Taiwan").delete()
  # Here will show the number of deletion
  >>> db.commit()
  # L1
  >>> gis.import_csv("L1.csv", check_duplicates=False)
  >>> db.commit()
  # L2
  >>> gis.import_csv("L2.csv", check_duplicates=False)
  >>> db.commit()
  # L3
  >>> gis.import_csv("L3.csv", check_duplicates=False)
  >>> db.commit()
  # Example to look for records matching a name
  >>> db.executesql("SELECT * FROM gis_location WHERE name = '光復里' and level = 'L3'")
  # Here will show a list of 13 tuples.

Attachments (4)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.