I usually use `geomFromWKT(geometry)` with a string like 'POINT('+x+'
'+y+')' as the parameter. But a nicer function would be useful.There is also a pole of accessibility function that is better than centroid if you have oddly shaped polygons. Ian On Thu, 26 Oct 2023 at 16:22, Jody Garnett <[email protected]> wrote: > There should be a function to create a point from lat, Lon but I do not > see it in the function list. It is a little to do anything other than > transform the main geometry - since often the data is queried using a BBOX > against the main geometry. > > For greater control I would recommend use the centroid as a staring > location, and provide an offset to determine the label position. The offset > can be expressed as an expression which you can adjust for scale. > > Reference: > > - > https://docs.geotools.org/stable/userguide/library/main/function_list.html > > -- > Jody Garnett > > > On Oct 26, 2023 at 5:32:55 AM, Peter Smythe <[email protected]> wrote: > >> Hi all >> >> I am trying to use 2 numeric attributes called label_lat and label_lng to >> create a point geometry for the labeling of a polygon. >> >> Can anyone point me to the correct format, if this is indeed possible? >> >> I cannot find the information on >> https://docs.geoserver.org/latest/en/user/styling/css/index.html >> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/xyoUP5eN464DydrOGqm8BDm7444mIJZfoKj7NPfOgCaOWczz2TBs_wlTzeAWk-wH7YI8cPsDW5UXJQ7xrUegk_MeefrvVxLjepbnzSSla_tRhI5B2JuKxN3QhnO3Cl32jH8y4FglrQP3-2eECQLO10LEafasD05kJX5EskHxKcfNNV8lJ-pknCUbsxUVR6QrSYLIdlY4KUwdeX8x1MKCdK5tPk-hXMkazYYWnOp5nCN0VV2kFx1PqYodo8t1EPzmgxXfk6qf1ufXJ_mbr3CdQpeVz1Mj47CsH7qGdzA> >> >> I have tried: >> >> label-geometry: [label_lng], [label_lat]; >> label-geometry: [(label_lng, label_lat)]; >> etc >> >> and the reverse coordinate orders >> >> label-geometry: [centroid(geom)]; does work as expected, but I need >> more control. >> >> >> *I also cannot create a new column in the GeoServer SQL view that is >> visible in the output e.g. ST_Point (label_lng, label_lat, 4326) as >> label-geom * >> *i.e. if I create the new column, it must not be visible in the output.* >> >> Thanks >> >> Peter >> >> _______________________________________________ >> Geoserver-users mailing list >> >> Please make sure you read the following two resources before posting to >> this list: >> - Earning your support instead of buying it, but Ian Turton: >> http://www.ianturton.com/talks/foss4g.html#/ >> - The GeoServer user list posting guidelines: >> http://geoserver.org/comm/userlist-guidelines.html >> >> If you want to request a feature or an improvement, also see this: >> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer >> >> >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geoserver-users >> > _______________________________________________ > Geoserver-users mailing list > > Please make sure you read the following two resources before posting to > this list: > - Earning your support instead of buying it, but Ian Turton: > http://www.ianturton.com/talks/foss4g.html#/ > - The GeoServer user list posting guidelines: > http://geoserver.org/comm/userlist-guidelines.html > > If you want to request a feature or an improvement, also see this: > https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer > > > [email protected] > https://lists.sourceforge.net/lists/listinfo/geoserver-users > -- Ian Turton
_______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
