Changes between Version 7 and Version 8 of GeoDjangoExtras


Ignore:
Timestamp:
09/15/2011 06:09:15 PM (4 years ago)
Author:
adamfast
Comment:

Pointing users to the full docs now that reading the docstring isn't the best option anymore.

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjangoExtras

    v7 v8  
    9191
    9292== !LayerMapping ==
    93 Convenient utility for importing spatial data into geographic models from GDAL-supported data sources (''e.g.'', SHP Files).  See the [browser:django/branches/gis/django/contrib/gis/utils/layermapping.py source code] docstring for more details.
    94 {{{
    95 from django.contrib.gis.utils import LayerMapping
    96 from django.contrib.gis.gdal import DataSource
    97 from geoapp.models import Zipcode
    98 
    99 ds = DataSource('/data/zipcodep.shp')
    100 
    101 # set up a mapping dictionary
    102 # the key corresponds to the attribute of the model you are saving to
    103 # the value corresponds to the field name in the shapefile
    104 mapping = {'zipcode' : 'ZIP',
    105            'area' : 'AREA',
    106            'perimeter' : 'PERIMETER',
    107            'poly' : 'POLYGON'}
    108 
    109 # if the shapefile does not have the srid explicitly set you will need to pass a srs
    110 srs = SpatialRefSys.objects.get(srid=2278)
    111 
    112 
    113 lm = LayerMapping(Zipcode, ds, mapping, source_srs=srs)
    114 lm.save(verbose=True)
    115 
    116 
    117 
    118 }}}
     93The content here is indexed by Google but very incomplete - please see the full LayerMapping docs at http://docs.djangoproject.com/en/1.3/ref/contrib/gis/layermapping/
    11994
    12095== Measure ==
Back to Top