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

SLD: Improve WMS GetStyles request #5832

Merged
merged 6 commits into from Apr 1, 2020
Merged

Conversation

jbo-ads
Copy link
Member

@jbo-ads jbo-ads commented Jul 1, 2019

This pull request aims at improving WMS GetStyles request, especially when a SLD or SLD_BODY parameter is present. It implements the second section of MS RFC 124: Improving SLD Support in MapServer.

@sdlime
Copy link
Member

sdlime commented Aug 7, 2019

I don't have any objections here. This is really limited to WMS/SLD and doesn't result in anything that we might want to expose more broadly (unlike the other 2 pull requests). Could anything sensitive be divulged through the XML generation? I can't think of anything beyond attribute bindings or expressions already defined in the mapfile. I mean, what if style SIZE is already referencing an expression (based on the other pull request).

mapogcsld.c Outdated
psLabelText = NULL;
if (psLabelObj->text.string)
{
psLabelText = msStrdup(psLabelObj->text.string);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if psLabelObj->text.string doesn't start with [ and ends with ] ? Should the type of the expression be checked ?

Copy link
Member Author

@jbo-ads jbo-ads Aug 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. In my attempt to upgrade this part of code to MapServer version 6.2, I missed the whole picture and handled only few simple use cases. I'll rework on this as soon as I can. Changes may involve an evaluation of the expression. Up to you to decide whether the merge needs these upcoming changes or if it can be performed as is and changes be applied in another pull request.

mapogcsld.c Outdated
}
else if (psClass->text.string)
{
psLabelText = msStrdup(psClass->text.string);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

mapogcsld.c Outdated
}
if (!psLabelText) continue; // Can't find text content for this <Label>

psLabelText = msReplaceSubstring(psLabelText, "\"", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this replacement for ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

mapogcsld.c Outdated
}
else if (psLayer->labelitem)
{
psLabelText = msStrdup(psLayer->labelitem);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't that be XML escaped ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@jmckenna
Copy link
Member

@jbo-ads what is the status of this change? It seems you mentioned that you will 'rework' this.

@jbo-ads
Copy link
Member Author

jbo-ads commented Feb 18, 2020

Actually I am currently on it. I already solved merge conflicts on my local repo. Moreover, comments from @rouault are trickier than they look like... I need to update mapparser.y in order to properly convert from Mapfile to SLD expressions.

@jmckenna
Copy link
Member

@jbo-ads ok thanks for the update. Do you want me to wait for your changes, before beginning the 7.6.0 release process?

@jmckenna
Copy link
Member

meaning: ok I will wait for your changes, before proceeding (unless you advise otherwise here).

@jbo-ads
Copy link
Member Author

jbo-ads commented Feb 18, 2020

Thank you, but I can wait for mid-year's 8.0 release for my changes to be integrated. I think that many people are waiting for a 7.6.

@jbo-ads
Copy link
Member Author

jbo-ads commented Feb 20, 2020

@rouault : I updated the code to handle labels of both types MS_STRING and MS_EXPRESSION. I didn't include handling of Mapfile functions though. I don't know what to do with them:

  • Should a SLD document returned by a GetStyles request be as close as possible to original Mapfile despite not being fully compliant to standard?
  • or for instance, should tostring() function be converted to numberFormat() with tricky conversions from "%f"-like formats to "##.##"-like formats?

@jmckenna jmckenna added this to the 7.6.1 Release milestone Mar 20, 2020
@jmckenna jmckenna added the SLD label Mar 31, 2020
@rouault rouault merged commit c505ea2 into MapServer:master Apr 1, 2020
@rouault
Copy link
Contributor

rouault commented Apr 1, 2020

@jbo-ads I let you issue a backport PR against branch 7.6 if you wish

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

Successfully merging this pull request may close these issues.

None yet

4 participants