Důležité

Translation is a community effort you can join. This page is currently translated at 37.02%.

2.4. Lesson: symbolika

Symbolika vrstvy je její zobrazení na mapě. Základní síla GIS ve srovnání s jinými způsoby, jak zobrazovat data pomocí prostorových aspektů je to, že s GIS máte dynamické vizuální znázornění dat, se kterým pracujete.

Proto, je vizuální vzhled mapy (která závisí na symbolice jednotlivých vrstev), velmi důležitý. Koncový uživatel map by měl být schopen snadno poznat, co mapa znázorňuje. Stejně tak je důležité, mít možnost zkoumat data, se kterými pracujete a dobrá symbolika vám v tom hodně pomůže.

Jinými slovy, mít vhodnou symboliku nemáte pouze pro luxus nebo kvůli kráse. Ve skutečnosti je to nezbytné, pro správné používání GISu a vytváření map a informací, které budou lidé moci používat.

Cíl této lekce: Být schopen vytvořit libovolnou symboliku, kterou chcete pro jakoukoli vektorovou vrstvu.

2.4.1. basic Follow Along: změna barev

To change a layer’s symbology, open its Layer Properties. Let’s begin by changing the color of the landuse layer.

  1. Right-click on the landuse layer in the layers list.

  2. Select the menu item Properties… in the menu that appears.

    Poznámka

    Ve výchozím nastavení můžete také jít do vlastností vrstvy dvojitým kliknutím na vrstvu v seznamu vrstev.

    Tip

    The symbology button at the top of the Layers panel will open the Layer Styling panel. You can use this panel to change some properties of the layer: by default, changes will be applied immediately!

  3. In the Layer Properties window, select the symbology Symbology tab:

    ../../../_images/layer_properties_style.png
  4. Click the color select button next to the Color label. A standard color dialog will appear.

  5. Vyberte šedou barvu a klikněte na OK.

  6. Kliknutěte znovu na OK v okně Layer Properties a uvidíte, že se změna barvy aplikuje na vrstvu.

2.4.2. basic Try Yourself

Change the color of the water layer to light blue. Try to use the Layer Styling panel instead of the Layer Properties menu.

2.4.3. basic Follow Along: změna struktury symboliky

To je velmi dobrá věc, ale v symbolice vrstvy je více než jen barva. Dále chceme vyloučit hranice mezi různými oblastmi využití půdy tak, aby mapa byla co nejméně vizuálně zaplněna.

  1. Open the Layer Properties window for the landuse layer.

    Under the symbology Symbology tab, you will see the same kind of dialog as before. This time, however, you’re doing more than just quickly changing the color.

  2. In the symbol layers tree, expand the Fill dropdown and select the Simple fill option.

  3. Click on the Stroke style dropdown. At the moment, it should be showing a short line and the words Solid Line.

  4. Změňte je na No Pen.

    ../../../_images/simple_fill_selected.png
  5. Klikněte na OK.

Now the landuse layer won’t have any lines between areas.

2.4.4. basic Try Yourself

  • Change the water layer’s symbology again so that it has a darker blue outline.

  • Change the rivers layer’s symbology to a sensible representation of waterways.

Remember: you can use the symbology Open the Layer Styling panel button and see all the changes instantly. That panel also allows you to undo individual changes while symbolizing a layer.

2.4.5. moderate Follow Along: viditelnost závislá na měřítku

Někdy zjistíte, že vrstva není vhodná pro dané měřítko. Například soubor dat ze všech kontinentů může mít nízký detail, a nemusí být velmi přesný na úrovni ulic. Když se to stane, budete chtít mít možnost, datovou sadu v nevhodných měřítkách, skrýt.

In our case, we may decide to hide the buildings from view at small scales. This map, for example…

../../../_images/buildings_small_scale.png

… není velmi užitečná. Budovy jsou v tomto měřítku těžko rozlišitelné.

Chcete-li povolit vykreslování založené na měřítku:

  1. Open the Layer Properties dialog for the buildings layer.

  2. Activate the rendering Rendering tab.

  3. Enable scale-based rendering by clicking on the checkbox labeled Scale dependent visibility:

  4. Change the Minimum value to 1:10000.

    ../../../_images/scale_dependent_visibility.png
  5. Klikněte na OK.

Test the effects of this by zooming in and out in your map, noting when the buildings layer disappears and reappears.

Poznámka

Můžete použít kolečko myši pro zvýšení přiblížení. Můžete použít alternativní nástroje, pro přibližování v okně:

zoomIn zoomOut

2.4.6. moderate Follow Along: přidávání vrstev symboliky

