mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
gis: fixed utils bugs related to gdal module name changes.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@5755 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
179a2c45c3
commit
add0689d56
@ -81,17 +81,18 @@ Example:
|
|||||||
|
|
||||||
LayerMapping just transformed the three geometries from the SHP file from their
|
LayerMapping just transformed the three geometries from the SHP file from their
|
||||||
source spatial reference system (WGS84) to the spatial reference system of
|
source spatial reference system (WGS84) to the spatial reference system of
|
||||||
the GeoDjango model (NAD83). Further, data is selectively imported from
|
the GeoDjango model (NAD83). If no spatial reference system is defined for
|
||||||
the given
|
the layer, use the `source_srs` keyword with a SpatialReference object to
|
||||||
|
specify one. Further, data is selectively imported from the given data source
|
||||||
|
fields into the model fields.
|
||||||
"""
|
"""
|
||||||
from types import StringType, TupleType
|
from types import StringType, TupleType
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from django.contrib.gis.gdal import \
|
from django.contrib.gis.gdal import \
|
||||||
OGRGeometry, OGRGeomType, SpatialReference, CoordTransform, \
|
OGRGeometry, OGRGeomType, SpatialReference, CoordTransform, \
|
||||||
DataSource, Layer, Feature, OGRException
|
DataSource, OGRException
|
||||||
from django.contrib.gis.gdal.Field import Field, OFTInteger, OFTReal, OFTString, OFTDateTime
|
from django.contrib.gis.gdal.field import Field, OFTInteger, OFTReal, OFTString, OFTDateTime
|
||||||
from django.contrib.gis.models import GeometryColumns, SpatialRefSys
|
from django.contrib.gis.models import GeometryColumns, SpatialRefSys
|
||||||
|
|
||||||
from django.db import connection, transaction
|
from django.db import connection, transaction
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
||||||
@ -257,7 +258,7 @@ class LayerMapping:
|
|||||||
try:
|
try:
|
||||||
geo_col = GeometryColumns.objects.get(f_table_name=self.model._meta.db_table)
|
geo_col = GeometryColumns.objects.get(f_table_name=self.model._meta.db_table)
|
||||||
except:
|
except:
|
||||||
raise Exception, 'Geometry column "%s" does not exist. (did you run syncdb?)'
|
raise Exception, 'Geometry column does not exist. (did you run syncdb?)'
|
||||||
|
|
||||||
# Getting the coordinate system needed for transformation (with CoordTransform)
|
# Getting the coordinate system needed for transformation (with CoordTransform)
|
||||||
try:
|
try:
|
||||||
|
@ -3,7 +3,7 @@ This module includes some utility functions for inspecting the layout
|
|||||||
of a gdal.DataSource.
|
of a gdal.DataSource.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.contrib.gis.gdal.OGRGeometry import GEO_CLASSES
|
from django.contrib.gis.gdal.geometries import GEO_CLASSES
|
||||||
|
|
||||||
def sample(data_source, num_features=10, gcs_file=None):
|
def sample(data_source, num_features=10, gcs_file=None):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user