Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering order problem of features with more styles #5340

Open
MaklariAgoston opened this issue Oct 20, 2016 · 6 comments
Open

Rendering order problem of features with more styles #5340

MaklariAgoston opened this issue Oct 20, 2016 · 6 comments
Assignees

Comments

@MaklariAgoston
Copy link

On the map we can see:
Street: white inside, black outside
Road: orange inside, black outside
Railway: black and wide and has a black decorating sign

In the shape file the order of these features are:

  1. Street
  2. Road
  3. Railway (it should be over the others)

(This can be easely checked by the selected features' feature ids in the second picture)
The three feature are in the same layer.

The decorator sign comes from a TRUETYPE font file.

In the first picture we can see that the Railway's decorating sign rendered properly but the
line itself not. It should cover the two other kinds of roads.

renderingorder1
renderingorder2

The definition of the Railway's class is:
CLASS
NAME "Egyvágányú normál vasút (100463)"
EXPRESSION "100463"
MAXSCALEDENOM 300000
STYLE
COLOR 0 0 0
INITIALGAP 0
LINEJOIN ROUND
MAXWIDTH 800
WIDTH 25
END # STYLE
STYLE
COLOR 0 0 0
GAP -1250
INITIALGAP 0
MAXSIZE 3200
SIZE 372
SYMBOL "105"
END # STYLE
END # CLASS

At last in the third picture we can see if I change the order of the styles of the Railway's class
than the last style will be the only one which is rendered correctly.

renderingorder3

This phenomenon surely connected to the fact that only the last style is highlighted of selected feature
see Issue #5333 "Only the last style is highlighted of a selected feature"
https://github.com/mapserver/mapserver/issues/5333

@tbonfort
Copy link
Member

Given the rendering, I'm pretty sure the railways are rendered before the streets, and are thus not ordered in the shapefile as you think they are.

@MaklariAgoston
Copy link
Author

MaklariAgoston commented Oct 21, 2016

Before this phenomenon occured I had ordered the features in the shape file and after that I have checked it in the dbf file.

Now I have changed the colors in my example to make the understanding of the problem easier.

Order in the shape file | Name | Real order of the rendering | Color|Order in the map file
3rd | Railway | 1st style | black|3rd
1st | Street | 1st style | blue|1st
2nd | Road | 1st style | green|2nd

3rd | Railway | 2st style | black|3rd
1st | Street | 2st style | white|1st
2nd | Road | 2st style | orange|2nd
renderingorder4

So it can be clearly see that the logic of rendering is connected wrongfully to the order of the styles and not to the order of the features in the shape file.

The rendering follows the order of the classes in the map file as well.

@tbonfort
Copy link
Member

The rendering pseudo-code is:

for s in styles:
   for f in features: #in order returned by the datasource
      render(f,s)

Thus I still believe that your assumption about the ordering of features in your shapefile is incorrect (maybe your qix index is outdated?). For me it is ordered as railway, street, road

The rendering algorithm is going to have issues with railway ties alongside street casings:

  • for road casings you want the current behavior, so that the casing blends in correctly from one feature to another
  • for railroads you want the ties and the line to be rendered in the same pass. This is not currently supported but would be something I'd be very willing to add should you want to fund it.

@szekerest szekerest self-assigned this Nov 4, 2016
@szekerest
Copy link
Member

@tbonfort According to my investigations this issue is due to the build in shape cache functionality which causes that only the first style is rendered for each feature, then the remaining styles from the shape cache. Would that be an option to suppress the cache by a processing key for example?

szekerest added a commit to szekerest/mapserver that referenced this issue Dec 14, 2016
@tbonfort
Copy link
Member

+1 on bb0fcbc . But I doubt that you'll achieve the desired output with that patch (you'll have artifacts on road casings)

@szekerest
Copy link
Member

This is a problem indeed, it might be better to separate the street/road/railways into separate layers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants