Skip to content

Backward compatibility issue: marker-placement:line omits marker for points #1548

Closed
strk opened this Issue Oct 29, 2012 · 12 comments

2 participants

@strk
strk commented Oct 29, 2012

As of 2.0.x, specifying marker-placement:line for point input would still place markers over points. With 2.1 the marker is not placed anymore.

Here's an example XML file to see the problem:

<Map srs="+init=epsg:3857" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">

<Style name="carto_tests" filter-mode="first" >

  <Rule>

    <!-- this works both in 2.0 and 2.1 -->
    <!-- MarkersSymbolizer placement="point" / -->

    <!-- this only works in 2.0 -->
    <MarkersSymbolizer placement="line" />

  </Rule>

</Style>
<Layer name="carto_tests" srs="+init=epsg:3857">
    <StyleName>carto_tests</StyleName>
    <Datasource>
       <Parameter name="type"><![CDATA[postgis]]></Parameter>
       <Parameter name="geometry_field"><![CDATA[the_geom]]></Parameter>
       <Parameter name="srid"><![CDATA[3857]]></Parameter>
       <Parameter name="table"><![CDATA[(SELECT 'POINT(0 0)'::geometry as the_geom) as cdbq]]></Parameter>
       <Parameter name="dbname"><![CDATA[template_postgis]]></Parameter>
    </Datasource>
  </Layer>

</Map>

@springmeyer
Mapnik member

thanks for the report. I'll take a look. I think I recall some hacky custom handling for this in older mapnik. It may be that with that removed the markers placement algorithms simply return early on points, since using line placement on points is not a common case.

@strk
strk commented Oct 31, 2012

where can I find that algorithm?

@springmeyer
Mapnik member

I presume that right here no points are being returned which means that this is returning without placing - which is not at all a surprise because this code is designed for placing multiple markers along a linear geometry and is not designed to handle point geometries.

@strk
strk commented Oct 31, 2012

I guess we should make it so that "placement" is a POINT placement, rather than pretending a POINT is a line and handling it as such, right ?

@springmeyer
Mapnik member

I'm not sure about the right solution - I'd need more time than I have this week to dig into it. What I do know is that in Mapnik we are moving towards enabling more types of geometry transformations and therefore in fewer cases can the code actually ask for the geometry type (and if it could, it would only be the original geometry type). So, while it may not be the specific issue here, I can see geometries that are originally lines perhaps ending up as points (with transformations). Whether these should be thrown out, or algorithms like the markers_placement should be made to handle points, needs a closer look.

@strk
strk commented Oct 31, 2012
@strk
strk commented Nov 1, 2012

Another thing I found is that in 2.0 you would get an ellipse rather than an arrow when the input is a point, even if you specify marker-type:arrow

@strk
strk commented Nov 1, 2012

I would like to try basing the conditional on the original geometry type.
Will try it against a small testsuite we setup (~200 style runs comparing 2.0 and 2.1) and let you know.

@strk
strk commented Nov 1, 2012

oh, one question: how do I test if the problem also persists with cairo renderer ?

@strk
strk commented Nov 1, 2012

Here's a quick & dirty patch for AGG only, using original type and badly copying the marker_placement object for the sake of changing within the AGG code. It looks promising against the tests we have (but is dirty):
http://strk.keybit.net/tmp/support_line_placement_for_points.patch

@strk
strk commented Nov 1, 2012

I run the testsuite but got no failure:
Ran 475 tests in 5.494s

It means there are no tests for this case. Kind of good as there's less work of adapting the expectances, no ? :)

@springmeyer springmeyer added a commit that closed this issue Dec 3, 2012
@springmeyer springmeyer close #1548 with explict handling of point geometries and amend 629d768
… for cairo/grid renderers to ensure proper placement on lines (refs #1604,#1350,#1607)
7d408d5
@strk
strk commented Dec 3, 2012

Any chance to see this backported to 2.1.x ?

@strk strk added a commit to strk/mapnik that referenced this issue Dec 10, 2012
@springmeyer springmeyer Fix line placement of markers on points (#1548) 664e05b
@PetrDlouhy PetrDlouhy added a commit to PetrDlouhy/mapnik that referenced this issue Aug 22, 2013
@springmeyer springmeyer close #1548 with explict handling of point geometries and amend 629d768
… for cairo/grid renderers to ensure proper placement on lines (refs #1604,#1350,#1607)
62818d8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.