Re: [postgis-users] issue with ST_AsEWKB
As you noted in IRC, you are using libgeos and libgeos_c and not liblwgeom. I used geosnop to check (and so did grayshade) This is testing with my geos 3.10.1 geosop -a 0105000100010200388066406866262730c0247b66409c99d93630c068663e7966403433b33830c09a99e17666406866263530c0547466406866263930c0a87166409c99f93f30c0346f6640d0cc4c4b30c068667e6b6640406130c0cecc64696640d0cc0c6630c0306766409c99b96730c0ceccec626640007030c0ceccbc5e66409c7b30c0b45b6640408a30c03433c35966406866a6a130c03433d35766409c9959a230c06866f655664068aa30c04c546640686606a630c0ceccac526640349f30c034332b5266403433f3a930c058516640343353b330c0cecc70506640e0b930c03433eb4f66403433b3c930c09a99515366403433f3cc30c034336b546640d0ccecd930c048556640686686eb30c0cecc9c5666406866e6f930c09a99b1596640c0f330c03433475c66403433d3e230c09a99695e6640d0cc6ce730c038606640343373e630c06866c6616640686646d030c09a997940343373b630c09a999d6966409c99d9b530c0cecc586a66403433d3b730c06866126b6640d0cc0cc530c0006c6640c0ca30c034336b6d66409c9979ce30c0cecce46e66409c9959ce30c0ceccd87266409c9979c930c03433df7666409c9959be30c0447a66406866a6bc30c09a99b17d6640343393be30c034337b7c6640c0aa30c09a99fd7c6640689530c06866a67d66409c99398d30c09a99c57d66409c99f98430c09a99517c66409c99b98430c09a99e97a66409c8930c068664e7666406866c6a130c068662e7266409c9959bf30c09a990d726640d0cc0ca330c0d07366409c99198730c0ceccf0776640407230c0343367796640d05e30c0cecc247b66409c99394d30c09a99f97f66406866262b30c0 -f wkt yields: MULTILINESTRING ((180 -16.15292968756, 179.84814453125 -16.21425781250001, 179.78886718750005 -16.22148437503, 179.7150390625 -16.20761718756, 179.63525390625 -16.22324218756, 179.5517578125 -16.24990234375001, 179.47509765625 -16.2941406251, 179.35917968750005 -16.3798828125, 179.29355468750003 -16.39863281250001, 179.224609375 -16.40517578125001, 179.0914062503 -16.4375, 178.9605468753 -16.4828125001, 178.86572265625 -16.5400390625, 178.8050781252 -16.63144531256, 178.7445312502 -16.63417968750001, 178.6863281255 -16.6656256, 178.63427734375 -16.648535156250006, 178.5835937503 -16.6218753, 178.56777343750002 -16.66386718753, 178.5419921875 -16.700488281250003, 178.51376953125003 -16.72607421875, 178.49746093750002 -16.78789062503, 178.6037109375 -16.80058593753, 178.63808593750002 -16.85126953125001, 178.6650390625 -16.920019531250006, 178.7066406253 -16.97617187506, 178.8029296875 -16.9521484375, 178.88369140625002 -16.886035156250003, 178.950390625 -16.90400390625001, 179.0068359375 -16.90019531253, 179.0554687505 -16.813574218750006, 179.20234375 -16.71269531253, 179.30048828125 -16.71035156250001, 179.32333984375003 -16.718066406250003, 179.34599609375005 -16.76972656250001, 179.375 -16.7919921875, 179.41933593750002 -16.80654296875001, 179.46542968750003 -16.80605468750001, 179.58896484375003 -16.78701171875001, 179.71474609375002 -16.74355468750001, 179.82080078125 -16.73691406256, 179.9279296875 -16.744433593750003, 179.89003906250002 -16.6669921875, 179.90595703125 -16.58359375006, 179.9265625005 -16.55166015625001, 179.93037109375 -16.51943359375001, 179.8849609375 -16.51845703125001, 179.841015625 -16.537501, 179.69707031250005 -16.631933593750006, 179.56816406250005 -16.74746093750001, 179.56416015625 -16.63691406250001, 179.619140625 -16.5277343751, 179.74814453125003 -16.4462890625, 179.79384765625002 -16.3703125001, 179.84824218750003 -16.30166015625001, 179.99921875 -16.16855468756)) So geos does not seem to be at fault here either. Which leaves something in your C code. From: Regina Obe [mailto:l...@pcorp.us] Sent: Saturday, March 18, 2023 10:38 AM To: 'PostGIS Users Discussion' Subject: RE: [postgis-users] issue with ST_AsEWKB Can you provide the exact C lines you are using to extract. I just ran this: SELECT ST_AsText('0105000100010200388066406866262730c0247b66409c99d93630c068663e7966403433b33830c09a99e17666406866263530c0547466406866263930c0a87166409c99f93f30c0346f6640d0cc4c4
Re: [postgis-users] issue with ST_AsEWKB
Can you provide the exact C lines you are using to extract. I just ran this: SELECT ST_AsText('0105000100010200388066406866262730c0247b66409c99d93630c068663e7966403433b33830c09a99e17666406866263530c0547466406866263930c0a87166409c99f93f30c0346f6640d0cc4c4b30c068667e6b6640406130c0cecc64696640d0cc0c6630c0306766409c99b96730c0ceccec626640007030c0ceccbc5e66409c7b30c0b45b6640408a30c03433c35966406866a6a130c03433d35766409c9959a230c06866f655664068aa30c04c546640686606a630c0ceccac526640349f30c034332b5266403433f3a930c058516640343353b330c0cecc70506640e0b930c03433eb4f66403433b3c930c09a99515366403433f3cc30c034336b546640d0ccecd930c048556640686686eb30c0cecc9c5666406866e6f930c09a99b1596640c0f330c03433475c66403433d3e230c09a99695e6640d0cc6ce730c038606640343373e630c06866c6616640686646d030c09a997940343373b630c09a999d6966409c99d9b530c0cecc586a66403433d3b730c06866126b6640d0cc0cc530c0006c6640c0ca30c034336b6d66409c9979ce30c0cecce46e66409c9959ce30c0ceccd87266409c9979c930c03433df7666409c9959be30c0447a66406866a6bc30c09a99b17d6640343393be30c034337b7c6640c0aa30c09a99fd7c6640689530c06866a67d66409c99398d30c09a99c57d66409c99f98430c09a99517c66409c99b98430c09a99e97a66409c8930c068664e7666406866c6a130c068662e7266409c9959bf30c09a990d726640d0cc0ca330c0d07366409c99198730c0ceccf0776640407230c0343367796640d05e30c0cecc247b66409c99394d30c09a99f97f66406866262b30c0'::geometry ); And it outputs Y fine. ST_AsText uses liblwgeom. So perhaps a typo something in your code or some dependency issue. MULTILINESTRING((180 -16.15292968756,179.84814453125 -16.21425781250001,179.78886718750005 -16.22148437503,179.7150390625 -16.20761718756,179.63525390625 -16.22324218756,179.5517578125 -16.24990234375001,179.47509765625 -16.2941406251,179.35917968750005 -16.3798828125,179.29355468750003 -16.39863281250001,179.224609375 -16.40517578125001,179.0914062503 -16.4375,178.9605468753 -16.4828125001,178.86572265625 -16.5400390625,178.8050781252 -16.63144531256,178.7445312502 -16.63417968750001,178.6863281255 -16.6656256,178.63427734375 -16.648535156250006,178.5835937503 -16.6218753,178.56777343750002 -16.66386718753,178.5419921875 -16.700488281250003,178.51376953125003 -16.72607421875,178.49746093750002 -16.78789062503,178.6037109375 -16.80058593753,178.63808593750002 -16.85126953125001,178.6650390625 -16.920019531250006,178.7066406253 -16.97617187506,178.8029296875 -16.9521484375,178.88369140625002 -16.886035156250003,178.950390625 -16.90400390625001,179.0068359375 -16.90019531253,179.0554687505 -16.813574218750006,179.20234375 -16.71269531253,179.30048828125 -16.71035156250001,179.32333984375003 -16.718066406250003,179.34599609375005 -16.76972656250001,179.375 -16.7919921875,179.41933593750002 -16.80654296875001,179.46542968750003 -16.80605468750001,179.58896484375003 -16.78701171875001,179.71474609375002 -16.74355468750001,179.82080078125 -16.73691406256,179.9279296875 -16.744433593750003,179.89003906250002 -16.6669921875,179.90595703125 -16.58359375006,179.9265625005 -16.55166015625001,179.93037109375 -16.51943359375001,179.8849609375 -16.51845703125001,179.841015625 -16.537501,179.69707031250005 -16.631933593750006,179.56816406250005 -16.74746093750001,179.56416015625 -16.63691406250001,179.619140625 -16.5277343751,179.74814453125003 -16.4462890625,179.79384765625002 -16.3703125001,179.84824218750003 -16.30166015625001,179.99921875 -16.16855468756)) and I got:
[postgis-users] issue with ST_AsEWKB
Hi there, and thank you for reading and answering this post. First of all, thank you for PostGis itself. I have been wanting to use postgis for years, but found not suitable data. But, thank to natural earth, I got a decent set a geom data, and now, I can start up my project. That being said, I installed postgis 3.2.4 and created a table named 'coastline' containing the outlines of all the continents. Here is an example of what I got: select ST_AsEWKT(geometry) from coastline limit 1 MULTILINESTRING((180 -16.15292968756,179.84814453125 -16.21425781250001,179.78886718750005 -16.22148437503,179.7150390625 -16.20761718756,179.63525390625 -16.22324218756,179.5517578125 -16.24990234375001,179.47509765625 -16.2941406251,179.35917968750005 -16.3798828125,179.29355468750003 -16.39863281250001,179.224609375 -16.40517578125001,179.0914062503 -16.4375,178.9605468753 -16.4828125001,178.86572265625 -16.5400390625,178.8050781252 -16.63144531256,178.7445312502 -16.63417968750001,178.6863281255 -16.6656256,178.63427734375 -16.648535156250006,178.5835937503 -16.6218753,178.56777343750002 -16.66386718753,178.5419921875 -16.700488281250003,178.51376953125003 -16.72607421875,178.49746093750002 -16.78789062503,178.6037109375 -16.80058593753,178.63808593750002 -16.85126953125001,178.6650390625 -16.920019531250006,178.7066406253 -16.97617187506,178.8029296875 -16.9521484375,178.88369140625002 -16.886035156250003,178.950390625 -16.90400390625001,179.0068359375 -16.90019531253,179.0554687505 -16.813574218750006,179.20234375 -16.71269531253,179.30048828125 -16.71035156250001,179.32333984375003 -16.718066406250003,179.34599609375005 -16.76972656250001,179.375 -16.7919921875,179.41933593750002 -16.80654296875001,179.46542968750003 -16.80605468750001,179.58896484375003 -16.78701171875001,179.71474609375002 -16.74355468750001,179.82080078125 -16.73691406256,179.9279296875 -16.744433593750003,179.89003906250002 -16.6669921875,179.90595703125 -16.58359375006,179.9265625005 -16.55166015625001,179.93037109375 -16.51943359375001,179.8849609375 -16.51845703125001,179.841015625 -16.537501,179.69707031250005 -16.631933593750006,179.56816406250005 -16.74746093750001,179.56416015625 -16.63691406250001,179.619140625 -16.5277343751,179.74814453125003 -16.4462890625,179.79384765625002 -16.3703125001,179.84824218750003 -16.30166015625001,179.99921875 -16.16855468756)) So far so good. The data is correct and I can read it and display the coastline. Fine ! But a need to read it faster, so I rather intend to use the hex form: select ST_AsEWKB(geometry, 'NDR') from coastline limit 1; and I got: \x0105000100010200388066406866262730c0247b66409c99d93630c068663e7966403433b33830c09a99e17666406866263530c0547466406866263930c0a87166409c99f93f30c0346f6640d0cc4c4b30c068667e6b6640406130c0cecc64696640d0cc0c6630c0306766409c99b96730c0ceccec626640007030c0ceccbc5e66409c7b30c0b45b6640408a30c03433c35966406866a6a130c03433d35766409c9959a230c06866f655664068aa30c04c546640686606a630c0ceccac526640349f30c034332b5266403433f3a930c058516640343353b330c0cecc70506640e0b930c03433eb4f66403433b3c930c09a99515366403433f3cc30c034336b546640d0ccecd930c048556640686686eb30c0cecc9c5666406866e6f930c09a99b1596640c0f330c03433475c66403433d3e230c09a99695e6640d0cc6ce730c038606640343373e630c06866c6616640686646d030c09a997940343373b630c09a999d6966409c99d9b530c0cecc586a66403433d3b730c06866126b6640d0cc0cc530c0006c6640c0ca30c034336b6d66409c9979ce30c0cecce46e66409c9959ce30c0ceccd87266409c9979c930c03433df7666409c9959be30c0447a66406866a6bc30c09a99b17d6640343393be30c034337b7c6640c0aa30c09a99fd7c6640689530c06866a67d66409c99398d30c09a99c57d66409c99f98430c09a99517c66409c99b98430c09a99e97a66409c8930c068664e7666406866c6a130c068662e7266409c9959bf30c09a990d726640d0cc0ca330c0d07366409c99198730c0ceccf0776640407230c0343367796640d05e30c0cecc247b66409c99394d30c09a99f97f66406866262b30c0 Seems good but when I process this string with libgeom or libgeom_c or a handmade C routine, I rather got this: Geometry: MULTILINESTRING ((180. 0., 179.535644531250 0., 179.7876464843750455 0., 179.6955078124997272 0., 179.635253906250 0., 179.532226562500 0., 179.162597656250 0.,