Changes between Version 6 and Version 7 of GIS/Data


Ignore:
Timestamp:
11/07/13 14:59:29 (11 years ago)
Author:
Fran Boon
Comment:

VN_Lx

Legend:

Unmodified
Added
Removed
Modified
  • GIS/Data

    v6 v7  
    3333db.commit()
    3434import_file = "IN_L3.csv"
     35File = open(import_file, "r")
     36resource.import_xml(File, format="csv", stylesheet=stylesheet)
     37db.commit()
     38gis.update_location_tree()
     39db.commit()
     40}}}
     41
     42=== Vietnam ===
     43Admin Boundaries:
     44* [http://eden.sahanafoundation.org/downloads/VN_Lx.7z VN_Lx.7z]
     45
     46These have come originally from [http://gadm.org GADM] but with their L1 removed (so we use their L2 as our L1, etc)
     47* GADM file has terrible problems with place names: at least 3 different encodings!
     48* These have mostly been resolved & the file contains place names with no diacritics (to make it easier for non-Vietnamese to search for such places) as well as Vi name_l10n
     49* Many updated boundaries from http://gis.chinhphu.vn by selecting the place & then using this JS:
     50{{{
     51points = plHighlight[0].latlngs[0];
     52output = 'POLYGON ((';
     53for (var i=0; i < points.length; i++) {
     54    p = points[i];
     55    output += p.longitude;
     56    output += ' ';
     57    output += p.latitude;
     58    output += ',';
     59}
     60output = output.slice(0, -1);
     61output += '))';
     62}}}
     63or
     64{{{
     65output = 'MULTIPOLYGON (((';
     66points = plHighlight[0].latlngs[0];
     67for (var i=0; i < points.length; i++) {
     68    p = points[i];
     69    output += p.longitude;
     70    output += ' ';
     71    output += p.latitude;
     72    output += ',';
     73}
     74output = output.slice(0, -1); // Strip comma
     75output += ')),((';
     76points = plHighlight[1].latlngs[0];
     77for (var i=0; i < points.length; i++) {
     78    p = points[i];
     79    output += p.longitude;
     80    output += ' ';
     81    output += p.latitude;
     82    output += ',';
     83}
     84output = output.slice(0, -1); // Strip comma
     85output += ')))';
     86}}}
     87& then converted to WGS84 using:
     88{{{
     89ogr2ogr -f CSV CSV '.\VN2000 Polygons.csv' -s_srs EPSG:3405 -t_srs EPSG:4326 -lco GEOMETRY=AS_WKT
     90}}}
     91* Old boundaries have been left and start / end dates have been added from Wikipedia.
     92
     93Use [http://7zip.org 7-Zip] to extract to your web2py folder & then install like this:
     94{{{
     95cd /home/web2py
     96p7zip -d VN_Lx.7z
     97python web2py.py -S eden -M
     98
     99auth.override = True
     100resource = s3db.resource("gis_location")
     101stylesheet = os.path.join(request.folder, "static", "formats", "s3csv", "gis", "location.xsl")
     102import_file = "VN_L0.csv"
     103File = open(import_file, "r")
     104resource.import_xml(File, format="csv", stylesheet=stylesheet)
     105db.commit()
     106import_file = "VN_L1.csv"
     107File = open(import_file, "r")
     108resource.import_xml(File, format="csv", stylesheet=stylesheet)
     109db.commit()
     110import_file = "VN_L2.csv"
     111File = open(import_file, "r")
     112resource.import_xml(File, format="csv", stylesheet=stylesheet)
     113db.commit()
     114import_file = "VN_L3.csv"
    35115File = open(import_file, "r")
    36116resource.import_xml(File, format="csv", stylesheet=stylesheet)