Tag Info

New answers tagged

0

Data Provider vs Vector Layer A vector layer has a data provider which (normally [1]) is used to store data persistently. If you edit something on the layer with a normal edit session, your changes will be saved in the vector layer until you commit them, then they will be sent to the data provider. Edit Sessions In your example you start an edit session ...


1

Here is one solution, perhaps there is other but this one works first create the layer : qDebug() << "Create Memory Layer Tracks"; QgsVectorLayer * lVectorLayer = new QgsVectorLayer("Point","TRACKS","memory"); lVectorLayer->isValid(); qDebug() << "Vector valid :" << lVectorLayer->isValid(); QgsVectorDataProvider * lDataProvider = ...


1

Here is the solution gsGeometry * MyPoint; MyPoint = QgsGeometry::fromPoint(QgsPoint(PosX,PosY)); QgsGeometryMap MyGeometryMap; QgsFeatureId MyFeatureId; MyGeometryMap.insert(MyFeatureId,*MyPoint); or this way gsGeometry MyPoint; MyPoint.fromPoint(QgsPoint(PosX,PosY)); QgsGeometryMap MyGeometryMap; QgsFeatureId MyFeatureId; ...


0

I found the solution A lot of post on stackexchange showme the way to do that Here a sample extract of the code in c++ : //Declaration CMyQgsMapCanvas * mpMapCanvas; QgsMapToolEmitPoint * mpClickPoint; mpMapCanvas = new CMyQgsMapCanvas( this, NULL); mpMapCanvas->create(); mpMapCanvas->setProjection(); mpClickPoint = new ...


1

I wasn't able to locate an API method in QGIS to do it, but there is a GDAL function: GDALRasterizeGeometries (there are a couple of variants.) This method is used internally by gdal_rasterize.


0

Here is the code without error QgsVectorFileWriter * writer; writer = new QgsVectorFileWriter("/tmp/myshapes.shp", "CP1250", MyQgsFields, QGis::WKBPoint, mpMapCanvas->mQgsCoordinate, ...


1

If you review the API (http://qgis.org/api/classQgsVectorFileWriter.html) for QgsVectorFileWriter, the constructor looks like: QgsVectorFileWriter::QgsVectorFileWriter ( const QString & vectorFileName, const QString & fileEncoding, const QgsFields & fields, QGis::WkbType geometryType, const ...


2

Here is the code in C++ based on the post here : How to set Marker Line symbol for QgsVectorLayer by using Python? thanks to Durga for the link in his answer. So here is the code in c++ to change the style of the border of a polygon, in this exemple the color is white and the penstyle is dashed. QgsSymbolLayerV2Registry * MyRegistry = ...


2

Refer this post in the SE ..it is for python.Same method can be used for C++


1

Here is the solution,I finally understand why In fact a defaultSymbol is been created when I instanciate newsymbol , so instead of do an appendSymbolLayer I had to delete the default symbolLayer first and insert the new one to replace it The code is now : for(int i = 0 ; i < lListValue.size() ; i++) { QgsSymbolV2* newsymbol = ...



Top 50 recent answers are included