1

Mapping in QGIS 3.14, I want to use the same symbol as the local historical USGS 24K quads use for unimproved road and light-duty road.

An example can be seen here (the black continuous road and the black dashed roads):

For an unimproved road, that is an interrupted double line (like a string of equals signs) with no fill: the map background shows through. I haven't found anything close in QGIS.

For a light-duty road, that is a continuous double line (one long, twisty equals sign) with no fill. QGIS has something similar, except that it has white fill, brightly painting over the map behind it.

  1. Am I missing something that is already in QGIS 3.14?

  2. Can I obtain these two effects from pieces that already are in QGIS 3.14?

  3. Is there an appropriate symbol library that I can obtain for free or money?

4
  • 4. you can create a new style made of two lines, either simple lines or dashed lines, one with a small positive offset and the second one with a small negative offset.
    – JGH
    Commented Oct 2, 2020 at 18:54
  • @JGH: Using two offset lines with a dash pattern won't work for curved lines, because the dashes on one side of the road will not be properly aligned with those on the other side.
    – Jake
    Commented Oct 2, 2020 at 20:26
  • @DickRawson: I have added an example image (taken from ngmdb.usgs.gov/topoview/viewer/#15/35.6752/-81.3290). Are those the symbols you're describing?
    – Jake
    Commented Oct 2, 2020 at 20:35
  • 2
    Yes, the example shows the symbols I asked about. Thanks for the image. (I hadn't seen how to include an image. Newbie here.) Commented Oct 2, 2020 at 23:37

1 Answer 1

7

This can be done in QGIS using two custom line styles (see the bottom of this answer for the two style files you can import into QGIS):


While it might seem like the "Light Duty Road" (two parallel black lines) could trivially be implemented using two thin offset lines, you will run into trouble with this approach if you try to display intersections:

A better way of achieving this is to use a thick black line on the first symbol layer and a slightly thinner gray line on the second symbol layer:

By activating the "Hard Light" layer blending mode, the gray interior becomes transparent, while the black outline remains visible:


Similarly, for the "Unimproved Road", you might try to use two offset dashed lines. However, this won't look very nice because the dashes on either side of the road will not stay in sync for curvy roads:

Instead, you can again use a thick black foundation, this time using a dash pattern, overlaid by a gray line:

Activating the "Hard Light" layer blending mode and symbol levels gives you this:


Style file

Save the following as USGS_road_styles.xml, import into QGIS using "Settings | Style Manager", then apply to your road categories as needed. The layer needs to use the "Hard Light" layer rendering mode.

<!DOCTYPE qgis_style>
<qgis_style version="2">
  <symbols>
    <symbol type="line" alpha="1" clip_to_extent="1" force_rhr="0" name="USGS Light Duty Road">
      <layer pass="0" enabled="1" locked="0" class="SimpleLine">
        <prop k="capstyle" v="flat"/>
        <prop k="customdash" v="1.27;0.5"/>
        <prop k="customdash_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <prop k="customdash_unit" v="MM"/>
        <prop k="draw_inside_polygon" v="0"/>
        <prop k="joinstyle" v="bevel"/>
        <prop k="line_color" v="0,0,0,255"/>
        <prop k="line_style" v="solid"/>
        <prop k="line_width" v="0.58"/>
        <prop k="line_width_unit" v="MM"/>
        <prop k="offset" v="0"/>
        <prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <prop k="offset_unit" v="MM"/>
        <prop k="ring_filter" v="0"/>
        <prop k="use_custom_dash" v="0"/>
        <prop k="width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <data_defined_properties>
          <Option type="Map">
            <Option value="" type="QString" name="name"/>
            <Option name="properties"/>
            <Option value="collection" type="QString" name="type"/>
          </Option>
        </data_defined_properties>
      </layer>
      <layer pass="1" enabled="1" locked="0" class="SimpleLine">
        <prop k="capstyle" v="square"/>
        <prop k="customdash" v="5;2"/>
        <prop k="customdash_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <prop k="customdash_unit" v="MM"/>
        <prop k="draw_inside_polygon" v="0"/>
        <prop k="joinstyle" v="bevel"/>
        <prop k="line_color" v="0,0,0,255"/>
        <prop k="line_style" v="solid"/>
        <prop k="line_width" v="0.43"/>
        <prop k="line_width_unit" v="MM"/>
        <prop k="offset" v="0"/>
        <prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <prop k="offset_unit" v="MM"/>
        <prop k="ring_filter" v="0"/>
        <prop k="use_custom_dash" v="0"/>
        <prop k="width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <data_defined_properties>
          <Option type="Map">
            <Option value="" type="QString" name="name"/>
            <Option type="Map" name="properties">
              <Option type="Map" name="outlineColor">
                <Option value="true" type="bool" name="active"/>
                <Option value="'gray'" type="QString" name="expression"/>
                <Option value="3" type="int" name="type"/>
              </Option>
            </Option>
            <Option value="collection" type="QString" name="type"/>
          </Option>
        </data_defined_properties>
      </layer>
    </symbol>
    <symbol type="line" alpha="1" clip_to_extent="1" force_rhr="0" name="USGS Unimproved Road">
      <layer pass="0" enabled="1" locked="0" class="SimpleLine">
        <prop k="capstyle" v="flat"/>
        <prop k="customdash" v="1.27;0.5"/>
        <prop k="customdash_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <prop k="customdash_unit" v="MM"/>
        <prop k="draw_inside_polygon" v="0"/>
        <prop k="joinstyle" v="bevel"/>
        <prop k="line_color" v="0,0,0,255"/>
        <prop k="line_style" v="solid"/>
        <prop k="line_width" v="0.58"/>
        <prop k="line_width_unit" v="MM"/>
        <prop k="offset" v="0"/>
        <prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <prop k="offset_unit" v="MM"/>
        <prop k="ring_filter" v="0"/>
        <prop k="use_custom_dash" v="1"/>
        <prop k="width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <data_defined_properties>
          <Option type="Map">
            <Option value="" type="QString" name="name"/>
            <Option name="properties"/>
            <Option value="collection" type="QString" name="type"/>
          </Option>
        </data_defined_properties>
      </layer>
      <layer pass="0" enabled="1" locked="0" class="SimpleLine">
        <prop k="capstyle" v="round"/>
        <prop k="customdash" v="5;2"/>
        <prop k="customdash_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <prop k="customdash_unit" v="MM"/>
        <prop k="draw_inside_polygon" v="0"/>
        <prop k="joinstyle" v="bevel"/>
        <prop k="line_color" v="0,0,0,255"/>
        <prop k="line_style" v="solid"/>
        <prop k="line_width" v="0.43"/>
        <prop k="line_width_unit" v="MM"/>
        <prop k="offset" v="0"/>
        <prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <prop k="offset_unit" v="MM"/>
        <prop k="ring_filter" v="0"/>
        <prop k="use_custom_dash" v="0"/>
        <prop k="width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
        <data_defined_properties>
          <Option type="Map">
            <Option value="" type="QString" name="name"/>
            <Option type="Map" name="properties">
              <Option type="Map" name="outlineColor">
                <Option value="true" type="bool" name="active"/>
                <Option value="'gray'" type="QString" name="expression"/>
                <Option value="3" type="int" name="type"/>
              </Option>
            </Option>
            <Option value="collection" type="QString" name="type"/>
          </Option>
        </data_defined_properties>
      </layer>
    </symbol>
  </symbols>
  <colorramps/>
  <textformats/>
  <labelsettings/>
  <legendpatchshapes/>
</qgis_style>

With that code, I got these good results. Thanks a lot! East of Henry Coe State Park Road's end at Coe, decades ago.

7
  • Thanks, @Jake. Your illustrations looked great. Trying to load it into Style Manager. More in a moment. Commented Oct 3, 2020 at 17:25
  • success! I'll post a screenshot here if you'll coach me how. I found "You can also press CTRL+G to insert an image." That had no effect here(Windows 10).Rather, it opened a dialog box in Chrome. Dick Commented Oct 3, 2020 at 17:48
  • @dickrawson: You can't post images in comments. When you edit your question, there are a number of buttons above the text area, and one of them opens a dialog that lets you choose an image to insert
    – Jake
    Commented Oct 3, 2020 at 18:05
  • @dickrawson I'm glad it worked, the results really do look nice. You can upvote my answer by clicking the triangle and accept it by clicking the tick mark. That will mark the question as answered.
    – Jake
    Commented Oct 4, 2020 at 7:55
  • Upvoted. @Jake, did you code this directly in xml, or is your file the output of a design tool? Commented Oct 4, 2020 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.