class LayerMapping: (source)
A class that maps OGR Layers to GeoDjango Models.
Method | __init__ |
A LayerMapping object is initialized using the given Model (not an instance), a DataSource (or string path to an OGR-supported data file), and a mapping dictionary. See the module level docstring for more details and keyword argument usage. |
Method | check |
Check the `fid_range` keyword. |
Method | check |
Check the Layer metadata and ensure that it's compatible with the mapping information and model. Unlike previous revisions, there is no need to increment through each feature in the Layer. |
Method | check |
Check the compatibility of the given spatial reference object. |
Method | check |
Check the `unique` keyword parameter -- may be a sequence or string. |
Method | coord |
Return the coordinate transformation object. |
Method | feature |
Given an OGR Feature, return a dictionary of keyword arguments for constructing the mapped model. |
Method | geometry |
Return the GeometryField instance associated with the geographic column. |
Method | make |
Given the OGRGeomType for a geometry and its associated GeometryField, determine whether the geometry should be turned into a GeometryCollection. |
Method | save |
Save the contents from the OGR DataSource Layer into the database according to the mapping dictionary given at initialization. |
Method | unique |
Given the feature keyword arguments (from `feature_kwargs`), construct and return the uniqueness keyword arguments -- a subset of the feature kwargs. |
Method | verify |
Given an OGR Feature, the related model and its dictionary mapping, retrieve the related model for the ForeignKey mapping. |
Method | verify |
Verify the geometry -- construct and return a GeometryCollection if necessary (for example if the model field is MultiPolygonField while the mapped shapefile only contains Polygons). |
Method | verify |
Verify if the OGR Field contents are acceptable to the model field. If they are, return the verified value, otherwise raise an exception. |
Constant | FIELD |
Undocumented |
Constant | MULTI |
Undocumented |
Instance Variable | coord |
Undocumented |
Instance Variable | ds |
Undocumented |
Instance Variable | encoding |
Undocumented |
Instance Variable | fields |
Undocumented |
Instance Variable | geo |
Undocumented |
Instance Variable | geom |
Undocumented |
Instance Variable | layer |
Undocumented |
Instance Variable | mapping |
Undocumented |
Instance Variable | model |
Undocumented |
Instance Variable | source |
Undocumented |
Instance Variable | spatial |
Undocumented |
Instance Variable | transaction |
Undocumented |
Instance Variable | transaction |
Undocumented |
Instance Variable | transform |
Undocumented |
Instance Variable | unique |
Undocumented |
Instance Variable | using |
Undocumented |
A LayerMapping object is initialized using the given Model (not an instance), a DataSource (or string path to an OGR-supported data file), and a mapping dictionary. See the module level docstring for more details and keyword argument usage.
Check the Layer metadata and ensure that it's compatible with the mapping information and model. Unlike previous revisions, there is no need to increment through each feature in the Layer.
Given the OGRGeomType for a geometry and its associated GeometryField, determine whether the geometry should be turned into a GeometryCollection.
Save the contents from the OGR DataSource Layer into the database according to the mapping dictionary given at initialization. Keyword Parameters: verbose: If set, information will be printed subsequent to each model save executed on the database. fid_range: May be set with a slice or tuple of (begin, end) feature ID's to map from the data source. In other words, this keyword enables the user to selectively import a subset range of features in the geographic data source. step: If set with an integer, transactions will occur at every step interval. For example, if step=1000, a commit would occur after the 1,000th feature, the 2,000th feature etc. progress: When this keyword is set, status information will be printed giving the number of features processed and successfully saved. By default, progress information will pe printed every 1000 features processed, however, this default may be overridden by setting this keyword with an integer for the desired interval. stream: Status information will be written to this file handle. Defaults to using `sys.stdout`, but any object with a `write` method is supported. silent: By default, non-fatal error notifications are printed to stdout, but this keyword may be set to disable these notifications. strict: Execution of the model mapping will cease upon the first error encountered. The default behavior is to attempt to continue.
Given the feature keyword arguments (from `feature_kwargs`), construct and return the uniqueness keyword arguments -- a subset of the feature kwargs.
Given an OGR Feature, the related model and its dictionary mapping, retrieve the related model for the ForeignKey mapping.
Verify the geometry -- construct and return a GeometryCollection if necessary (for example if the model field is MultiPolygonField while the mapped shapefile only contains Polygons).
Verify if the OGR Field contents are acceptable to the model field. If they are, return the verified value, otherwise raise an exception.
Undocumented
Undocumented
Value |
|