Hot answers tagged

19

Use a point pattern fill, with half_square marker and 90 degree rotation Marker size: 10mm Distance: Horizontal 10mm, Vertical 5mm Displacement: Horizontal 5mm, Vertical 0mm Result: consistent brick pattern fill regardless of polygon shape For a different size of brick pattern, use these proportions, where X is the size of your point marker: Marker ...


13

Looks like you found something to work with in the end and I hope by now you have a solution. I recently had a similar issue to yourself so I set about creating my own QML styles for OSM Shapefiles. You can find them on my github here: https://github.com/charleyglynn/OSM-Shapefile-QGIS-stylesheets


10

Nice answer from @whyzar! You could load .clr files into QGIS and then save it as a .qml file. As described in this post, the standard text format is: Value R G B Alpha Label So in your case, you could create a text file with: 19,161,161,161,255,19 21,152,181,129,255,21 22,114,168,144,255,22 23,124,142,173,255,23 And load it from the menu: You can then ...


9

I have my qml styles in a fix path (c:/pyqgis_data/Styles/). So, to load arrows_red_orange.qml (exclusively for point layers), next lines at the Python Console of QGIS work: >>>layer = iface.activeLayer() >>>if layer.geometryType() == QGis.Point: >>>...layer.loadNamedStyle('c:/pyqgis_data/Styles/arrows_red_orange.qml') >>&...


6

Thanks to Chris and Nyall and the work done to add data defined symbols there is now functions in QGIS to be able colour a symbol on the fly based on a column or expression. (Note: You need to be running the dev build of QGIS) You will have to break the parts into different columns, or you can do it on the fly using the string functions in the expression ...


6

The solution to create a qml file from RGB field values was presented in Python in How to use a field-to-RGB mapping for symbology in QGIS? but, as pointed out by Ryan Garnett, the problem is to convert the CMYK colour to RGB because: "it seems that there is the notion out there that conversion from CMYK to RGB is easy. Newsflash: It’s not. As every ...


5

I haven't yet to find a clean cut way to do this. I have come across different resources that can offer option to work with in attempting to achieve what you are interested in. Converting/using ArcGIS *.style file for/in QGIS (QML or SLD)? The style file might be for ARCGIS users. It is not in a human readable format. QGIS uses XML-files to store styling ...


5

Yes there is a way, and it is only a bit hacky: In a point file, open up the symbology and hit the "Data defined override" to the right of Fill color (for reference see the image). In the context menu which opens up, choose Edit.... Here you can paste this code: '#' || right(@layer_id, 6) Then you can save the symbology as .qml and use it to ...


5

Click on it, then right click "Raw" and choose "Save as..." Here for example with firefox in german:


4

The expression functions are all stored under .qgis2\python\expressions You can copy and install them onto any machine that needs them. The other option is to add them as a Python macro for the project under Project -> Properties -> Marcos. Paste the text of your expression function in the there.


4

You can use QgsMapLayer::saveNamedStyle to export .qml files: layer.saveNamedStyle('/path/to/style.qml') EDIT: Yes, you can create a .qml file outside QGIS. I tested this in a standalone script (which was mentioned in the comment by @AlexandreNeto). This is the code I used (note that I use Windows so you will need to change your paths accordingly): from ...


4

There's now a tool ("slyr") which will do basic .style to qgis symbol conversion. See https://github.com/nyalldawson/slyr


3

I think you are trying to open the .txt file from the Style buttom. You must open the file from another place. Review this picture where I opened your file without a problem. I made a red circle in the folder icon you need to use.


3

The QML location is irrelevant. Once you have selected the qml file to apply it to a layer in your project, its information is "copied" to the project file - which is likely somewhere else. SVG paths in the QML file are relative to the path you have declared in QGIS options. You can add a new path pointing to the folder holding the qml + svg if you want.


3

You can load multiple styles using pyqgis script (explanations in comments): import os from qgis.core import QgsMapLayerStyle from qgis.utils import iface # set path to your styles here qml_path = '/home/user/qml' layer = iface.activeLayer() style_manager = layer.styleManager() # read valid style from layer style = QgsMapLayerStyle() style.readFromLayer(...


3

