Graphics Reference
In-Depth Information
This will create a memory-based layer named
"My Layer"
, which stores polygon fea-
tures with no attributes.
The
path
parameter will let us do much more than simply define the type of geometry to
be stored in the layer. The
path
parameter has the following overall syntax:
geometryType?key=value&key=value...
This URL-like syntax starts with the type of geometry, and can have any number of key/
value pairs that provide additional information about the memory layer. The following
geometry types are currently supported:
•
Point
•
LineString
•
Polygon
•
MultiPoint
•
MultiLineString
•
MultiPolygon
Using the key/value pairs, you can also define:
• The coordinate reference system that the layer should use. For example:
crs=IGNF:WGS84G
The coordinate reference system can be defined using a CRS authority code, as in
the preceding example, or you can specify the CRS in WKT format, for example:
crs=+proj=longlat +a=69000 +b=55000 +no_defs
.
Note
If you don't define the coordinate reference system in this way, QGIS will prompt
the user to select a CRS when your program is run. This could be very confusing
for the user, so you should always specify a CRS when you create a memory lay-
er.
• Attributes to store for each feature within the layer. Here is an example of an at-
tribute definition:
field=phone_number:string