[Geoserver-users] SLD for points too small on high zoom levels

I have created a SLD for a point layer with 3 rules, giving my points a circle with 3 different colors based on an attribute. I’ve set the size to 8.
This works great.

When I zoom in my points get smaller this is OK, but when I zoom beyond level 15 the points get too small. Especially on a mobile device iIt makes it very hard to select a point.

I know I can create a rule in the SLD to change the size depending on the MinScaleDenominator and MaxScaleDenominator, but that would mean I need to create these rules 3 times; for every color category I created.

Can’t this be simpler?

I’m using OpenLayers to show the layers, so I can use that lib. as well if needed.

Thanks,

Paul

in geoserver page Gridsets you can see available gridsets. If you click on
your Gridset, you can see Tile Matrix Set.
for example: for Gridset EPSG:4326
zoom 1 - scale 139 770 566,00717944
zoom 8 - scale 1 091 957,5469310894
etc.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/SLD-for-points-too-small-on-high-zoom-levels-tp5074490p5074499.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

I think we include the scale as an environment variable, so you could use the “env” and “if_then_else” filter functions to compute a size based on the effective scale.

Another alternative would be the CSS extension (disclaimer: I’m the author of that extension) which would allow you to specify the size separately from the colors:

  • {
    mark: symbol(circle);
    mark-size: 8;
    }

[@scale > 100000] {
mark-size: 24;
}

:mark [category=1] {
fill: red;
}

:mark [category=2] {
fill: green;
}

:mark [category=3] {
fill: blue;
}

···

On Tue, Aug 27, 2013 at 6:12 AM, Paul Meems <bontepaarden@anonymised.com> wrote:

I have created a SLD for a point layer with 3 rules, giving my points a circle with 3 different colors based on an attribute. I’ve set the size to 8.
This works great.

When I zoom in my points get smaller this is OK, but when I zoom beyond level 15 the points get too small. Especially on a mobile device iIt makes it very hard to select a point.

I know I can create a rule in the SLD to change the size depending on the MinScaleDenominator and MaxScaleDenominator, but that would mean I need to create these rules 3 times; for every color category I created.

Can’t this be simpler?

I’m using OpenLayers to show the layers, so I can use that lib. as well if needed.

Thanks,

Paul


Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

On Tue, Aug 27, 2013 at 12:12 PM, Paul Meems <bontepaarden@anonymised.com> wrote:

I have created a SLD for a point layer with 3 rules, giving my points a
circle with 3 different colors based on an attribute. I've set the size to
8.
This works great.

When I zoom in my points get smaller this is OK, but when I zoom beyond
level 15 the points get too small. Especially on a mobile device iIt makes
it very hard to select a point.

Have you tried setting the size of the symbolizer using the unit of
measures in meters instead?
Maybe you can mix, have it in pixels for a certain zoom range (so that it
does not get too small) and have it in meters for the rest, so that the
more you zoom in, the bigger it becomes:
http://docs.geoserver.org/latest/en/user/styling/sld-extensions/uom.html

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Thanks Andrea,

Adding uom=“http://www.opengeospatial.org/se/units/metre” to my PointSymbolizer is really improving the size of the point at higher zoom levels.

I’ll alter my sld to use pixel size on low zoom levels and meter size at higher zoom levels.

But the main problem for me is not solved. This might be a non-geoserver issue but more of an OpenLayers issue.

When I click on the point a pop-up needs to be shown using OpenLayers.Control.WMSGetFeatureInfo.

This works great using a desktop with a mouse, but on a mobile device it is very hard to select the point.

I’d hoped making the points bigger at higher zoom levels would improve this, but there’s no change.

Any idea how to make it easier for mobile users to click on my points?

Thanks,

···

Paul

2013/8/27 Andrea Aime <andrea.aime@anonymised.com>

On Tue, Aug 27, 2013 at 12:12 PM, Paul Meems <bontepaarden@anonymised.com> wrote:

I have created a SLD for a point layer with 3 rules, giving my points a circle with 3 different colors based on an attribute. I’ve set the size to 8.
This works great.

When I zoom in my points get smaller this is OK, but when I zoom beyond level 15 the points get too small. Especially on a mobile device iIt makes it very hard to select a point.

Have you tried setting the size of the symbolizer using the unit of measures in meters instead?
Maybe you can mix, have it in pixels for a certain zoom range (so that it does not get too small) and have it in meters for the rest, so that the more you zoom in, the bigger it becomes:
http://docs.geoserver.org/latest/en/user/styling/sld-extensions/uom.html

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Wed, Aug 28, 2013 at 8:49 AM, Paul Meems <bontepaarden@anonymised.com> wrote:

Thanks Andrea,

Adding uom="http://www.opengeospatial.org/se/units/metre&quot; to my
PointSymbolizer is really improving the size of the point at higher zoom
levels.
I'll alter my sld to use pixel size on low zoom levels and meter size at
higher zoom levels.

But the main problem for me is not solved. This might be a non-geoserver
issue but more of an OpenLayers issue.
When I click on the point a pop-up needs to be shown using
OpenLayers.Control.WMSGetFeatureInfo.
This works great using a desktop with a mouse, but on a mobile device it
is very hard to select the point.
I'd hoped making the points bigger at higher zoom levels would improve
this, but there's no change.

Doh... I would have thought the same, but I see the GetFeatureInfo code is
not taking into account the uom
rescaling. This is a bug, can you open a ticket on jira.codehaus.org?

About a workaround for you, you can try adding &buffer=n to your
GetFeatureInfo request, where N is the
number of pixels you want to use as the search area

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Thanks Andrea,

I’ve requested an account. When I get it I’ll open a ticket.

I’ve added
vendorParams: {
buffer: 20 // geoserver buffer in pixels
},
to my WMSGetFeatureInfo control and now it is working great on my mobile device as well.

But can the buffer be scale depending, meaning can I set the pixels afterward?

I have a lot of points along a river, at low zoom levels the points are close to each other. Using the buffer selects sometimes the wrong point.

At higher zoom levels the points have more space between them, then the buffer is needed.

And I’m also still struggling with the SLD because when I create an extra rule using MinScale… to set uom=“http://www.opengeospatial.org/se/units/metre” only at higher zoom levels I also get an additional entry in my legend graphic.

I will do some more research, perhaps I need two separate layers each with their own SLD and group them together. But I have 4 layers and more will be added ;(

···

Thanks,

Paul

2013/8/28 Andrea Aime <andrea.aime@anonymised.com>

On Wed, Aug 28, 2013 at 8:49 AM, Paul Meems <bontepaarden@anonymised.com> wrote:

Thanks Andrea,

Adding uom=“http://www.opengeospatial.org/se/units/metre” to my PointSymbolizer is really improving the size of the point at higher zoom levels.

I’ll alter my sld to use pixel size on low zoom levels and meter size at higher zoom levels.

But the main problem for me is not solved. This might be a non-geoserver issue but more of an OpenLayers issue.

When I click on the point a pop-up needs to be shown using OpenLayers.Control.WMSGetFeatureInfo.

This works great using a desktop with a mouse, but on a mobile device it is very hard to select the point.

I’d hoped making the points bigger at higher zoom levels would improve this, but there’s no change.

Doh… I would have thought the same, but I see the GetFeatureInfo code is not taking into account the uom
rescaling. This is a bug, can you open a ticket on jira.codehaus.org?

About a workaround for you, you can try adding &buffer=n to your GetFeatureInfo request, where N is the
number of pixels you want to use as the search area

Cheers

Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it