Graphics Reference
In-Depth Information
and longitude values. This is the default CRS used for new data imported into QGIS.
However, if your data uses a different coordinate reference system, you will need to create
and use a different CRS for your map layer.
The qgis.core.QgsCoordinateReferenceSystem class represents a CRS.
Once you create your coordinate reference system, you can tell your map layer to use that
CRS when accessing the underlying data. For example:
crs = QgsCoordinateReferenceSystem(4326,
QgsCoordinateReferenceSystem.EpsgCrsId)
layer.setCrs(crs)
Note that different map layers can use different coordinate reference systems. Each layer
will use its CRS when drawing the contents of the layer onto the map.
Vector layers
A vector layer draws geospatial data onto a map in the form of points, lines, polygons, and
so on. Vector-format geospatial data is typically loaded from a vector data source such as
a shapefile or database. Other vector data sources can hold vector data in memory, or load
data from a web service across the Internet.
A vector-format data source has a number of features, where each feature represents a
single record within the data source. The qgis.core.QgsFeature class represents a
feature within a data source. Each feature has the following components:
ID : This is the feature's unique identifier within the data source
Geometry : This is the underlying point, line, polygon, and so on, which repres-
ents the feature on the map. For example, a city data source would have one fea-
ture for each city, and the geometry would typically be either a point that repres-
ents the center of the city, or a polygon (or a multipolygon) that represents the
city's outline.
Attributes : These are key/value pairs that provide additional information about
the feature. For example, a city data source representing cities might have attrib-
utes such as total_area , population , elevation , and so on. Attribute
values can be strings, integers, or floating point numbers.
In QGIS, a data provider allows the vector layer to access the features within the data
source. The data provider, an instance of qgis.core.QgsVectorDataProvider ,
includes:
Search WWH ::




Custom Search