White space gets reduced in the XML, so you might need a cdata block around
it. Not sure how CSS handles it.

Ian

On Thu, 26 Oct 2023, 20:44 Peter Smythe, <g...@smythe.co.za> wrote:

> Thank you very much for your answers.  All 3 of them are super useful.
>
> Ian, I do not have the luxury of building up the string in a single
> attribute, so I need to use the Concatenate or strConcat functions from
> Jody's reference.  Andrea, the WKT X and Y coordinates are not separated by
> a comma but rather by a space.
>
> The strConcat function only joins 2 strings, the Concatenate function is
> able to join many strings.
>
> So something like this should work:
>
> label-geometry: [geomFromWKT(Concatenate('POINT(', label_lng, ' ',
> label_lat, ')'))];
> or
> label-geometry:
> [geomFromWKT(strConcat(strConcat(strConcat(strConcat('POINT(', label_lng),
> ' '), label_lat), ')'))];
>
> However, the SLD created contains (for the space separator between X and
> Y):
> <ogc:Literal> </ogc:Literal>
>
> and it appears from my testing and debugging that this is evaluated as ""
> i.e. an empty string.
>
> (I get the exception: `bad wkt` when evaluating it, and I have confirmed
> the above in Eclipse)
>
> Trying to force a `&nbsp;` into the Literal does not work.
>
> Is there a bug with parsing a literal space?
>
> So, I am very close to my solution, I just need a way to represent a
> literal space, if anyone can assist, please?
>
> Thanks
>
> Peter
>
> On Thu, 26 Oct 2023 at 17:29, Ian Turton <ijtur...@gmail.com> wrote:
>
>> 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 <jody.garn...@gmail.com>
>> 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
>>>    
>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/euXGZ9x4RgzAEJHnr8_XYW4sQUdxTgvINg9XAoGEGHVs4s3MJt7JlfQ9z8kojpBeDjalS074Ct4w_FzOXQzeQteVkC4CgL0XOCtphD3yiku5rwacybz61OAVS2V-YWjm2b3v2cdktX7Q0k9fThJprUFLuoUA12thVN0k2OO-92IUNMICq5zmth3RJAvCrB_ZXg6z7XaCD4Rvc4c6mlb5gvuiKijQ1AAB_bk56P9LelJoMTozAmQY-ROjXY6Z4Z9CH5sZnI6uszqaB3S4O1sxEkBS_-xeHrTajy0kybvtXav-0qWzPg>
>>>
>>> --
>>> Jody Garnett
>>>
>>>
>>> On Oct 26, 2023 at 5:32:55 AM, Peter Smythe <g...@smythe.co.za> 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#/
>>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/d6ijUroA7OwybKz0YM_iRNGEa6j9vlWLsEu_z0sIv8ZnxmUUBlBKyKxPXJS45ZL9qYg5vO6D9FSwhcTUDb6Ku5VFmtoVjBoWURshyJ7ELLJOnvPGNfsrda6XZ0I0nlUy-f8Wq0OLxOfN9x6og1bEmbdKKR9KyTBiVWhF2hl856NrUXOwmxO_igaCINPlAAI8CHI4hCle_D0lUicQ9s6uZRmM1VpbwczchAkrG98KC73crVmhkEjxS3VMeamn9O8w7JnNYDU>
>>>> - The GeoServer user list posting guidelines:
>>>> http://geoserver.org/comm/userlist-guidelines.html
>>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/oW2iacJhr4K7S7zmdDbGwJm1E1nLCQDKX1pHjuOgwegKqwFRQOae8wo8LyX1vh6Fv2CfN4v0hMqJS4NcWYuEJ_3is6GCVwNK-pQOFooWBKxe44AbxXeyo5lEfj0jjv1dlE_GkGae4MVH0yaJM3WVN7As61dh2Wd0os7cKdsXOvsWAwkEIg9LiKvFH65G6hA1d2w0Q1U6afUrmuxz0KCxm0OhWcUJYpHWGzJ5-8bW32Y2OkiQpxAMR7Phf-9IQbcYmmmvX-QFYg>
>>>>
>>>> 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
>>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/obEJJnwvQN-pfiBIC3iPKnFvptof84buzbUGooPXORP1L3GXvf6hR8U3ZVHCf23Kwim0GsBwUpOrcheaPW1i8MHm-IVpzKXlRJZMoabfHmEA4bWXe2g3KoHC-dimkxqO56CKQyhc4vL4_9gn0F3zMUugAU9aGJuPjeoY8gzgzr6TNXyFPNJwWygFPL3UmKDyOPQM52rBK0QE256Pg6cBlzCeLYHCtrQfSdxlX-UG-l7MQZFMcGp6APs50yt8Ihguql77BRVDhmfjkO_ByLMsRcUxQU-uRedoh1PZiRo3EdgQ4DBonr-CAKaWw8EslsKtrly4PFexCz-EYaCNXaOi8501ctD5r0wqcDXSjp6_d0z24Alrfcp9>
>>>>
>>>>
>>>> Geoserver-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/sTN5Kg5-RZnLeTKsyo5cPSoBLZE14sU08m3kbftrwWkpP_3bYVbQb7HGzJR5Q7RdTamcyPALhMqiSVWmdtiGeyJj3mEnDQGMGDtpeNy6ByhDEufWEWhcNUAiRgCsv75pSJIQqCFQzoXEIs818YqUnIoNeIg_KbJCWsGhoEvA0LBga1RJbVJ32ajaem13n7_p_atWHOZFnKanpsgTjD7WxyoZQDnlsSSV5_QP2C6UxTIBjVbLZnfJg0LfCRnTyeJa48fVRxth0urUdLJBnn_lwF44fw>
>>>>
>>> _______________________________________________
>>> 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#/
>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/SYHaAC-Od_dFQY9cztKtt-0afvi-mGnc3Dh0jHXppogi9ai6jH4woUYGL58mavu3zglF2NZ_FklHcTeMnlTC0WCBUxM0pG3oIaIN91uW3fILDBpOinlM4W0YoRRNdei8C2MTFcg2o3p74xkFd3tVYwWKAWEAitNO8jar30PrZ10tDqxGCUkSsaoJCwt5GIZhLMrKOly-Zsxdm8WwYH6ca_vonj2aSKfZgDD1fX-2EykaV-KLOmoNP-1Mq-hSydQRfn7unX8>
>>> - The GeoServer user list posting guidelines:
>>> http://geoserver.org/comm/userlist-guidelines.html
>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/pRW23qOuDAE_fxObMLWaAfw16Cr2uHzN44a9AGgDICBcB2KQRrTuungChin-8StnPfAZP_8tG-3VKvtZSsMd8l7HV-x9pGf8czM87Xs7jDF_R4tl2qrjrN8SMb7CDtHlDIKXGN_OA122cxaexHTI7Mi4NTLIf1n3hmuwLQUEKLxDYBsyuxPUJHKvubOW5TJ4rkv1GH-v396735Hyg3YvRbiHy_CMmHNSDv3vY7qDhelprG5xcrZxPU8ZgSnm-wUWDU4Z7-M_vw>
>>>
>>> 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
>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/h8qmnTzGW54dJH2EMvZu7APIulkdeMW2x7ufuGQ8AzWqqHkrEK1CvhoMk5LsQV-Q0cc13kxn1pxkPRPnt4LLFg8xmWE9DyVAMPZdy-jCXt0bvgCTOsof5AcKLI3rAp9URg-0KpDEjGAVPtfhO8st27NJ-6BrCf5oPK_3MAeqvKvHcw0cbMHC0JjLrlncwIigwmTRnRBRvnK-doUj-wW_d3cdJZBCb0csMAxepXOLntJbduNgo9mre6JVC7KVYZYY6LVfvjfQts3J0YQMhofCw-LZ_wp-5rrls3tKgm58GFS0l8TUiyFlfHU2zMTz8hrJ30QDj58ad6eJj9FaELuLsBzpJITY6ptN3f6aS0p-Pdoh2K_psqVB>
>>>
>>>
>>> Geoserver-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>> <https://fdfdfha.r.af.d.sendibt2.com/tr/cl/9TaqHHpkICG-eZVtiXBbHhSeN95A7DUqK-O93udj4aHJayPL6taeQh9PGF8Lsy2LUBV8rwMVnv2NtL5EQRnPrrYem0sL2XgxFP18PvInX5F87rp46lK1MRrtXOXS7x5G9XmQtX_3P16HTEIkUHLpcx107eTrtrnrnYRrLYR42MaUWs9-VHRBwAfrLS6u3s4oPqpoMPJ7TAKdxYIUnymM6_rUigPDLkcT6kyAIm543nqPdJnTn2RZvI9jvxoO6zSBJWGljw9tqz-jxxZo9fXxTKlhtA>
>>>
>>
>>
>> --
>> 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
>
>
> Geoserver-users@lists.sourceforge.net
> 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


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to