Solved

WKB not becoming a Geometry

  • 25 April 2024
  • 6 replies
  • 47 views

Badge +4

Hello yet again 😅

I’m GET-calling a an online database through HTTPCaller which responds with giving me a feature in WKB code (in _response_body), then I run the respective code through GeometryReplacer and tried different WKB Encodings in attempts to get a geometry out of it (this should be a polygon), but no luck.

The following encodings give me this:

  • Hex Encoded FME Binary: Rejected (INVALID_PARAMETER_GEOMETRY_SOURCE)
  • OGC Well Known Binary: Rejected (INVALID_PARAMETER_GEOMETRY_SOURCE)
  • Hex Encoded OGC Well Known Binary: Ends up in Output and thus not in the rejected port but it does not create any geometry feature that can be inspected.

The code is following, so if anyone has seen this before or is enthusiastic to figure this out with me then feel free to investigate:

0
010300002084080000010000000E000000931E86C64699244192E9D0891B741D41DBF97EF242992441C3F0110102741D41F4A963551A99244180F3E2341E741D41F4531C970F9924415EBBB401E0731D41AED4B380CF982441BF9A03840B741D41001E5119CB982441BB0A294FED731D4162139921CA982441F5BC1BDBED731D4123A12DF7C49824416286C653CE731D41554FE6EFB798244100378B87D7731D4174CFBA66AD98244173D53C5797731D4100E5EF2E859824416FBDA667B2731D41CEA62398A398244143E55F1B84741D41D6C8AEF4F1982441DCBA9BE751741D41931E86C64699244192E9D0891B741D41

With regards from north of 66°, Hlynur

icon

Best answer by debbiatsafe 25 April 2024, 22:16

View original

6 replies

Userlevel 3
Badge +18

I get this line:

when setting the geometry encoding to ‘Encoded polyline’ or ‘QlikMaps Encoded Polyline’, not sure if the result should be that artistic? You have more details about the database you’re getting this from?

Userlevel 3
Badge +17

Hello @hlynur 

If I strip the leading 0 and line feed character from your data sample, GeometryReplacer is able to create the following polygon with Hex Encoded OGC Well Known Binary encoding.

The GeometryReplacer also extracts 2180 as _postgis_ewkb_srid_. Perhaps this is closer to your expected results?

Badge +4

Hey @debbiatsafe and thanks for this.

Was trying something similar and still didn’t get a geometry, the one you got is however exactly what I would want out of this. Question what I am doing wrong there, I clean the _response_body with StringReplacer as seen here:

 

Then I run it through the GeometryReplacer like this:

 

The code being:

0010300002084080000010000000E000000931E86C64699244192E9D0891B741D41DBF97EF242992441C3F0110102741D41F4A963551A99244180F3E2341E741D41F4531C970F9924415EBBB401E0731D41AED4B380CF982441BF9A03840B741D41001E5119CB982441BB0A294FED731D4162139921CA982441F5BC1BDBED731D4123A12DF7C49824416286C653CE731D41554FE6EFB798244100378B87D7731D4174CFBA66AD98244173D53C5797731D4100E5EF2E859824416FBDA667B2731D41CEA62398A398244143E55F1B84741D41D6C8AEF4F1982441DCBA9BE751741D41931E86C64699244192E9D0891B741D41

But it still just Outputs a tabular thing instead of a geometry, even tried to add a GeometryCoercer and set as polygon but without any luck.

Any idea what I am missing or doing wrong?

 

@becchr that is one damn good looking line but not what I was after 😅

Userlevel 4
Badge +36

As @debbiatsafe says, remove the leading 0 and the line feed.

So something like this regex will work: ^0\n (from the beginning of the string, find one 0 and one newline).

You can also do this in 'Replace Text’ mode: Text To Replace is a 0 followed by a Newline character (which you can find on the left side under Special Characters).

Userlevel 3
Badge +18

thanks @hlynur, was pretty impressed myself 😄

the leading zero is still in your code, it should be removed too so if you change in the stringreplacer from (\n) to (0\n) I think it should work?

Badge +4

Thanks for this @debbiatsafe, @becchr & @geomancer, I have a polygon!

My latter problem is that I didn’t get that I was not only supposed to remove the standalone 0 that was in the first line but also the first 0 in the second now (plus the linebreaks of course).

Well done and thanks for the quick responses and may the GeoGods be in your favour 🌍

Reply