Changes between Version 190 and Version 191 of UserGuidelines/GIS/Data


Ignore:
Timestamp:
01/22/12 10:54:24 (13 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuidelines/GIS/Data

    v190 v191  
    345345}}}
    346346
    347 
    348 To import into PostGIS for serving as WMS:
    349 {{{
    350 apt-get -y install gdal-bin pgloader
    351 mkdir GADMv1
    352 cd GADMv1
    353 wget http://gadm.org/data/gadm_v1_lev0_shp.zip
    354 wget http://gadm.org/data/gadm_v1_lev1_shp.zip
    355 wget http://biogeo.ucdavis.edu/data/gadm/gadm_v1_lev2_shp.zip
    356 unzip gadm_v1_lev0_shp.zip
    357 unzip gadm_v1_lev1_shp.zip
    358 unzip gadm_v1_lev2_shp.zip
    359 ogr2ogr -f CSV CSV gadm1_lev0.shp -lco GEOMETRY=AS_WKT
    360 ogr2ogr -f CSV CSV2 gadm1_lev1.shp -lco GEOMETRY=AS_WKT
    361 ogr2ogr -f CSV CSV3 gadm_v1_lev2.shp -lco GEOMETRY=AS_WKT
    362 mv CSV2/gadm1_lev1.csv CSV
    363 mv CSV3/gadm_v1_lev2.csv CSV
    364 # Fix encodings! http://ww.gadm.org/node/287
    365 python utf8.py
    366 rm -rf CSV
    367 rm -rf CSV2
    368 rm -rf CSV3
    369 cat << EOF > "/home/GADMv1/pgloader.conf"
    370 [pgsql]
    371 host    =   localhost
    372 port    =   5432
    373 base    =   sahana
    374 user    =   sahana
    375 pass    =   eden
    376 
    377 client_encoding = 'utf-8'
    378 
    379 [ogr_tmpl]
    380 template     = True
    381 format       = csv
    382 field_sep    = ,
    383 quotechar    = "
    384 trailing_sep = False
    385 
    386 [l1]
    387 use_template    = ogr_tmpl
    388 table           = public.gis_location
    389 filename        = gadm1_lev0_utf8.csv
    390 columns         = wkt:1, name:6, code:22, area:28
    391 only_cols       = 1, 6, 22, 28
    392 skip_head_lines = 1
    393 
    394 EOF
    395 vim /usr/share/pyshared/pgloader/csvreader.py
    396 csv.field_size_limit(2**20 * 100)  # 100 megs
    397 
    398 pgloader
    399 }}}
    400 
    401 This can then be served as 3 WMS layers using !GeoServer & !GeoWebCache. SLD files are attached:
     347This can then be served as separate WMS layers using !GeoServer & !GeoWebCache.[[BR]]
     348You can use GeoServer's [http://docs.geoserver.org/2.1.3/user/data/sqlview.html SQLView] feature.[[BR]]
     349SLD files are attached:
    402350 * [http://eden.sahanafoundation.org/attachment/wiki/UserGuidelinesGISData/gadm_v1_lev0_base_sld.xml L0 Base]
     351  * SQL View: SELECT id, name, area, the_geom FROM gis_location WHERE level='L0'
    403352 * [http://eden.sahanafoundation.org/attachment/wiki/UserGuidelinesGISData/gadm_v1_lev0_overlay_sld.xml L0 Overlay]
     353  * SQL View: SELECT id, name, area, the_geom FROM gis_location WHERE level='L0'
    404354 * [http://eden.sahanafoundation.org/attachment/wiki/UserGuidelinesGISData/gadm_v1_lev1_overlay_sld.xml L1 Overlay]
     355  * SQL View: SELECT id, name, area, the_geom FROM gis_location WHERE level='L1'
    405356 * [http://eden.sahanafoundation.org/attachment/wiki/UserGuidelinesGISData/gadm_v1_lev2_overlay_sld.xml L2 Overlay]
     357  * SQL View: SELECT id, name, area, the_geom FROM gis_location WHERE level='L2'
    406358
    407359Example [http://eden.sahanafoundation.org/attachment/wiki/UserGuidelinesGISData/geowebcache.xml geowebcache.xml] for GADM attached which provides 3 layers: