All Cadcorp SIS API Methods

CreateItem Method

Description

Creates an Item from a Blob string. If a Group is open, then graphics are added to the Group, otherwise a new Item is created.

Syntax

Visual Basic
Public Function CreateItem( _
   ByVal blob As String, _
   ByVal prj As String, _
   ByVal fmt As Integer _
) As Integer

Parameters

blob
The stored Item Blob string.
 
prj
 
The named Coordinate Reference System of the stored Item Blob. This can be defined as:
  • OGC URNs (eg 'urn:ogc:def:crs:OGC:1.3:CRS84')
  • EPSG URNs (eg 'urn:ogc:def:crs:EPSG::27700')
  • EPSG code strings (eg 'EPSG:27700')
  • EPSG URLs (eg 'http://www.example.com/epsg#27700' or 'http://www.example.com/epsg.xml#27700')
  • EPSG codes as a simple string (eg '27700')
If blank, this will default to the current 'axes' CRS.
 
fmt

The format of the stored Item Blob.

SIS_BLOB_OGIS_WKT 2 = OGC Well-Known-Text format
SIS_BLOB_OGIS_GML 3 = OGC Geographic Markup Language
SIS_BLOB_GEOJSON 6 = Geographic Objects for JSON format

Remarks

When modifying an item which is stored as a blob in a database, it is good practice to create a temporary version of the item on an editable overlay and only commit changes to the database, (after using using GetBlob, to get the new Blob string and when the user is satisfied with the changes).

This allows any changes to other columns in the database table to be done in the same transaction.

Open Geospatial Consortium WKT format enables the creation of items directly as an alternative to the MoveTo/LineTo and StoreAsLine/StoreAsArea methods.

Below are examples of the WKT syntax for creating various geometry items.

TIP: The StoreAsArea method is unnecessary after creating an area using this method.

To create a polygon item, an L shape 30 metres by 30 metres:

sBlobText = "POLYGON ((0 0,30 0,30 10,10 10,10 30,0 30,0 0))"
GisCreateItem (sBlobText, "*APrjNatGrid", SIS_BLOB_OGIS_WKT)

To create a polygon item 30 metre square with 10 metre square hole:

sBlobText = "POLYGON ((0 0,30 0,30 30,0 30,0 0),(20 20,20 10,10 10,10 20,20 20))"
GisCreateItem (sBlobText, "*APrjNatGrid", SIS_BLOB_OGIS_WKT)

X and Y coordinates are separated by a space, and each pair of coordinates is separated by a comma.

TIP: Use the GetBlob method to analyse the syntax of other geometry types.

Available: GEO D OM OD OV SISpy

Group:

Example

sis.CreateItem (blob, "*APrjNatGrid", SIS_BLOB_SIS)

Creates an item on the current overlay using the value of blob.