Changes between Version 73 and Version 74 of UserGuidelines/GIS/Data


Ignore:
Timestamp:
09/06/10 15:25:55 (11 years ago)
Author:
Fran Boon
Comment:

Drop/Restore Indexes

Legend:

Unmodified
Added
Removed
Modified
  • UserGuidelines/GIS/Data

    v73 v74  
    8585Example for Pakistan:
    8686{{{
    87 db(db.gis_location.id<166).delete()
    88 db(db.gis_location.id>166).delete()
     87tablename = "gis_location"
     88table = db[tablename]
     89db.executesql("DROP INDEX name__idx on %s;" % tablename)
     90db(table.id<166).delete()
     91db(table.id>166).delete()
    8992db.commit()
    9093# L0
     
    97100db.commit()
    98101# L2
    99 db(db.gis_location.name=="Baluchistan").update(name="Balochistan")
    100 db(db.gis_location.name=="Northern Areas").update(name="Gilgit Baltistan")
    101 db(db.gis_location.name=="N.W.F.P.").update(name="Khyber Pakhtunkhwa")
    102 db(db.gis_location.name=="F.A.T.A.").update(name="FATA")
    103 db(db.gis_location.name=="F.C.T.").update(name="Islamabad")
    104 db(db.gis_location.name=="Azad Kashmir").update(name="AJK")
     102db(table.name=="Baluchistan").update(name="Balochistan")
     103db(table.name=="Northern Areas").update(name="Gilgit Baltistan")
     104db(table.name=="N.W.F.P.").update(name="Khyber Pakhtunkhwa")
     105db(table.name=="F.A.T.A.").update(name="FATA")
     106db(table.name=="F.C.T.").update(name="Islamabad")
     107db(table.name=="Azad Kashmir").update(name="AJK")
    105108gis.import_csv('pak_adm2.csv')
    106 db(db.gis_location.name=="Sind").update(name="Sindh")
    107 db(db.gis_location.name=="AJK").update(name="Pakistan Administered Kashmir")
    108 db(db.gis_location.name=="Islamabad").update(name="Federal Capital Territory")
    109 db(db.gis_location.name=="FATA").update(name="Federally Administered Tribal Areas")
     109db(table.name=="Sind").update(name="Sindh")
     110db(table.name=="AJK").update(name="Pakistan Administered Kashmir")
     111db(table.name=="Islamabad").update(name="Federal Capital Territory")
     112db(table.name=="FATA").update(name="Federally Administered Tribal Areas")
    110113db.commit()
    111114# L2
    112 db(db.gis_location.name=="Islamabad Capital Territory").update(name="Islamabad")
    113 db(db.gis_location.name=="Jaccobabad").update(name="Jacobabad")
    114 db(db.gis_location.name=="Tando Allahyar").update(name="Tando Allah Yar")
    115 db(db.gis_location.name=="Qambar Shahdad kot").update(name="Qambar Shahdadkot")
     115db(table.name=="Islamabad Capital Territory").update(name="Islamabad")
     116db(table.name=="Jaccobabad").update(name="Jacobabad")
     117db(table.name=="Tando Allahyar").update(name="Tando Allah Yar")
     118db(table.name=="Qambar Shahdad kot").update(name="Qambar Shahdadkot")
    116119gis.import_csv('pak_adm3.csv')
    117 db(db.gis_location.name=="Islamabad").update(name="Islamabad Capital Territory")
    118 db(db.gis_location.name=="Tando Allah Yar").update(name="Tando Allahyar")
    119 db(db.gis_location.name=="Qambar Shahdadkot").update(name="Qambar Shahdad Kot")
    120 db(db.gis_location.name=="Leiah").update(name="Layyah")
    121 db(db.gis_location.name=="Leiah Tehsil").update(name="Layyah Tehsil")
    122 db(db.gis_location.name=="Kalur Kot Tehsil").update(name="Kallur Kot Tehsil")
    123 db(db.gis_location.name=="De-excluded Area").update(name="Tribal Area")
    124 db(db.gis_location.name=="De-excluded Area D.g Khan").update(name="Tribal Area")
    125 db.commit()
     120db(table.name=="Islamabad").update(name="Islamabad Capital Territory")
     121db(table.name=="Tando Allah Yar").update(name="Tando Allahyar")
     122db(table.name=="Qambar Shahdadkot").update(name="Qambar Shahdad Kot")
     123db(table.name=="Leiah").update(name="Layyah")
     124db(table.name=="Leiah Tehsil").update(name="Layyah Tehsil")
     125db(table.name=="Kalur Kot Tehsil").update(name="Kallur Kot Tehsil")
     126db(table.name=="De-excluded Area").update(name="Tribal Area")
     127db(table.name=="De-excluded Area D.g Khan").update(name="Tribal Area")
     128db.commit()
     129field = "name"
     130db.executesql("CREATE INDEX %s__idx on %s(%s);" % (field, tablename, field))
    126131}}}
    127132=== Yahoo ===