Nyní, když víte, jak změnit jednoduchou symboliku vrstev, dalším krokem je vytvoření složitější symboliky. QGIS toto umožňuje provést pomocí vrstev symbolů.

  1. Go back to the landuse layer’s symbol properties panel (by clicking Simple fill in the symbol layers tree).

    V tomto příkladu nemá aktuální symbol žádný obrys (to znamená, že používá styk ohraničení No Pen).

    ../../../_images/simple_fill_selected.png
  2. Select the Fill level in the tree and click the symbologyAdd Add symbol layer button. The dialog will change to look something like this, with a new symbol layer added:

    ../../../_images/new_symbol_layer.png

    It may appear somewhat different in color, for example, but you’re going to change that anyway.

Teď je tu druhá vrstva symbolů. Kdyby byla jednobarevná, tak by samozřejmě úplně zakrývala předchozí druh symbolu. Navíc, má styl hranice Solid Line, což nechceme. Je zřejmé, že tento symbol musí být změněn.

Poznámka

Je důležité, nesplést si mapovou vrstvu a vrstvu symbolů. Mapová vrstva je vektor (nebo rastr), který byl načten do mapy. Vrstva symbolů je součástí symbolu, použitého pro zobrazení mapové vrstvy. Tento postup obvykle označuje mapovou vrstvu jen jako vrstvu, ale vrstva symbolů bude vždy nazývána jako vrstva symbolů, aby nedošlo k nedorozumění.

With the new Simple Fill symbol layer selected:

  1. Nastavte styl ohraničení No Pen tak, jako předtím.

  2. Změňte styl výplně na něco jiného než Solid nebo No brush. Například:

    ../../../_images/new_fill_settings.png
  3. Klikněte na OK.

Now you can see your results and tweak them as needed. You can even add multiple extra symbol layers and create a kind of texture for your layer that way.

../../../_images/multiple_symbol_layers.png

Je to zábava! Ale má to pravděpodobně příliš mnoho barev pro použití v reálném mapě…

2.4.7. moderate Try Yourself

Remembering to zoom in if necessary, create a simple, but not distracting texture for the buildings layer using the methods above.

2.4.8. moderate Follow Along: uspořádání úrovní symbolů

Jsou-li vrstvy symbolů poskytované, jsou také poskytované v pořadí, podobným způsobem, jakým jsou poskytované různé mapové vrstvy. To znamená, že v některých případech, pokud máme mnoho vrstev symbolů v jednom symbolu, může to vést k neočekávaným výsledkům.

  1. Give the roads layer an extra symbol layer (using the method for adding symbol layers demonstrated above).

  2. Give the base line a Stroke width of 1.5 and a black color.

  3. Give the new, uppermost layer a thickness of 0.8 and a white color.

Všimněte si, že se stane toto:

../../../_images/bad_roads_symbology.png

Well, roads have now a street like symbology, but you see that lines are overlapping each others at each cross. That’s not what we want at all!

Chcete-li zabránit, aby se toto stalo, můžete setřídit úrovně symbolů a tím řídit pořadí, ve kterém jsou různé vrstvy symbolů poskytované.

To change the order of the symbol layers:

  1. Select the topmost Line layer in the symbol layers tree.

  2. Click Advanced ► Symbol levels… in the bottom right-hand corner of the window.

    ../../../_images/symbol_levels_main_dialog.png

    This will open a dialog like this:

    ../../../_images/symbol_levels_dialog.png
  3. Check checkbox Enable symbol levels. You can then set the layer order of each symbol by entering the corresponding level number. 0 is the bottom layer.

    In our case, we just want to activate the option, like this:

    ../../../_images/correct_symbol_layers.png

    This will render the white line above the thick black line borders:

  4. Klikněte dvakrát na OK pro návrat do mapy.

    Mapa nyní bude vypadat takto:

    ../../../_images/better_roads_symbology.png

When you’re done, remember to save the symbol itself so as not to lose your work if you change the symbol again in the future. You can save your current symbol style by clicking the Save Style… button at the bottom of the Layer Properties dialog. We will be using the QGIS QML Style File format.

Save your style in the solution/styles/better_roads.qml folder. You can load a previously saved style at any time by clicking the Load Style… button. Before you change a style, keep in mind that any unsaved style you are replacing will be lost.

2.4.9. moderate Try Yourself

Change the appearance of the roads layer again.

Make the roads narrow and yellow, with a thin, pale gray outline and a thin black line in the middle. Remember that you may need to change the layer rendering order via the Advanced ► Symbol levels… dialog.

