MarkersSymbolizer doesn't like squiggly lines #1486

Closed
gravitystorm opened this Issue Sep 14, 2012 · 4 comments

Comments

Projects
None yet
4 participants
@gravitystorm

Tested with a513d3f

It's very hard to get MarkersSymbolizer to place markers along footpaths, since it appears that they are too squiggly. In the following example I've taken a footpath from OSM and added a two-vertex vertical bar for clarity. It looks to me like if the gap between vertices is small (perhaps smaller than the spacing?) it won't place any markers on that segment. Depending on the zoom level, apparently straight lines can end up with no markers at all.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
    <Layer name="layer" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
        <StyleName>My Style</StyleName>
        <Datasource>
            <Parameter name="type">csv</Parameter>
            <Parameter name="inline">
name,wkt
one,"LINESTRING(-11910145.81 4703881.8, -11910145.81 4703423.84,-11910160.59 4703432.16,-11910166.19 4703437.59,-11910173.45 4703446.41,-11910177.3 4703450.97,-11910192.16 4703462.59,-11910204.85 4703471.78,-11910212.45 4703479.48,-11910221.64 4703489.36,-11910226.1 4703494.08,-11910237.21 4703504.49,-11910243.24 4703510.09,-11910248.05 4703515.34,-11910252.77 4703519.28,-11910270.35 4703533.17,-11910287.15 4703551.01,-11910297.38 4703561.96,-11910305.77 4703571.92,-11910310.15 4703577.61,-11910316.36 4703584.26,-11910322.14 4703588.67,-11910331.31 4703595.72,-11910344.33 4703608.96,-11910351.24 4703615.98,-11910355.65 4703620.48,-11910366.33 4703631.8,-11910372.95 4703639.49,-11910377.01 4703645.05,-11910379.94 4703647.91,-11910384.5 4703651.34,-11910393.1 4703660.65,-11910398.84 4703665.75,-11910405.07 4703670.16,-11910407.65 4703673.09,-11910410.87 4703677.79,-11910414.38 4703681.34,-11910417.73 4703687.09,-11910420.81 4703692.48,-11910429.84 4703699.54,-11910432.91 4703703.67,-11910437.32 4703710.88,-11910442.36 4703715.78,-11910449.22 4703720.33,-11910451.95 4703722.55,-11910455.8 4703727.74,-11910464.26 4703732.86,-11910471.12 4703737.82,-11910478.04 4703746.84,-11910491.9 4703763.57,-11910498.05 4703770.49,-11910507.08 4703782.24,-11910519.18 4703795.54,-11910521.99 4703802.82,-11910526.6 4703809.54,-11910530.8 4703813.87,-11910535.7 4703823.8,-11910540.95 4703834.86,-11910543.54 4703839.76,-11910548.78 4703853.41,-11910550.39 4703856.97,-11910553.61 4703860.69,-11910555.77 4703869.08,-11910558.86 4703875.87,-11910561.37 4703879.51,-11910566.84 4703882.72,-11910571.38 4703883.63,-11910576.21 4703884.4,-11910580.05 4703884.4,-11910584.18 4703885.38,-11910593.08 4703887.55,-11910599.16 4703891.19,-11910605.39 4703894.13,-11910609.37 4703895.74,-11910612.17 4703896.01,-11910617.49 4703893.15,-11910623.37 4703888.19,-11910634.42 4703883.42,-11910644.28 4703881.75,-11910653.52 4703881.8)"
</Parameter>
        </Datasource>
    </Layer>

    <Style name="My Style">
        <Rule>
            <MarkersSymbolizer file="shape://ellipse" placement="line" spacing="30" />
            <LineSymbolizer stroke-width="0.2" stroke="#ff0000" />
        </Rule>
    </Style>
</Map>

I'd expect markers to appear along the whole length of the path, since there's clearly room for them.

@gravitystorm

This comment has been minimized.

Show comment Hide comment
@gravitystorm

gravitystorm Jul 16, 2013

//Do not place markers too close to the beginning of a segment
is the code that causes this behaviour - it won't place a marker within marker_width_/2 of the start of the segment. If all the segments are shorter than marker_width_, then no markers get place at all.

Perhaps it should be within marker_width_/2 of the start of the entire line, not each segment?

//Do not place markers too close to the beginning of a segment
is the code that causes this behaviour - it won't place a marker within marker_width_/2 of the start of the segment. If all the segments are shorter than marker_width_, then no markers get place at all.

Perhaps it should be within marker_width_/2 of the start of the entire line, not each segment?

@springmeyer

This comment has been minimized.

Show comment Hide comment
@springmeyer

springmeyer Jul 16, 2013

Owner

happy to accept a pull/patch that I can test.

Owner

springmeyer commented Jul 16, 2013

happy to accept a pull/patch that I can test.

@talaj

This comment has been minimized.

Show comment Hide comment
@talaj

talaj Oct 23, 2014

Member

I have also got into this problem. Easy workaround is to use simplify on the symbolizer or ST_Simplify in the query if PostGIS is used. However would be nice to have it done without generating simplified geometry.

I'm going to take a look on it in the following days.

Member

talaj commented Oct 23, 2014

I have also got into this problem. Easy workaround is to use simplify on the symbolizer or ST_Simplify in the query if PostGIS is used. However would be nice to have it done without generating simplified geometry.

I'm going to take a look on it in the following days.

@gravitystorm

This comment has been minimized.

Show comment Hide comment
@gravitystorm

gravitystorm Nov 14, 2014

Thank you @talaj !

Thank you @talaj !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment