Changeset 6414
- Timestamp:
- 09/24/07 17:18:00 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/utils/__init__.py
r6387 r6414 1 from django.contrib.gis.utils.layermapping import LayerMapping 1 """ 2 This module contains useful utilities for GeoDjango. 3 """ 4 2 5 from django.contrib.gis.utils.inspect_data import sample 6 7 # Importing LayerMapping (will not be done if GDAL is not installed) 8 from django.contrib.gis.gdal import HAS_GDAL 9 if HAS_GDAL: 10 from django.contrib.gis.utils.layermapping import LayerMapping 3 11 4 12 # Importing GeoIP django/branches/gis/django/contrib/gis/utils/layermapping.py
r6369 r6414 31 31 32 32 Keyword Args: 33 layer -- The index of the layer to use from the Data Source (defaults to 0) 34 35 source_srs -- Use this to specify the source SRS manually (for example, 36 some shapefiles don't come with a '.prj' file) 33 layer: 34 The index of the layer to use from the Data Source (defaults to 0) 35 36 source_srs: 37 Use this to specify the source SRS manually (for example, some 38 shapefiles don't come with a '.prj' file). A SRID integer, a 39 WKT string, a SpatialReference, and a SpatialRefSys object are 40 all valid parameters here. 37 41 38 42 Example: … … 168 172 raise Exception, 'Given mapping field "%s" not in given Model fields!' % model_field 169 173 170 ## Handling if we get a geometry in the Field ###174 ### Handling if we get a geometry in the Field ### 171 175 if ogr_field in ogc_types: 172 176 # At this time, no more than one geographic field per model =( … … 219 223 elif isinstance(source_srs, SpatialRefSys): 220 224 sr = source_srs.srs 225 elif isinstance(source_srs, (int, str)): 226 sr = SpatialReference(source_srs) 221 227 else: 222 228 sr = layer.srs