../../../_images/target_road_symbology.png

2.4.10. hard Try Yourself

Symbol levels also work for classified layers (i.e., layers having multiple symbols). Since we haven’t covered classification yet, you will work with some rudimentary pre-classified data.

  1. Create a new project and add only the roads dataset.

  2. Apply the style file advanced_levels_demo.qml provided in exercise_data/styles to the layer. This can be done through the Style ► Load Style… combobox at the bottom of the Layer Properties dialog.

  3. Přibližte na oblast Swellendam.

  4. Použitím vrstev symbolů zajistěte, aby do sebe obrysy vrstev zapadly, jako na obrázku níže:

    ../../../_images/correct_advanced_levels.png

2.4.11. moderate Follow Along: typy vrstev symbolů

In addition to setting fill colors and using predefined patterns, you can use different symbol layer types entirely. The only type we’ve been using up to now was the Simple Fill type. The more advanced symbol layer types allow you to customize your symbols even further.

Každý druh vektoru (bod, linie a polygon) má svoji vlastní sadu typů vrstvy symbolů. Nejprve se podíváme na typy, které jsou k dispozici pro body.

Typy vrstev symbolů pro body

  1. Uncheck all the layers except for places.

  2. Change the symbol properties for the places layer:

    ../../../_images/places_layer_properties.png
  3. You can access the various symbol layer types by selecting the Simple marker layer in the symbol layers tree, then click the Symbol layer type dropdown:

    ../../../_images/marker_type_dropdown.png
  4. Prozkoumejte různé možnosti, které máte k dispozici a zvolte si symbol se stylem, jaký je podle vás vhodný.

  5. If in doubt, use a round Simple marker with a white border and pale green fill, with a Size of 3.00 and a Stroke width of 0.5.

Typy vrstev symbolů pro linie

Chcete-li zobrazit různé možnosti, které jsou k dispozici pro liniová data:

  1. Change the Symbol layer type for the roads layer’s topmost symbol layer to Marker line:

    ../../../_images/change_to_marker_line.png
  2. Select the Simple marker layer in the symbol layers tree. Change the symbol properties to match this dialog:

    ../../../_images/simple_marker_line_properties.png
  3. Select the Marker line layer and change the interval to 1.00:

    ../../../_images/marker_line_interval.png
  4. Ujistěte se, že úrovně symbolů jsou správné (přes dialog Advanced ► Symbol levels, který jsme použili dříve) před použitím stylu.

Poté, co styl použijete, podívejte se na jeho výsledky na mapě. Jak můžete vidět, tyto symboly mění směr spolu se silnicí, ale ne vždy se spolu s ní zakřivují. To je pro některé účely užitečné, ale pro ostatní zase ne. Pokud chcete, můžete změnit vrstvu symbolů v předchozí dotazu tak, jak vypadala předtím.

Typy vrstev symbolů pro polygony

Chcete-li zobrazit různé možnosti, které jsou k dispozici pro polygonová data:

  1. Change the Symbol layer type for the water layer, as before for the other layers.

  2. Zjistěte, jaké jsou různé možnosti na seznamu, které můžete dělat.

  3. Vyberte si jednu z nich, která vám nejvíce vyhovuje.

  4. V případě pochybností, použijte Point pattern fill s následujícími možnostmi:

    ../../../_images/pattern_fill_size.png
    ../../../_images/pattern_fill_distances.png
  5. Přidejte novou vrstvu symbolů Simple fill.

  6. Vytvořte tu samou, ale ve světle modré barvě s tmavě modrým obrysem.

  7. Přesuňte ji pod vrstvu symbolů pro bodový vzor tlačítkem Move down:

    ../../../_images/simple_fill_move_down.png

Výsledkem je strukturovaný symbol pro vrstvu vodstva, s přidanou výhodou, že můžete měnit velikost, tvar a vzdálenost jednotlivých bodů, které tvoří strukturu.

2.4.13. hard Follow Along: Geometry generator symbology

You can use the Geometry generator symbology with all layer types (points, lines and polygons). The resulting symbol depends directly on the layer type.

Very briefly, the Geometry generator symbology allows you to run some spatial operations within the symbology itself. For example you can run a real centroid spatial operation on a polygon layer without creating a point layer.

Moreover, you have all the styling options to change the appearance of the resulting symbol.