Another option might be to save the style as a .lyr file. Then use http://wald.intevation.org/projects/arcmap2sld/ to convert the .lyr file to an SLD and then use that SLD within QGIS In QGIS, right click on the layer > properties > load style then use the drop down box to select SLD I have not tried this but it may work, if it does let us know as I would ...


3

Try to modify this template: **Here is an example of a working .qml:** `<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'> <qgis version="2.18.18" minimumScale="inf" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0"> <pipe> <rasterrenderer opacity="1" alphaBand="-1" classificationMax="11.485" classificationMinMaxOrigin="...


3

I think your problem is understanding that a QML file is a style only for a specific dataset (or related dataset with the same structure) and not a file that provide you with a palette or a set of symbol that you can reuse for any data. For exemple you may have a QML that will symbolise road based on a specific attribute, this is useful if your road data ...


3

you need call def postProcessAlgorithm method.I add an example of how the code should be, def postProcessAlgorithm(self, context, feedback): """ PostProcessing to define the Symbology """ output = QgsProcessingUtils.mapLayerFromString(self.dest_id, context) path = ='./path/to/style.qml' output....


3

Yes it is possible. A GeoPackage is a special kind of SQLite database, and when QGIS saves QML data with a geopackage layer it saves the text and metadata of the QML in a table called layer_styles. The table has the following schema: CREATE TABLE IF NOT EXISTS "layer_styles" ( "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "f_table_catalog" ...


3

You could open the python console and execute the code below, for QGIS 3.X, to randomly change all the layers' colors. from random import randrange layers = [layer for layer in QgsProject.instance().mapLayers().values()] for layer in layers: layer.renderer().symbol().setColor(QColor.fromRgb(randrange(256), randrange(256), randrange(256))) #redraw the ...


3

I just need to push the button "classify" in the style settings in the layer settings, after I imported the QML-file. Then it reduces the 44 clc classes to the actual existing 25 clc classes in the region. In the screenshot, you can see that clc classes not existing in the region (like the ocean, lagunes, etc.) are not shown in the legend anymore.


2

Searching for "QGIS Style" on github.com reveals a few repos with some style files in. The best of all these is probably Anita Graser's styles and related blog post: https://anitagraser.com/2014/05/31/a-guide-to-googlemaps-like-maps-with-osm-in-qgis/


2

I think what you are looking for is a symbology file. The default would be ~/.qgis/symbology-ng-style.xml QMLs are layer style files. Reusable symbol libraries are stored in XMLs which can be imported and exported using Style Manager.


2

In QGIS, the preferred/canonical way to store a color ramp is QGIS layer styles (.qml) files. If you look inside the qml file using a simple text editor, you'll find there is nothing hard to understand. ColorRamp example: <colorramp type="gradient" name="[source]"> <prop k="color1" v="247,251,255,255"/> <prop k="color2" v="8,48,107,255"/...


2

The transparency is given by the so called Alpha Channel (Alpha compositing) In a .qml file: <symbols> <symbol alpha="0.10" clip_to_extent="1" type="fill" name="0"> This is the alpha value of the symbol (Layer transparency) and the value is 0.10 which corresponds to a transparency value of 0.9 If you try with multiple values of ...


2

After your edit, here's a suggestion. Stop using QML and switch to SLD. When you save the SLD from QGIS, it doesn't contain the labeling (at least not in v 2.7.2). SLD is an open standard by OGC based on XML schema. See the SLD spec here. Just create your style as before but export to SLD and you can edit in Notepad (using the SLD reference). I advocate ...


2

My apologies for the off-the-record answer. For me it seems you have found a bug :-) I can reproduce your problem and did not find a solution/explanation for it... Before ADDED INFORMATION Strange, but I don't think it's a bug. In QGIS 2.4 I loaded a vector layer, applied a style by loading a .qml saved in QGIS 2.2, and there were no issues. I made a ...


2

Not sure if you seen this link before but perhaps it might be of some use as it contains several style files for various types of features: QGIS stylesheets for OpenStreetMap Or click here to directly download the style files.


2

The style file might be for ARCGIS users. It is not in a human readable format. QGIS uses XML-files to store styling properties, so you have no luck with just renaming the extension. I am not aware of any ESRI-to-QGIS style converter. According to this question: How to Edit Reference Styles in ArcMap 10 You can rename the style file to a .mdb MS Access ...


Only top voted, non community-wiki answers of a minimum length are eligible