├── LICENSE
├── README.md
├── cmm_tesselation.xml
├── collections
├── Geosupportsystem
│ ├── composer_templates
│ │ ├── Drawing A1 Landscape.qpt
│ │ ├── Index A4 Landscape.qpt
│ │ ├── Index A4 Portrait.qpt
│ │ ├── Index Square.qpt
│ │ ├── MGRS_Map.qpt
│ │ ├── Map_grid_1km_cornerlabel_5minLatLong.qpt
│ │ ├── Military A1 Portrait.qpt
│ │ ├── Military A3 Landscape.qpt
│ │ ├── Military A3 Portrait.qpt
│ │ ├── Report A4 Cover.qpt
│ │ ├── Report Letter Cover.qpt
│ │ ├── Screen 4K 2160p.qpt
│ │ ├── Screen FullHD 1080p.qpt
│ │ ├── Screen Instagram.qpt
│ │ ├── Simple A3 Landscape.qpt
│ │ ├── Simple A3 Portrait.qpt
│ │ ├── Simple A4 Landscape.qpt
│ │ ├── Simple A4 Portrait.qpt
│ │ ├── Simple Letter Landscape.qpt
│ │ ├── Simple Letter Portrait.qpt
│ │ ├── Standard A3 Landscape.qpt
│ │ ├── Standard A3 Portrait.qpt
│ │ ├── Standard A4 Landscape.qpt
│ │ └── Standard A4 Portrait.qpt
│ ├── processing
│ │ ├── ForceDeleteColumn.py
│ │ ├── GridMod.py
│ │ ├── MakePolygonMeasureLines.zip
│ │ ├── NorthReference.py.help
│ │ ├── SelectWithinDistance.model
│ │ ├── UTM_grid_labels.json
│ │ ├── enabelAdvancedLabels.py
│ │ ├── minMaxFromMap.py
│ │ ├── models
│ │ │ ├── AtlasGrid.model3
│ │ │ ├── GetFromPostGIS.model3
│ │ │ └── WurmanCircles.model3
│ │ ├── scripts
│ │ │ ├── grid_neighbours.py
│ │ │ └── smhi_varningar.py
│ │ └── skala.py
│ ├── project_templates
│ │ ├── 1kmGridCornerLabels.qpt
│ │ ├── Scalebar5km.qpt
│ │ ├── Sweref99TM.qpt
│ │ └── index_grid_map.qpt
│ ├── python
│ │ ├── expressions
│ │ │ ├── Feature Description.csv
│ │ │ ├── GridMod.py
│ │ │ ├── fac_code.py
│ │ │ ├── layout_extent.py
│ │ │ ├── layoutfunctions.py
│ │ │ ├── randompointsinpoly.py
│ │ │ ├── skala.py
│ │ │ └── userfunctions.py
│ │ ├── patch_generator.py
│ │ └── qgis_basemaps.py
│ ├── svg
│ │ └── madeWithQGIS.svg
│ └── symbol
│ │ ├── 5f2b028244e4f1.91634423.xml
│ │ ├── 70s_wallpaper.xml
│ │ ├── Building_scale_adjusting_measurements.qml
│ │ ├── CoolWaterStyle.xml
│ │ ├── Höjdkurvor_25k_skala.qml
│ │ ├── Lines.xml
│ │ ├── Maki-Temaki_QGIS_markers.xml
│ │ ├── OSM_MVT_test.qlr
│ │ ├── OSM_MVT_test.qml
│ │ ├── OpenStreetMap_Childs_Book_Style.qlr
│ │ ├── Perimeter LineArt1.xml
│ │ ├── Polygon Flowers.xml
│ │ ├── RoughDrops.xml
│ │ ├── Selection_styles.xml
│ │ ├── Toy Bricks.xml
│ │ ├── barb-wire_bad-sutures_chain_zipper.xml
│ │ ├── barb_wire.xml
│ │ ├── bloated.xml
│ │ ├── bricks.xml
│ │ ├── bursting.xml
│ │ ├── circle_overlap.xml
│ │ ├── cmm_tesselation.xml
│ │ ├── crayon_fill.xml
│ │ ├── crayon_polygon_outside.xml
│ │ ├── cross_stitch.xml
│ │ ├── cubes.xml
│ │ ├── denim.xml
│ │ ├── diamond_plate.xml
│ │ ├── dormido_fill.xml
│ │ ├── dormido_rough.xml
│ │ ├── edge_bleed.xml
│ │ ├── fantasia.xml
│ │ ├── gold.xml
│ │ ├── interference.xml
│ │ ├── lava.xml
│ │ ├── lm_markers.xml
│ │ ├── mattress.xml
│ │ ├── measure_construction.xml
│ │ ├── mix_styles_20200606.xml
│ │ ├── nonstop.xml
│ │ ├── ol_bana_linjestil.qml
│ │ ├── organic_blocks.xml
│ │ ├── panel.xml
│ │ ├── qbert.xml
│ │ ├── random_points_geometry_generator.md
│ │ ├── readme.md
│ │ ├── rock_crystal.xml
│ │ ├── sky.xml
│ │ └── test.txt
└── krishantering
│ ├── license.txt
│ ├── svg
│ ├── enhet.svg
│ ├── enhet_forsvarsmakten.svg
│ ├── enhet_polisen.svg
│ ├── enhet_raddningstjansten.svg
│ ├── enhet_sjofartsverket.svg
│ ├── enhet_skogsrojning.svg
│ ├── fara.svg
│ ├── fara_bensinstation.svg
│ ├── fara_person_med_vardbehov.svg
│ ├── fara_seveso.svg
│ ├── fordon.svg
│ ├── fordon_brandbil.svg
│ ├── fordon_gravmaskin_med_band.svg
│ ├── fordon_helikopter.svg
│ ├── fordon_med_band.svg
│ ├── fordon_med_hjul.svg
│ ├── fordon_schaktmaskin_med_band.svg
│ ├── fordon_tankbil_med dricksvatten.svg
│ ├── handelse.svg
│ ├── handelse_avbrott_i_dricksvatten.svg
│ ├── handelse_bat_i_sjonod.svg
│ ├── handelse_bilolycka.svg
│ ├── handelse_internetavbrott.svg
│ ├── handelse_nedfallet_trad.svg
│ ├── handelse_stromavbrott.svg
│ ├── handelse_teleavbrott.svg
│ ├── ovrigt_befolkningspunkt.svg
│ ├── resurs.svg
│ ├── resurs_brandstation.svg
│ ├── resurs_helikopterlandningsplats.svg
│ ├── resurs_mobilt_kraftverk.svg
│ ├── resurs_polisstation.svg
│ ├── resurs_pump.svg
│ ├── resurs_sjukhus.svg
│ ├── resurs_sjukvardsplats.svg
│ ├── resurs_stabsplats.svg
│ ├── skyddsv.svg
│ ├── skyddsv_aldreboende.svg
│ ├── skyddsv_mobilmast.svg
│ ├── skyddsv_vardcentral_halsocentral.svg
│ ├── skyddsv_vindkraftverk.svg
│ └── test.txt
│ └── symbol
│ ├── Färgramp.xml
│ ├── Linjer.xml
│ ├── Punktobjekt.xml
│ └── readme.md
├── metadata.ini
└── sky.xml
/README.md:
--------------------------------------------------------------------------------
1 | # QGIS_resources
2 | För användning av insticksprogrammet "Resource Sharing" till QGIS.
3 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/composer_templates/Screen Instagram.qpt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/ForceDeleteColumn.py:
--------------------------------------------------------------------------------
1 | ##Force Delete Table Column=name
2 | ##Vector_layer=vector
3 | ##Table_Field_to_Delete=field Vector_layer
4 | # The script forcefully deletes named fields from a vector layer table.
5 | # You get NO second chance, or opportunity to rollback.
6 | # If you want that, you can use the much slower built in functions.
7 |
8 | from qgis.core import QgsVectorLayer, QgsVectorDataProvider, QgsMapLayerRegistry, QgsMessageLog
9 | QgsMessageLog.logMessage("Layer to process: %s" % Vector_layer, "ForceDelete")
10 | QgsMessageLog.logMessage("Field to Force Delete: %s" % Table_Field_to_Delete, "ForceDelete")
11 |
12 | vectorLayer = QgsVectorLayer(Vector_layer, 'TEMP', "ogr")
13 | vectorLayer.isValid()
14 | QgsMessageLog.logMessage("Getting Field Index for: %s" % Table_Field_to_Delete, "ForceDelete")
15 | fieldID = vectorLayer.fieldNameIndex(Table_Field_to_Delete)
16 | QgsMessageLog.logMessage("Deleting Field", "ForceDelete")
17 | vectorLayer.dataProvider().deleteAttributes([fieldID])
18 | vectorLayer.updateFields()
19 | QgsMessageLog.logMessage("Reload Table...", "ForceDelete")
20 | QgsMapLayerRegistry.instance().reloadAllLayers()
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/GridMod.py:
--------------------------------------------------------------------------------
1 | """
2 | Try combining the functions in custom labels for two grids with 1000 meter interval lines.
3 |
4 | first:
5 |
6 | if(left(right( @grid_number , 4),1) = 0,
7 | if( @grid_axis = 'x', longNumber( @grid_number ), ''),
8 | shortNumber( @grid_number ))
9 |
10 | second:
11 |
12 | if(left(right( @grid_number , 4),1) = 0,
13 | if( @grid_axis = 'y', longNumber( @grid_number ), ''),
14 | '' )
15 |
16 | Klas Karlsson
17 |
18 | """
19 |
20 | from qgis.core import *
21 | from qgis.gui import *
22 |
23 | @qgsfunction(args='auto', group='Custom')
24 | def shortNumber(gridNumber, feature, parent):
25 | """
26 | Converts coordinates to "kilometer grid index".
27 |
Example:
28 | shortNumber(123456) -> '23'
29 | Tips
30 | Try:
31 | shortNumber( @grid_number )
32 | """
33 | gridString = str(int(gridNumber))
34 | return gridString[len(gridString)-5:len(gridString)-3]
35 |
36 |
37 | @qgsfunction(args='auto', group='Custom')
38 | def longNumber(gridNumber, feature, parent):
39 | """
40 | Converts coordinates to "kilometer grid index" with superscript characters to create a "full" coordinate.
41 | Example:
42 | longNumber(123456) -> '1 23456 '
43 | Tips
44 | Try:
45 | longNumber( @grid_number )
46 | Unicode Font
47 | You need to select a font that supports unicode for this to work.
48 | """
49 | gridString = str(int(gridNumber))
50 | fullString = ''
51 | supScr = (u'\u2070',u'\u00B9',u'\u00B2',u'\u00B3',u'\u2074',u'\u2075',u'\u2076',u'\u2077',u'\u2078',u'\u2079')
52 | charNumber = len(gridString)
53 | for char in gridString:
54 | if charNumber == 5 or charNumber == 4:
55 | fullString += char
56 | else:
57 | fullString += supScr[int(char)]
58 | charNumber -= 1
59 |
60 | return fullString
61 |
62 |
63 | @qgsfunction(args='auto', group='Custom')
64 | def indexNumber(gridNumber, feature, parent):
65 | """
66 | Converts coordinates to "kilometer grid index" with superscript characters to create a label with 100 km "index" number.
67 | Example:
68 | indexNumber(123456) -> '1 23'
69 | Tips
70 | Try:
71 | indexNumber( @grid_number )
72 | Unicode Font
73 | You need to select a font that supports unicode for this to work.
74 | """
75 | gridString = str(int(gridNumber))
76 | fullString = ''
77 | supScr = (u'\u2070',u'\u00B9',u'\u00B2',u'\u00B3',u'\u2074',u'\u2075',u'\u2076',u'\u2077',u'\u2078',u'\u2079')
78 | charNumber = len(gridString)
79 | for char in gridString:
80 | if charNumber == 5 or charNumber == 4:
81 | fullString += char
82 | if charNumber >= 6:
83 | fullString += supScr[int(char)]
84 | charNumber -= 1
85 | return fullString
86 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/MakePolygonMeasureLines.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/klakar/QGIS_resources/2d79be30f914c08ed4939ccacac14669d5a1c0f8/collections/Geosupportsystem/processing/MakePolygonMeasureLines.zip
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/NorthReference.py.help:
--------------------------------------------------------------------------------
1 | {"ALG_DESC": "Generate North Reference SVG file", "ALG_CREATOR": "Klas Karlsson", "Output_SVG_file": "Filename to save the generated graphics to.\n\nExisting file will be overritten.", "ALG_VERSION": "1.0.0", "ALG_HELP_CREATOR": "Klas Karlsson", "Magnetic_Declination": "(Value in decimal degree.)\n\nAngle from True North to the Magnetic North Pole.\nThis value changes over time, so you need to check it (example: http://www.magnetic-declination.com/).", "Grid_Reference": "(Value in decimal degrees.)\n\nFor a map with a projected coordiante system the grid reference should be \"0\".", "True_North_Reference": "(Value in decimal degrees.)\n\nAngle from Grid North that represents the direction to True North (Geographic North).\n\nFor an unprojected map (WGS-84) this should be \"0\"."}
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/SelectWithinDistance.model:
--------------------------------------------------------------------------------
1 | {
2 | "values": {
3 | "inputs": {
4 | "selectfrom": {
5 | "values": {
6 | "pos": {
7 | "values": {
8 | "y": 298.0,
9 | "x": 139.0
10 | },
11 | "class": "point"
12 | },
13 | "param": {
14 | "values": {
15 | "isAdvanced": false,
16 | "name": "selectfrom",
17 | "shapetype": [
18 | -1
19 | ],
20 | "default": null,
21 | "value": null,
22 | "exported": null,
23 | "hidden": false,
24 | "optional": false,
25 | "description": "Select From Layer"
26 | },
27 | "class": "processing.core.parameters.ParameterVector"
28 | }
29 | },
30 | "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
31 | },
32 | "withindistance": {
33 | "values": {
34 | "pos": {
35 | "values": {
36 | "y": 121.0,
37 | "x": 139.0
38 | },
39 | "class": "point"
40 | },
41 | "param": {
42 | "values": {
43 | "isAdvanced": false,
44 | "name": "withindistance",
45 | "min": null,
46 | "default": 0,
47 | "max": null,
48 | "value": 0,
49 | "hidden": false,
50 | "isInteger": true,
51 | "optional": false,
52 | "description": "WithinDistance"
53 | },
54 | "class": "processing.core.parameters.ParameterNumber"
55 | }
56 | },
57 | "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
58 | },
59 | "fromobjects": {
60 | "values": {
61 | "pos": {
62 | "values": {
63 | "y": 210.0,
64 | "x": 140.0
65 | },
66 | "class": "point"
67 | },
68 | "param": {
69 | "values": {
70 | "isAdvanced": false,
71 | "name": "fromobjects",
72 | "shapetype": [
73 | -1
74 | ],
75 | "default": null,
76 | "value": null,
77 | "exported": null,
78 | "hidden": false,
79 | "optional": false,
80 | "description": "That are within a distance from"
81 | },
82 | "class": "processing.core.parameters.ParameterVector"
83 | }
84 | },
85 | "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
86 | }
87 | },
88 | "helpContent": {
89 | "ALG_DESC": "Select vectors from layer, that are within a distance from another vector layer.\n",
90 | "ALG_CREATOR": "Klas Karlsson\nGeosupportsystem.wordpress.com",
91 | "withindistance": "Distance in layer coordinat system units from \"NearObjects\" to use for selection distance.",
92 | "selectfrom": "Source layer to select from.",
93 | "ALG_VERSION": "",
94 | "ALG_HELP_CREATOR": "",
95 | "fromobjects": "Layer with objects to use as \"selectors\""
96 | },
97 | "group": "MyTools",
98 | "name": "SelectWithinDistance",
99 | "algs": {
100 | "QGISSELECTBYLOCATION_1": {
101 | "values": {
102 | "name": "QGISSELECTBYLOCATION_1",
103 | "paramsFolded": true,
104 | "outputs": {},
105 | "outputsFolded": true,
106 | "pos": {
107 | "values": {
108 | "y": 326.0,
109 | "x": 597.0
110 | },
111 | "class": "point"
112 | },
113 | "dependencies": [],
114 | "params": {
115 | "INPUT": {
116 | "values": {
117 | "name": "selectfrom"
118 | },
119 | "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
120 | },
121 | "PREDICATE": [
122 | "within"
123 | ],
124 | "PRECISION": 0.0,
125 | "INTERSECT": {
126 | "values": {
127 | "alg": "QGISFIXEDDISTANCEBUFFER_1",
128 | "output": "OUTPUT"
129 | },
130 | "class": "processing.modeler.ModelerAlgorithm.ValueFromOutput"
131 | },
132 | "METHOD": 0
133 | },
134 | "active": true,
135 | "consoleName": "qgis:selectbylocation",
136 | "description": "Select by location"
137 | },
138 | "class": "processing.modeler.ModelerAlgorithm.Algorithm"
139 | },
140 | "QGISFIXEDDISTANCEBUFFER_1": {
141 | "values": {
142 | "name": "QGISFIXEDDISTANCEBUFFER_1",
143 | "paramsFolded": true,
144 | "outputs": {},
145 | "outputsFolded": true,
146 | "pos": {
147 | "values": {
148 | "y": 190.0,
149 | "x": 473.0
150 | },
151 | "class": "point"
152 | },
153 | "dependencies": [],
154 | "params": {
155 | "INPUT": {
156 | "values": {
157 | "name": "fromobjects"
158 | },
159 | "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
160 | },
161 | "SEGMENTS": 5.0,
162 | "DISSOLVE": false,
163 | "DISTANCE": {
164 | "values": {
165 | "name": "withindistance"
166 | },
167 | "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
168 | }
169 | },
170 | "active": true,
171 | "consoleName": "qgis:fixeddistancebuffer",
172 | "description": "Fixed distance buffer"
173 | },
174 | "class": "processing.modeler.ModelerAlgorithm.Algorithm"
175 | }
176 | }
177 | },
178 | "class": "processing.modeler.ModelerAlgorithm.ModelerAlgorithm"
179 | }
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/UTM_grid_labels.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "Klas Karlsson",
3 | "exported_at": "2020-08-06T19:49:12",
4 | "expressions": [
5 | {
6 | "description": "\n\nUse as custom grid label expression with UTM grids.
\nIt will print kilometer numbers, and for even 10km lines also
\nthe value for the 100'000 km square.
\nExample: ⁴30
",
7 | "expression": "if(@grid_number%10000, -- If it is not an even 10 km line\nleft(right(@grid_number,5),2), -- Add standard km label\nwith_variable('index', -- Define a variable for index numbers\narray('⁰','¹','²','³','⁴','⁵','⁶','⁷','⁸','⁹'),\n\nif(@grid_number>999999, -- If the grid has more than 6 digits add index number for the 1'000'000 value\narray_get(@index, left(@grid_number,1)),'')\n|| -- And no matter what add index number for the 100'000 value\narray_get(@index, left(right(@grid_number,6),1))\n)\n|| -- Then add the km label with standard format\nleft(right(@grid_number,5),2)\n)\n",
8 | "group": "user",
9 | "name": "UTM Grid Labels",
10 | "type": "expression"
11 | }
12 | ],
13 | "qgis_version": "3.14.1-Pi"
14 | }
15 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/enabelAdvancedLabels.py:
--------------------------------------------------------------------------------
1 | ##Add Advanced Labeling Fields To Selected Layer=name
2 | from PyQt4.QtCore import QVariant
3 | from qgis.utils import iface
4 | from qgis.core import QgsField, QgsPalLayerSettings
5 |
6 | # Function source: https://gis.stackexchange.com/a/216110/55741
7 | def setColumnVisibility( layer, columnName, visible ):
8 | config = layer.attributeTableConfig()
9 | form = layer.editFormConfig()
10 | form.setWidgetType(layer.fieldNameIndex(columnName), "Hidden")
11 | columns = config.columns()
12 | for column in columns:
13 | if column.name == columnName:
14 | column.hidden = not visible
15 | break
16 | config.setColumns( columns )
17 | layer.setAttributeTableConfig( config )
18 |
19 | lager = iface.activeLayer()
20 | if not lager.isEditable():
21 | iface.actionToggleEditing().trigger()
22 | lager.dataProvider().addAttributes([QgsField("Text_X", QVariant.Double, 'double', 10, 5),
23 | QgsField("Text_Y", QVariant.Double, 'double', 10, 5), QgsField("Text_Ri", QVariant.Double, 'double', 3, 2), QgsField("Text_Vis", QVariant.Int, "", 3)])
24 | lager.updateFields()
25 | lager.commitChanges()
26 | lager.setDefaultValueExpression(lager.fieldNameIndex("Text_Vis"), '1')
27 | palager = QgsPalLayerSettings()
28 | palager.readFromLayer(lager)
29 | palager.enabled = True
30 | palager.setDataDefinedProperty(QgsPalLayerSettings.PositionX, True, False, '', "Text_X")
31 | palager.setDataDefinedProperty(QgsPalLayerSettings.PositionY, True, False, '', "Text_Y")
32 | palager.setDataDefinedProperty(QgsPalLayerSettings.Rotation, True, False, '', "Text_Ri")
33 | palager.setDataDefinedProperty(QgsPalLayerSettings.Show, True, False, '', "Text_Vis")
34 | setColumnVisibility( lager, 'Text_X', False)
35 | setColumnVisibility( lager, 'Text_Y', False)
36 | setColumnVisibility( lager, 'Text_Ri', False)
37 | setColumnVisibility( lager, 'Text_Vis', False)
38 | palager.writeToLayer(lager)
39 | rader = lager.getFeatures()
40 | for rad in rader:
41 | rad['Text_Vis'] = 1
42 | lager.updateFeature(rad)
43 | lager.commitChanges()
44 | lager.startEditing()
45 | iface.mapCanvas().refresh()
46 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/minMaxFromMap.py:
--------------------------------------------------------------------------------
1 | """
2 | Define new functions using @qgsfunction. feature and parent must always be the
3 | last args. Use args=-1 to pass a list of values as arguments
4 | """
5 |
6 | from qgis.core import QGis
7 | from qgis.gui import *
8 | from qgis.utils import qgsfunction, iface
9 |
10 |
11 | def map_bounds(composer_title, map_id):
12 | """
13 | Returns a rectangle with the bounds of a map
14 | from a specific composer
15 | """
16 | composers = iface.activeComposers()
17 | for composer_view in composers:
18 | composer_window = composer_view.composerWindow()
19 | window_title = composer_window.windowTitle()
20 | if window_title == composer_title:
21 | composition = composer_view.composition()
22 | map = composition.getComposerMapById(map_id)
23 | if map:
24 | extent = map.currentMapExtent()
25 | break
26 | else:
27 | extent = None
28 |
29 | return extent
30 |
31 | @qgsfunction(2,"python")
32 | def map_x_min(values, feature, parent):
33 | """
34 | Returns the minimum x coordinate of a map from a specific composer.
35 | Calculations are in the Spatial Reference System of the project.
36 |
37 | Syntax
38 |
39 | map_x_min(composer_title, map_id)
40 |
41 | Arguments
42 |
43 | composer_title - is string. The title of the composer where the map is.
44 | map_id - integer. The id of the map.
45 |
46 | Example
47 |
48 | map_x_min('my pretty map', 0) -> -12345.679
49 |
50 | """
51 | composer_title = values[0]
52 | map_id = values[1]
53 | map_extent = map_bounds(composer_title, map_id)
54 | if map_extent:
55 | result = map_extent.xMinimum()
56 | else:
57 | result = None
58 |
59 | return result
60 |
61 | @qgsfunction(2,"python")
62 | def map_x_max(values, feature, parent):
63 | """
64 | Returns the maximum x coordinate of a map from a specific composer.
65 | Calculations are in the Spatial Reference System of the project.
66 |
67 | Syntax
68 |
69 | map_x_max(composer_title, map_id)
70 |
71 | Arguments
72 |
73 | composer_title - is string. The title of the composer where the map is.
74 | map_id - integer. The id of the map.
75 |
76 | Example
77 |
78 | map_x_max('my pretty map', 0) -> 12345.679
79 |
80 | """
81 | composer_title = values[0]
82 | map_id = values[1]
83 | map_extent = map_bounds(composer_title, map_id)
84 | if map_extent:
85 | result = map_extent.xMaximum()
86 | else:
87 | result = None
88 |
89 | return result
90 |
91 | @qgsfunction(2,"python")
92 | def map_y_min(values, feature, parent):
93 | """
94 | Returns the minimum y coordinate of a map from a specific composer.
95 | Calculations are in the Spatial Reference System of the project.
96 |
97 | Syntax
98 |
99 | map_y_min(composer_title, map_id)
100 |
101 | Arguments
102 |
103 | composer_title - is string. The title of the composer where the map is.
104 | map_id - integer. The id of the map.
105 |
106 | Example
107 |
108 | map_y_min('my pretty map', 0) -> -12345.679
109 |
110 | """
111 | composer_title = values[0]
112 | map_id = values[1]
113 | map_extent = map_bounds(composer_title, map_id)
114 | if map_extent:
115 | result = map_extent.yMinimum()
116 | else:
117 | result = None
118 |
119 | return result
120 |
121 | @qgsfunction(2,"python")
122 | def map_y_max(values, feature, parent):
123 | """
124 | Returns the maximum y coordinate of a map from a specific composer.
125 | Calculations are in the Spatial Reference System of the project.
126 |
127 | Syntax
128 |
129 | map_y_max(composer_title, map_id)
130 |
131 | Arguments
132 |
133 | composer_title - is string. The title of the composer where the map is.
134 | map_id - integer. The id of the map.
135 |
136 | Example
137 |
138 | map_y_max('my pretty map', 0) -> 12345.679
139 |
140 | """
141 | composer_title = values[0]
142 | map_id = values[1]
143 | map_extent = map_bounds(composer_title, map_id)
144 | if map_extent:
145 | result = map_extent.yMaximum()
146 | else:
147 | result = None
148 |
149 | return result
150 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/models/GetFromPostGIS.model3:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/scripts/smhi_varningar.py:
--------------------------------------------------------------------------------
1 | from qgis.PyQt.QtCore import QCoreApplication
2 | from qgis.core import (QgsProcessing,
3 | QgsProcessingAlgorithm,
4 | QgsProcessingException,
5 | QgsProcessingOutputNumber,
6 | QgsProcessingParameterDistance,
7 | QgsProcessingParameterFeatureSource,
8 | QgsProcessingParameterVectorDestination,
9 | QgsProcessingParameterRasterDestination,
10 | QgsVectorLayer,
11 | QgsField,
12 | QgsFeature,
13 | QgsGeometry,
14 | QgsProject)
15 | import processing
16 | import requests
17 | import xml.etree.ElementTree as ET
18 |
19 |
20 | class ExampleProcessingAlgorithm(QgsProcessingAlgorithm):
21 | """
22 | Denna algoritm hämtar aktuella varningar från SMHI och skapar ett lager med dessa i QGIS.
23 | """
24 |
25 | def tr(self, string):
26 | """
27 | Returns a translatable string with the self.tr() function.
28 | """
29 | return QCoreApplication.translate('Processing', string)
30 |
31 | def createInstance(self):
32 | # Must return a new copy of your algorithm.
33 | return ExampleProcessingAlgorithm()
34 |
35 | def name(self):
36 | """
37 | Returns the unique algorithm name.
38 | """
39 | return 'smhivarningar'
40 |
41 | def displayName(self):
42 | """
43 | Returns the translated algorithm name.
44 | """
45 | return self.tr('Hämta varningar från SMHI')
46 |
47 | def group(self):
48 | """
49 | Returns the name of the group this algorithm belongs to.
50 | """
51 | return self.tr('Väder')
52 |
53 | def groupId(self):
54 | """
55 | Returns the unique ID of the group this algorithm belongs
56 | to.
57 | """
58 | return 'Varningar'
59 |
60 | def shortHelpString(self):
61 | """
62 | Returns a localised short help string for the algorithm.
63 | """
64 | return self.tr('Hämtar aktuella varningar från SMHI.')
65 |
66 | def initAlgorithm(self, config=None):
67 | """
68 | Here we define the inputs and outputs of the algorithm.
69 | """
70 |
71 |
72 | def processAlgorithm(self, parameters, context, feedback):
73 | """
74 | Here is where the processing itself takes place.
75 | """
76 |
77 | smhi_alerts = 'https://opendata-download-warnings.smhi.se/api/version/2/alerts.xml'
78 | smhi_layers = 'https://opendata-download-warnings.smhi.se/api/version/2/districtviews/all.xml'
79 | root = ET.fromstring(requests.get(smhi_layers).text)
80 | alert_root = ET.fromstring(requests.get(smhi_alerts).text)
81 |
82 | vy = QgsVectorLayer("Polygon", "SMHI-Polygoner", "memory")
83 | crs = vy.crs()
84 | crs.createFromId(4326)
85 | vy.setCrs(crs)
86 | from qgis.PyQt.QtCore import QVariant
87 | py = vy.dataProvider()
88 | py.addAttributes([QgsField("id", QVariant.Int),\
89 | QgsField("sort", QVariant.Int),\
90 | QgsField("category", QVariant.String),\
91 | QgsField("name", QVariant.String),\
92 | QgsField("event", QVariant.String),\
93 | QgsField("priority", QVariant.Int),\
94 | QgsField("level", QVariant.String),\
95 | QgsField("color", QVariant.String),\
96 | QgsField("description", QVariant.String)])
97 | vy.updateFields()
98 |
99 |
100 | for (id, sort, category, name, geometry) in root.findall('{urn:se:smhi:cap:metadata}district_view'):
101 | fy = QgsFeature()
102 | y = QgsGeometry.fromWkt(geometry[1].text)
103 | y.get().swapXy()
104 | fy.setGeometry(y)
105 | fy.setAttributes([id.text, \
106 | sort.text, \
107 | category.text, \
108 | name.text])
109 | py.addFeature(fy)
110 |
111 | for alert in alert_root.iter('{urn:oasis:names:tc:emergency:cap:1.2}info'):
112 | for area in alert.iter('{urn:oasis:names:tc:emergency:cap:1.2}area'):
113 | id = area[0].text
114 | for feature in vy.getFeatures():
115 | if feature['id'] == id:
116 | fid = feature.id()
117 |
118 | attribs = { 4 : alert[7][1].text, \
119 | 5 : int(alert[8][1].text), \
120 | 6 : alert[9][1].text, \
121 | 7 : alert[10][1].text, \
122 | 8 : alert[17].text}
123 | vy.dataProvider().changeAttributeValues({ fid : attribs })
124 |
125 |
126 |
127 | vy.updateExtents()
128 | QgsProject.instance().addMapLayer(vy)
129 |
130 | return {}
--------------------------------------------------------------------------------
/collections/Geosupportsystem/processing/skala.py:
--------------------------------------------------------------------------------
1 | """
2 | Define new functions using @qgsfunction. feature and parent must always be the
3 | last args. Use args=-1 to pass a list of values as arguments
4 | """
5 |
6 | from qgis.core import *
7 | from qgis.gui import *
8 |
9 | @qgsfunction(args='auto', group='Custom')
10 | def skala(kart_id, feature, parent):
11 | layouts = iface.activeComposers()
12 | for layout_vy in layouts:
13 | layout_ruta = layout_vy.composerWindow()
14 | layout_nu = layout_vy.composition()
15 | karta = layout_nu.getComposerMapById(kart_id)
16 | if karta:
17 | skala = int(karta.scale())
18 | return skala
19 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/project_templates/Scalebar5km.qpt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/expressions/GridMod.py:
--------------------------------------------------------------------------------
1 | """
2 | Try combining the functions in custom labels for two grids with 1000 meter interval lines.
3 |
4 | first:
5 |
6 | if(left(right( @grid_number , 4),1) = 0,
7 | if( @grid_axis = 'x', longNumber( @grid_number ), ''),
8 | shortNumber( @grid_number ))
9 |
10 | second:
11 |
12 | if(left(right( @grid_number , 4),1) = 0,
13 | if( @grid_axis = 'y', longNumber( @grid_number ), ''),
14 | '' )
15 |
16 | Klas Karlsson
17 |
18 | """
19 |
20 | from qgis.core import *
21 | from qgis.gui import *
22 |
23 | @qgsfunction(args='auto', group='Custom')
24 | def shortNumber(gridNumber, feature, parent):
25 | """
26 | Converts coordinates to "kilometer grid index".
27 | Example:
28 | shortNumber(123456) -> '23'
29 | Tips
30 | Try:
31 | shortNumber( @grid_number )
32 | """
33 | gridString = str(int(gridNumber))
34 | return gridString[len(gridString)-5:len(gridString)-3]
35 |
36 |
37 | @qgsfunction(args='auto', group='Custom')
38 | def longNumber(gridNumber, feature, parent):
39 | """
40 | Converts coordinates to "kilometer grid index" with superscript characters to create a "full" coordinate.
41 | Example:
42 | longNumber(123456) -> '1 23456 '
43 | Tips
44 | Try:
45 | longNumber( @grid_number )
46 | Unicode Font
47 | You need to select a font that supports unicode for this to work.
48 | """
49 | gridString = str(int(gridNumber))
50 | fullString = ''
51 | supScr = (u'\u2070',u'\u00B9',u'\u00B2',u'\u00B3',u'\u2074',u'\u2075',u'\u2076',u'\u2077',u'\u2078',u'\u2079')
52 | charNumber = len(gridString)
53 | for char in gridString:
54 | if charNumber == 5 or charNumber == 4:
55 | fullString += char
56 | else:
57 | fullString += supScr[int(char)]
58 | charNumber -= 1
59 |
60 | return fullString
61 |
62 | @qgsfunction(args='auto', group='Custom')
63 | def indexNumber(gridNumber, feature, parent):
64 | """
65 | Converts coordinates to "kilometer grid index" with superscript characters to create a label with 100 km "index" number.
66 | Example:
67 | indexNumber(123456) -> '1 23'
68 | Tips
69 | Try:
70 | indexNumber( @grid_number )
71 | Unicode Font
72 | You need to select a font that supports unicode for this to work.
73 | """
74 | gridString = str(int(gridNumber))
75 | fullString = ''
76 | supScr = (u'\u2070',u'\u00B9',u'\u00B2',u'\u00B3',u'\u2074',u'\u2075',u'\u2076',u'\u2077',u'\u2078',u'\u2079')
77 | charNumber = len(gridString)
78 | for char in gridString:
79 | if charNumber == 5 or charNumber == 4:
80 | fullString += char
81 | if charNumber >= 6:
82 | fullString += supScr[int(char)]
83 | charNumber -= 1
84 |
85 | return fullString
86 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/expressions/fac_code.py:
--------------------------------------------------------------------------------
1 | """
2 | Define new functions using @qgsfunction. feature and parent must always be the
3 | last args. Use args=-1 to pass a list of values as arguments
4 | """
5 |
6 | from qgis.core import *
7 | from qgis.gui import *
8 |
9 | import csv
10 | fac_dict = {}
11 | reader = csv.DictReader(open('Feature Description.csv'))
12 | for row in reader:
13 | fac_dict[row['FAC_CODE']] = row['FAC_NAME']
14 |
15 | @qgsfunction(args='auto', group='Custom')
16 | def facc(fac_code, feature, parent):
17 | return fac_dict[fac_code]
18 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/expressions/layout_extent.py:
--------------------------------------------------------------------------------
1 | from qgis.core import *
2 | from qgis.gui import *
3 |
4 | @qgsfunction(args='auto', group='Layouts', referenced_columns=[])
5 | def layout_map_extent(layout_name, map_name, feature, parent):
6 | """
7 | Collects the geometry (polygon) for the extent of a named map item in a named layout.
8 | Example usage:
9 | layout_map_extent('MyLayoutName', 'MyMapItemID') -> <geometry: Polygon>
10 | """
11 | map_extent = QgsRectangle
12 | project = QgsProject.instance()
13 | manager = project.layoutManager()
14 | layouts_list = manager.printLayouts()
15 | for layout in layouts_list:
16 | if layout.name() == layout_name:
17 | map_item = layout.itemById(map_name)
18 | map_extent = QgsGeometry.fromRect(map_item.extent())
19 |
20 | return map_extent
21 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/expressions/layoutfunctions.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Functions to help in creating advanced layouts.
4 | Adapted for QGIS 3
5 |
6 | map_x_min() functions removed since they can be replaced in QGIS 3 with:
7 | x_min(map_get(item_variables('map_item_id'),'map_extent'))
8 |
9 | 'map_item_id' refers to name given to map frame.
10 | """
11 |
12 | from qgis.core import *
13 | from qgis.gui import *
14 |
15 | """
16 | Functions to be used with grid coordinates (mostly)
17 | """
18 |
19 | @qgsfunction(args='auto', group='Advanced Layout')
20 | def utm_short(gridNumber, feature, parent):
21 | """
22 | Converts coordinates to "kilometer grid index".
23 | Example:
24 | utm_short(123456) -> '23'
25 | Tips
26 | Try:
27 | utm_short( @grid_number )
28 | """
29 | gridString = str(int(gridNumber))
30 | return gridString[len(gridString)-5:len(gridString)-3]
31 |
32 |
33 | @qgsfunction(args='auto', group='Advanced Layout')
34 | def utm_long(gridNumber, feature, parent):
35 | """
36 | Converts coordinates to "kilometer grid index" with superscript characters to create a "full" coordinate.
37 | Example:
38 | utm_long(123456) -> '1 23456 '
39 | Tips
40 | Try:
41 | utm_long( @grid_number )
42 | Unicode Font
43 | You need to select a font that supports unicode for this to work.
44 | """
45 | gridString = str(int(gridNumber))
46 | fullString = ''
47 | supScr = (u'\u2070',u'\u00B9',u'\u00B2',u'\u00B3',u'\u2074',u'\u2075',u'\u2076',u'\u2077',u'\u2078',u'\u2079')
48 | charNumber = len(gridString)
49 | for char in gridString:
50 | if charNumber == 5 or charNumber == 4:
51 | fullString += char
52 | else:
53 | fullString += supScr[int(char)]
54 | charNumber -= 1
55 |
56 | return fullString
57 |
58 | @qgsfunction(args='auto', group='Advanced Layout')
59 | def utm_index(gridNumber, feature, parent):
60 | """
61 | Converts coordinates to "kilometer grid index" with superscript characters to create a label with 100 km "index" number.
62 | Example:
63 | utm_index(123456) -> '1 23'
64 | Tips
65 | Try:
66 | utm_index( @grid_number )
67 | Unicode Font
68 | You need to select a font that supports unicode for this to work.
69 | """
70 | gridString = str(int(gridNumber))
71 | fullString = ''
72 | supScr = (u'\u2070',u'\u00B9',u'\u00B2',u'\u00B3',u'\u2074',u'\u2075',u'\u2076',u'\u2077',u'\u2078',u'\u2079')
73 | charNumber = len(gridString)
74 | for char in gridString:
75 | if charNumber == 5 or charNumber == 4:
76 | fullString += char
77 | if charNumber >= 6:
78 | fullString += supScr[int(char)]
79 | charNumber -= 1
80 |
81 | return fullString
82 |
83 | """
84 | Functions for MGRS lettering based on UTM easting/northing coordinates.
85 | """
86 |
87 | from qgis.utils import iface
88 | @qgsfunction(args='auto', group='Advanced Layout')
89 | def mgrs_bigram(easting, northing, utm_z, feature, parent):
90 | """
91 | Find MGRS bigram letters for 100 km square from E and N coordinate.
92 | Based on map UTM projection in WGS-84.
93 | Only adapted to Northern Hemisphere
94 | Example:
95 |
96 | mgrs_bigram( 495395, 6392411, 33) -> 'VD'
97 | Bigram for center of map with Item ID 'map'
98 | mgrs_bigram(x(map_get(item_variables('map'),'map_extent_center')),y(map_get(item_variables('map'),'map_extent_center')),to_int(right(map_get(item_variables('map'),'map_crs'),2)))
99 |
100 | """
101 | mgrs_col = utm_z%3
102 | col_type_list = [['S','T','U','V','W','X','Y','Z'],['A','B','C','D','E','F','G','H'],['K','L','M','N','P','Q','R']]
103 | col_100k = int(easting/100000)-1
104 | mgrs_row = utm_z%2
105 | row_list = ['A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V']
106 | if mgrs_row == 0:
107 | eq_offset = 5
108 | else:
109 | eq_offset = 0
110 | row_100k = (int(northing/100000) + eq_offset)%20
111 | bigram = col_type_list[mgrs_col][col_100k] + row_list[row_100k]
112 | return bigram
113 |
114 | @qgsfunction(args='auto', group='Advanced Layout')
115 | def mgrs_gzd(easting, northing, utm_z, feature, parent):
116 | """
117 | Find MGRS Grid Zone Designator from E and N coordinate.
118 | Based on map UTM projection in WGS-84.
119 | Only adapted to Northern Hemisphere
120 | Example:
121 |
122 | mgrs_gzd( 495395, 6392411, 33) -> '33V'
123 | GZD for center of map with Item ID 'map'
124 | mgrs_gzd(x(map_get(item_variables('map'),'map_extent_center')),y(map_get(item_variables('map'),'map_extent_center')),to_int(right(map_get(item_variables('map'),'map_crs'),2)))
125 |
126 | """
127 | gzd_list = ['C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X']
128 | gzd_nr = (int(northing/888960) + 10)%20
129 | gzd = str(utm_z) + gzd_list[gzd_nr]
130 | return gzd
131 |
132 | @qgsfunction(args='auto', group='Advanced Layout')
133 | def mgrs(easting, northing, epsg, feature, parent):
134 | """
135 | Requires mgrspy from Boundless
136 | pip install mgrspy
137 | Find MGRS from X and Y coordinate in EPSG.
138 |
139 | Example:
140 |
141 | mgrs( 495395, 6392411, 32633) -> '33VVD94574973545'
142 | mgrs( 15.048564, 57.405484, 4326) -> '33VWD1453591543'
143 |
144 | """
145 | crsSrc = QgsCoordinateReferenceSystem(epsg)
146 | crsDst = QgsCoordinateReferenceSystem(4326)
147 | xform = QgsCoordinateTransform(crsSrc, crsDst)
148 | pt = xform.transform(QgsPoint(easting,northing))
149 | from mgrspy import mgrs
150 | mgrs_out = mgrs.toMgrs(pt[1],pt[0],5) # Latitude first...
151 | return mgrs_out
152 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/expressions/randompointsinpoly.py:
--------------------------------------------------------------------------------
1 | from qgis.core import *
2 | from qgis.gui import *
3 |
4 | import random # Needed for generating pseudo random numbers
5 |
6 | @qgsfunction(args='auto', group='Geometry')
7 | def random_points_in_polygon(number_of_points, feature, parent):
8 | """
9 | random_points_in_polygon( n )
10 | Generates 'n' number of points inside the current polygon geometry.
11 | Requires
12 | n (Integer)
13 | Only supports SinglePart geometries
14 | Example
15 | random_points_in_polygon( 25 )
16 |
17 | <geometry: MultiPoint> with 25 points
18 | """
19 | points = list() # Create an empty list for the points
20 |
21 | # Generate feature bounding box limits
22 | min_x = feature.geometry().boundingBox().xMinimum()
23 | max_x = feature.geometry().boundingBox().xMaximum()
24 | min_y = feature.geometry().boundingBox().yMinimum()
25 | max_y = feature.geometry().boundingBox().yMaximum()
26 |
27 | # Until there's the required points in the list, loop (not the best way probably)
28 | while len(points) < number_of_points:
29 | # Create random x and y coordinates inside feature geometry bounding box
30 | rnd_x = random.uniform(min_x, max_x)
31 | rnd_y = random.uniform(min_y, max_y)
32 | # Use the coordinates to create a point
33 | rnd_point = QgsPointXY(rnd_x, rnd_y)
34 |
35 | # Test if the point is inside the feature geometry
36 | if QgsGeometry.fromPointXY(rnd_point).intersects(feature.geometry()):
37 | # If it is inside, add it to the list (increasing the length of the list)
38 | points.append(rnd_point)
39 |
40 | # Return a multipoint geometry
41 | return QgsGeometry.fromMultiPointXY(points)
42 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/expressions/skala.py:
--------------------------------------------------------------------------------
1 | """
2 | Define new functions using @qgsfunction. feature and parent must always be the
3 | last args. Use args=-1 to pass a list of values as arguments
4 | """
5 |
6 | from qgis.core import *
7 | from qgis.gui import *
8 |
9 | @qgsfunction(args='auto', group='Custom')
10 | def skala(kart_id, feature, parent):
11 | layouts = iface.activeComposers()
12 | for layout_vy in layouts:
13 | layout_ruta = layout_vy.composerWindow()
14 | layout_nu = layout_vy.composition()
15 | karta = layout_nu.getComposerMapById(kart_id)
16 | if karta:
17 | skala = int(karta.scale())
18 | return skala
19 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/expressions/userfunctions.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | **************************************************************************
4 | * User define expression functions for QGIS *
5 | * to obtain the map extents *
6 | * *
7 | * ------------------- *
8 | * begin : 2013-09-09 *
9 | * copyright : (C) 2013 by Alexandre Neto *
10 | * email : senhor.neto@gmail.com *
11 | * *
12 | * update for QGIS3 : 2018-01-27 *
13 | * @klaskarlsson *
14 | * *
15 | **************************************************************************
16 |
17 | **************************************************************************
18 | * *
19 | * This program is free software; you can redistribute it and/or modify *
20 | * it under the terms of the GNU General Public License as published by *
21 | * the Free Software Foundation; either version 2 of the License, or *
22 | * (at your option) any later version. *
23 | * *
24 | **************************************************************************
25 | """
26 |
27 | from qgis.utils import qgsfunction, iface
28 | from qgis.core import QgsProject
29 |
30 | def map_bounds(layout_title):
31 | """
32 | Returns map bounds
33 | """
34 | my_layout = QgsProject.instance().layoutManager().layoutByName(layout_title)
35 | try:
36 | extent = my_layout.referenceMap().extent()
37 | except:
38 | extent = None
39 |
40 | return extent
41 |
42 | @qgsfunction(args='auto', group='python')
43 | def map_x_min(layout_title, feature, parent):
44 | """
45 | Returns the minimum x coordinate of the reference map from a specific composer.
46 | Calculations are in the Spatial Reference System of the project.
47 | Syntax
48 | map_x_min(layout_title)
49 | Arguments
50 | layout_title - is string. The title of the composer where the map is.
51 | Example
52 | map_x_min('my pretty map') -> -12345.679
53 | """
54 | map_extent = map_bounds(layout_title)
55 | if map_extent:
56 | result = map_extent.xMinimum()
57 | else:
58 | result = None
59 |
60 | return result
61 |
62 | @qgsfunction(args='auto', group='python')
63 | def map_x_max(layout_title, feature, parent):
64 | """
65 | Returns the maximum x coordinate of the reference map from a specific composer.
66 | Calculations are in the Spatial Reference System of the project.
67 | Syntax
68 | map_x_max(layout_title)
69 | Arguments
70 | layout_title - is string. The title of the composer where the map is.
71 | Example
72 | map_x_max('my pretty map') -> 12345.679
73 | """
74 | map_extent = map_bounds(layout_title)
75 | if map_extent:
76 | result = map_extent.xMaximum()
77 | else:
78 | result = None
79 |
80 | return result
81 |
82 | @qgsfunction(args='auto', group='python')
83 | def map_y_min(layout_title, feature, parent):
84 | """
85 | Returns the minimum y coordinate of the reference map from a specific composer.
86 | Calculations are in the Spatial Reference System of the project.
87 | Syntax
88 | map_y_min(layout_title)
89 | Arguments
90 | layout_title - is string. The title of the composer where the map is.
91 | Example
92 | map_y_min('my pretty map' -> -12345.679
93 | """
94 | map_extent = map_bounds(layout_title)
95 | if map_extent:
96 | result = map_extent.yMinimum()
97 | else:
98 | result = None
99 |
100 | return result
101 |
102 | @qgsfunction(args='auto', group='python')
103 | def map_y_max(layout_title, feature, parent):
104 | """
105 | Returns the maximum y coordinate of the reference map from a specific composer.
106 | Calculations are in the Spatial Reference System of the project.
107 | Syntax
108 | map_y_max(layout_title)
109 | Arguments
110 | layout_title - is string. The title of the composer where the map is.
111 | Example
112 | map_y_max('my pretty map') -> 12345.679
113 | """
114 | map_extent = map_bounds(layout_title)
115 | if map_extent:
116 | result = map_extent.yMaximum()
117 | else:
118 | result = None
119 |
120 | return result
121 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/patch_generator.py:
--------------------------------------------------------------------------------
1 | '''
2 | Made by Klas Karlsson
3 | Uses a polygon layer with suitable patch sized rectangles at representative areas.
4 | The table must have three columns.
5 | 1. id
6 | 2. Label text (any name but [string])
7 | 3. Rotation (if you want to tweak the patch [float] should be default 0.0)
8 |
9 | Before you run the script from the python consol in QGIS:
10 | - Turn the layer visibility off (unless you want to show it in the patches)
11 | - Have the patch layer selected (the script is run on the active layer)
12 | - Save the project somewhere (patches are generated at this location)
13 |
14 | The script generates lines with HTML in the Python consol. Copy this code!
15 |
16 | In the layout, add a HTML frame and paste the code as source.
17 |
18 | Style the apperance with css in the "User Stylesheet" settings:
19 |
20 | ******** Example CSS **********
21 | .patch {
22 | width: 110px;
23 | }
24 | .title {
25 | font-family: Arial;
26 | font-size: 12pt;
27 | text-align: left;
28 | padding: 0px 16px;
29 | }
30 | table {
31 | border-spacing: 0px 4px;
32 | }
33 | body {
34 | margin: 0;
35 | }
36 | *******************************
37 |
38 | You can tweak the HTML code if you want multiple columns. It's not that hard.
39 | '''
40 | import re
41 |
42 | layer = iface.activeLayer()
43 | features = layer.getFeatures()
44 |
45 | patch_width = 300
46 | patches = []
47 | titles = []
48 |
49 | for feature in features:
50 | print(feature[1])
51 | geom = feature.geometry()
52 | image_location = os.path.join(QgsProject.instance().homePath(), re.sub(r'(?u)[^-\w.]', '', feature[1]) + ".png")
53 | patches.append(image_location)
54 | titles.append(feature[1])
55 | layers = iface.mapCanvas().layers()
56 | settings = QgsMapSettings()
57 | settings.setLayers(layers)
58 | patch_height = patch_width * geom.boundingBox().height() / geom.boundingBox().width()
59 | settings.setOutputSize(QSize(patch_width, patch_height))
60 | settings.setRotation(feature[2])
61 | settings.setExtent(geom.boundingBox())
62 |
63 | render = QgsMapRendererParallelJob(settings)
64 |
65 | def finished():
66 | img = render.renderedImage()
67 | img.save(image_location, "png")
68 |
69 | render.finished.connect(finished)
70 | render.start()
71 | render.waitForFinished()
72 |
73 | html_string = '\n'
74 | for (patch, title) in zip(patches, titles):
75 | html_string += '%s
\n' % (patch, title)
76 |
77 | html_string += '
'
78 | print(html_string)
79 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/python/qgis_basemaps.py:
--------------------------------------------------------------------------------
1 | """
2 | This script should be run from the Python console inside QGIS.
3 |
4 | Download the file and OPEN the file in the Python console EDITOR.
5 | It will not work if you copy and paste the code at the commandline.
6 |
7 | It adds online sources to the QGIS Browser.
8 | Each source should contain a list with the folowing items (string type):
9 | [sourcetype, title, authconfig, password, referer, url, username, zmax, zmin]
10 |
11 | You can add or remove sources from the sources section of the code.
12 |
13 | Script by Klas Karlsson
14 | Sources from https://qms.nextgis.com/
15 |
16 | Some services may require you to supply your own API key for the services to work.
17 |
18 | Licence GPL-3
19 |
20 | Regarding the terms of use for these background maps YOU will need to verify that you
21 | follow the individual EULA that comes with the different services,
22 | Most likely they will restrict how you can use the data.
23 | Example:
24 | For Esri basemaps you will need a valid ArcGIS online subscription to use the maps.
25 |
26 | """
27 |
28 |
29 | # Sources
30 | sources = []
31 | sources.append(["connections-xyz","Google Maps","","","","https://mt1.google.com/vt/lyrs=m&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D","","19","0"])
32 | sources.append(["connections-xyz","Google Satellite", "", "", "", "https://mt1.google.com/vt/lyrs=s&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
33 | sources.append(["connections-xyz","Google Terrain", "", "", "", "https://mt1.google.com/vt/lyrs=t&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
34 | sources.append(["connections-xyz","Google Terrain Hybrid", "", "", "", "https://mt1.google.com/vt/lyrs=p&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
35 | sources.append(["connections-xyz","Google Satellite Hybrid", "", "", "", "https://mt1.google.com/vt/lyrs=y&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
36 | sources.append(["connections-xyz","Esri Boundaries Places", "", "", "Requires ArcGIS Onlinesubscription", "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
37 | sources.append(["connections-xyz","Esri Gray (dark)", "", "", "Requires ArcGIS Onlinesubscription", "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "16", "0"])
38 | sources.append(["connections-xyz","Esri Gray (light)", "", "", "Requires ArcGIS Onlinesubscription", "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "16", "0"])
39 | sources.append(["connections-xyz","Esri Hillshade", "", "", "Requires ArcGIS Onlinesubscription", "http://services.arcgisonline.com/ArcGIS/rest/services/Elevation/World_Hillshade/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "12", "0"])
40 | sources.append(["connections-xyz","Esri National Geographic", "", "", "Requires ArcGIS Onlinesubscription", "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "12", "0"])
41 | sources.append(["connections-xyz","Esri Navigation Charts", "", "", "Requires ArcGIS Onlinesubscription", "http://services.arcgisonline.com/ArcGIS/rest/services/Specialty/World_Navigation_Charts/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "12", "0"])
42 | sources.append(["connections-xyz","Esri Ocean", "", "", "Requires ArcGIS Onlinesubscription", "https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "10", "0"])
43 | sources.append(["connections-xyz","Esri Physical Map", "", "", "Requires ArcGIS Onlinesubscription", "https://services.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "10", "0"])
44 | sources.append(["connections-xyz","Esri Satellite", "", "", "Requires ArcGIS Onlinesubscription", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
45 | sources.append(["connections-xyz","Esri Shaded Relief", "", "", "Requires ArcGIS Onlinesubscription", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
46 | sources.append(["connections-xyz","Esri Standard", "", "", "Requires ArcGIS Onlinesubscription", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
47 | sources.append(["connections-xyz","Esri Terrain", "", "", "Requires ArcGIS Onlinesubscription", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "13", "0"])
48 | sources.append(["connections-xyz","Esri Transportation", "", "", "Requires ArcGIS Onlinesubscription", "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
49 | sources.append(["connections-xyz","Esri Topo World", "", "", "Requires ArcGIS Onlinesubscription", "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
50 | sources.append(["connections-xyz","OpenStreetMap Standard", "", "", "OpenStreetMap contributors, under ODbL", "http://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
51 | sources.append(["connections-xyz","OpenStreetMap H.O.T.", "", "", "OpenStreetMap contributors, under ODbL", "http://tile.openstreetmap.fr/hot/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
52 | sources.append(["connections-xyz","OpenTopoMap", "", "", "Kartendaten: © OpenStreetMap-Mitwirkende, SRTM | Kartendarstellung: © OpenTopoMap (CC-BY-SA)", "https://tile.opentopomap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "17", "1"])
53 | sources.append(["connections-xyz","Strava All", "", "", "OpenStreetMap contributors, under ODbL", "https://heatmap-external-b.strava.com/tiles/all/bluered/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "15", "0"])
54 | sources.append(["connections-xyz","Strava Run", "", "", "OpenStreetMap contributors, under ODbL", "https://heatmap-external-b.strava.com/tiles/run/bluered/%7Bz%7D/%7Bx%7D/%7By%7D.png?v=19", "", "15", "0"])
55 | sources.append(["connections-xyz","CartoDb Dark Matter", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/dark_all/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
56 | sources.append(["connections-xyz","CartoDb Dark Matter (No Labels)", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/dark_nolabels/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
57 | sources.append(["connections-xyz","CartoDb Positron", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/light_all/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
58 | sources.append(["connections-xyz","CartoDb Positron (No Labels)", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/light_nolabels/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
59 | sources.append(["connections-xyz","Bing VirtualEarth", "", "", "", "http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1", "", "19", "1"])
60 |
61 |
62 | # Add sources to browser
63 | for source in sources:
64 | connectionType = source[0]
65 | connectionName = source[1]
66 | QSettings().setValue("qgis/%s/%s/authcfg" % (connectionType, connectionName), source[2])
67 | QSettings().setValue("qgis/%s/%s/password" % (connectionType, connectionName), source[3])
68 | QSettings().setValue("qgis/%s/%s/referer" % (connectionType, connectionName), source[4])
69 | QSettings().setValue("qgis/%s/%s/url" % (connectionType, connectionName), source[5])
70 | QSettings().setValue("qgis/%s/%s/username" % (connectionType, connectionName), source[6])
71 | QSettings().setValue("qgis/%s/%s/zmax" % (connectionType, connectionName), source[7])
72 | QSettings().setValue("qgis/%s/%s/zmin" % (connectionType, connectionName), source[8])
73 |
74 | # Update GUI
75 | iface.reloadConnections()
76 |
77 | # Message
78 | print("Check the console for errors and restart QGIS.")
79 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/70s_wallpaper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/Perimeter LineArt1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/bloated.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/bursting.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/cross_stitch.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/edge_bleed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/fantasia.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/interference.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/lava.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/nonstop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/panel.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/random_points_geometry_generator.md:
--------------------------------------------------------------------------------
1 | # Random points in polygon
2 |
3 | This code is used in a QGIS geometry generator for polygons.
4 |
5 | It creates random points inside polygons in a vector layer. The amount of points is somewhat controlled by a variable/number.
6 | In the code it is exemplified by a field name you need to replace with your own values in order to get the code to work.
7 |
8 | ```
9 | geom_from_wkt(
10 | -- start a WKT MULTIPOINT
11 | 'MULTIPOINT (' ||
12 | -- and in here build a coordinate list
13 | array_to_string(
14 | array_remove_all(
15 | array_foreach(
16 | -- n times make a random point
17 | -- then if it is within the geometry return its coordinates
18 | -- otherwise return an empty string
19 |
20 | -- here is the attribute field name for the number of points
21 | generate_series(1, "num_points"), -- unused array just for making a loop
22 | with_variable(
23 | 'rnd_p',
24 | make_point(
25 | randf(x_min($geometry), x_max($geometry)),
26 | randf(y_min($geometry), y_max($geometry))
27 | ),
28 | if(
29 | intersects(@rnd_p, $geometry),
30 | to_string(x(@rnd_p)) || ' ' || to_string(y(@rnd_p)),
31 | ''
32 | )
33 | )
34 | ) -- array_foreach, loop
35 | , '') -- array_remove_all, remove all empty strings
36 | , ',') -- array_to_string, convert all the coordinates into a single string
37 | || ')' -- close the WKT MULTIPOINT
38 | ) -- and make it an actual geometry
39 | ```
40 |
41 | In the code on row six, there's reference to a field name (*"num_points"*).
42 | If you want to have a fixed value for the number of random points in each polygon, just replace this variable with that number.
43 | You could also calculate a value for each feature and replace the field name with the code for that.
44 |
45 | ## Known Issues
46 | Note that the number is the number of attempts that is made to generate random points in the polygon.
47 | If any generated point is outside the polygon, no new attempt will be made to replace it, and it will simply be excluded from the result.
48 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/sky.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/collections/Geosupportsystem/symbol/test.txt:
--------------------------------------------------------------------------------
1 | test
2 |
--------------------------------------------------------------------------------
/collections/krishantering/license.txt:
--------------------------------------------------------------------------------
1 | Okännd licens från statlig myndighet (offentlig handling).
2 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/enhet.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/enhet_forsvarsmakten.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/enhet_polisen.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/enhet_raddningstjansten.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/enhet_sjofartsverket.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
14 |
21 |
23 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/enhet_skogsrojning.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
29 |
30 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fara.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fara_bensinstation.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
10 |
21 |
22 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fara_person_med_vardbehov.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fordon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fordon_brandbil.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
17 |
24 |
25 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fordon_gravmaskin_med_band.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
16 |
23 |
24 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fordon_helikopter.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
19 |
20 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fordon_med_band.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fordon_med_hjul.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fordon_schaktmaskin_med_band.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
16 |
23 |
24 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/fordon_tankbil_med dricksvatten.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
17 |
23 |
24 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/handelse.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/handelse_avbrott_i_dricksvatten.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
10 |
16 |
17 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/handelse_bat_i_sjonod.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
14 |
15 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/handelse_bilolycka.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
17 |
18 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/handelse_nedfallet_trad.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/handelse_stromavbrott.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/handelse_teleavbrott.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
11 |
12 |
15 |
17 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/ovrigt_befolkningspunkt.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs_brandstation.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
13 |
20 |
21 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs_helikopterlandningsplats.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs_mobilt_kraftverk.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
10 |
12 |
13 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs_polisstation.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs_pump.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
15 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
26 |
28 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs_sjukhus.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs_sjukvardsplats.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/resurs_stabsplats.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
16 |
17 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/skyddsv.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/skyddsv_aldreboende.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
22 |
23 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/skyddsv_mobilmast.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
13 |
14 |
16 |
18 |
19 |
21 |
22 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/skyddsv_vardcentral_halsocentral.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/skyddsv_vindkraftverk.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
14 |
16 |
18 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/collections/krishantering/svg/test.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/collections/krishantering/symbol/Färgramp.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/collections/krishantering/symbol/Linjer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/collections/krishantering/symbol/Punktobjekt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/collections/krishantering/symbol/readme.md:
--------------------------------------------------------------------------------
1 | XML stilar kopplade till resurser i denna collection.
2 |
--------------------------------------------------------------------------------
/metadata.ini:
--------------------------------------------------------------------------------
1 | [general]
2 | collections=krishantering,Geosupportsystem
3 |
4 | [krishantering]
5 | name=Krishantering
6 | author=MSB
7 | email=registrator@msb.se
8 | tags=symboler, krisberedskap
9 | description=Denna samling innehaller symboler for krishantering pa framfor allt webbkartor.
10 |
11 | [Geosupportsystem]
12 | name=Geosupportsystem
13 | author=Klas Karlsson
14 | email=klaskarlsson@hotmail.com
15 | tags=modeller
16 | description=Denna samling innehaller resurser som skapats pa http://geosupportsystem.wordpress.com
17 |
18 |
--------------------------------------------------------------------------------
/sky.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------