Let’s give it a try!

  1. Select the water layer.

  2. Click on Simple fill and change the Symbol layer type to Geometry generator.

    ../../../_images/geometry_generator.png
  3. Before to start writing the spatial query we have to choose the Geometry Type in output. In this example we are going to create centroids for each feature, so change the Geometry Type to Point / Multipoint.

  4. Now let’s write the query in the query panel:

    centroid($geometry)
    
    ../../../_images/geometry_generator_query.png
  5. When you click on OK you will see that the water layer is rendered as a point layer! We have just run a spatial operation within the layer symbology itself, isn’t that amazing?

    ../../../_images/geometry_generator_result.png

With the Geometry generator symbology you can really go over the edge of normal symbology.

hard Try Yourself

Geometry generator are just another symbol level. Try to add another Simple fill underneath the Geometry generator one.

Change also the appearance of the Simple marker of the Geometry generator symbology.

The final result should look like this:

../../../_images/geometry_generator_preview.png

2.4.14. hard Follow Along: tvorba vlastního SVG Fill

Poznámka

Chcete-li dělat toto cvičení, budete potřebovat mít nainstalovaný bezplatný software pro úpravu vektoru Inkscape Inkscape .

  1. Start the Inkscape program. You will see the following interface:

    ../../../_images/inkscape_default.png

    Mělo by vám být povědomé, pokud jste někdy použili jiné programy na úpravu vektorových obrázků, jako je Corel.

    Za prvé, změníme obraz na velikost vhodnou pro malou texturu.

  2. Klikněte na položku menu File ► Document Properties. Dostanete dialog Document Properties.

  3. Změňte Units na px.

  4. Change the Width and Height to 100.

  5. Zavřete dialogové okno, až budete hotovi.

  6. Klikněte na položku menu View ► Zoom ► Page pro náhled stránky, se kterou pracujete.

  7. Vyberte nástroj Circle:

    ../../../_images/inkscape_circle_tool.png
  8. Kliknutím a tažením nakreslete elipsu. Chcete-li elipsu změnit v kruh, podržte při kreslení tlačítko Ctrl .

  9. Klepněte pravým tlačítkem myši na kruh, který jste právě vytvořili, a otevřete Fill and Stroke možnosti. Můžete modifikovat jeho renderování, jako například:

    1. Změňte Fill barvu na přibližně šedo-modrou,

    2. Přiřaďte okrajům tmavší barvu v Stroke paint záložce,

    3. A snižte šířku okraje pod Stroke style záložkou.

    ../../../_images/inkscape_stroke_fill.png
  10. Nakreslete linii s použitím nástroje Pencil:

    1. Click once to start the line. Hold Ctrl to make it snap to increments of 15 degrees.

    2. Posuňte ukazatel horizontálně a jednoduchým kliknutím vložte bod.

    3. Klikněte a sejměte vrchol linie a sledujte svislou linii, ukončete jednoduchým kliknutím.

    4. Nyní spojte tyto dva koncové vrcholy.

    5. Změňte barvu a šířku trojúhelníkového symbolu, aby odpovídala hranici kruhu a posuňte ji, jak to bude nutné tak, že nakonec dostanete symbol, jako je tento:

    ../../../_images/inkscape_final_symbol.png
  11. If the symbol you get satisfies you, then save it as landuse_symbol under the directory that the course is in, under exercise_data/symbols, as SVG file.

V QGISu:

  1. Open the Layer Properties for the landuse layer.

  2. In the symbology Symbology tab, change the symbol structure by changing the Symbol Layer Type to SVG Fill shown below.

  3. Click the button and then Select File… to select your SVG image.

    It’s added to the symbol tree and you can now customize its different characteristics (colors, angle, effects, units…).

    ../../../_images/svg_symbol_settings.png

Once you validate the dialog, features in landuse layer should now be covered by a set of symbols, showing a texture like the one on the following map. If textures are not visible, you may need to zoom in the map canvas or set in the layer properties a bigger Texture width.

../../../_images/svg_symbol_result.png

2.4.15. In Conclusion

Změna symboliky pro různé vrstvy přeměnila sbírku vektorových souborů na čitelnou mapu. Nejen, že můžete vidět, co se děje, ale ještě krásnější je to vidět!

2.4.16. Further Reading

Examples of Beautiful Maps

2.4.17. What’s Next?

Změna symbolů pro celé vrstvy je užitečná, ale informace obsažené v každé vrstvě ještě nejsou k dispozici pro toho, kdo z daných map čte. Jaké názvy mají ulice? Které regiony patří do určitých oblastí? Jaké jsou povrchové plochy vztahující se ke statkům? Všechny tyto informace jsou stále skryté. V další lekci vysvětlíme, jak zobrazovat tato data na mapě.

Poznámka

Nezapomněli jste si v poslední době uložit vaši mapu??