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

Offset property is being ignored on MarkSymbolizer #799

Open
florentsuc opened this issue Mar 20, 2024 · 1 comment
Open

Offset property is being ignored on MarkSymbolizer #799

florentsuc opened this issue Mar 20, 2024 · 1 comment

Comments

@florentsuc
Copy link

florentsuc commented Mar 20, 2024

Bug

Describe the bug
Converting from SLD to OpenLayers style, offsets on MarkSymbolizer are no longer handled, even though the SLD uses displacement. Displacement is transformed to undefined.

To Reproduce
Steps to reproduce the behavior:

  • Create an SLD with a Mark style and Displacement.
  • Convert the style to geostyler and then to OpenLayers
  • Style a vector layer with the OL style.

Example:

<Rule>
	<Name>selected property</Name>
	<PointSymbolizer>
		<Graphic>
			<Mark>
				<WellKnownName>circle</WellKnownName>
				<Fill>
					<CssParameter name="fill">#FFFFFF</CssParameter>
				</Fill>
			</Mark>
			<Size>45.0</Size>
			<Displacement>
				<DisplacementX>1</DisplacementX>
				<DisplacementY>1</DisplacementY>
			</Displacement>
		</Graphic>
	</PointSymbolizer>
</Rule>

Expected behavior
offset property should not be undefined

Desktop (please complete the following information):
OS: Mac OS
Browser: Chrome
Version: 122.0

Additional context
The bug has been introduced here:

displacement: typeof(markSymbolizer.offset) === 'number' ? markSymbolizer.offset : undefined

Proposed solution

  • offset is not a number, it is an array, so we could check Array.isArray(offset)
  • we should update the unit tests and introduce an offset + displacement into the mocked data
@KaiVolland
Copy link
Contributor

Thanks for the detailed report.

As you always got so far with the research it would be nice if you could provide a PR with the adjustment and the corresponding tests.
Otherwise this might need some time to be fixed.

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

No branches or pull requests

2 participants