0

I am attempting to use a spatialite database generated by QGIS in openlayers. I receive the following error

Uncaught Error: Unsupported WKB geometry type 168 is found

The code below uses a sample of one of my WKB entries. It is a MULTIPOLYGON which should be supported by openlayers.

const wkb = '0001110f00003d9ec20565c662c18e258d48e0ea5541345bcc2011c662c1865e7005a7eb55417c06000000010000006903000000010000005c000000345bcc2011c662c13ca5abc59feb554110d0cb5213c662c19cee76fd98eb55412871777014c662c11bdefa8594eb5541d68e4edb14c662c19813654191eb5541839fb49f15c662c1bfa36e728ceb5541c0737ea716c662c15f8345c182eb5541fb67f82517c662c1c444ed7f7feb5541711d7e1518c662c162636ac77eeb554161eb1d4e1bc662c19f030baa7eeb5541486e38721dc662c128c795de7deb55410a4ef2a520c662c1aa14a4997beb55418ae836dd28c662c1b5b5e48279eb5541394655402ac662c1fa4e3e1b77eb5541b74e3d582cc662c1fed859a576eb5541bb5b69112ec662c1d3e26e2a75eb5541799016442fc662c162a8d24d72eb55410c41e62b30c662c13fea3ca96deb55414218403630c662c14aed72c56aeb5541d402118e2fc662c16638bf3267eb5541fe3b9b442ec662c192d2e53661eb5541b652c5ff2dc662c19ad1b1f95ceb5541308d0c152ec662c1794c7f6e53eb55411302b08d2dc662c121b4066e4eeb55415f2467a02dc662c1e554f88e4ceb5541ef80ee1d2ec662c13e72576b47eb554192a62a182fc662c15b1186c942eb5541953e940431c662c1794099e33feb5541ce57bb0532c662c15828596b3ceb5541802ff23432c662c11afb148d39eb55417997397f32c662c1805677d435eb5541d2434f5433c662c12be8f30e33eb55411e1fcd9235c662c1ef9cbb3831eb5541e6dda2913bc662c111cc1e092ceb5541c71c3bba3ec662c1ee06410829eb5541543e00fb43c662c19ade7f5024eb55410c591e5745c662c1f6990e291feb5541b23cfa7d45c662c1577617461beb55411e34407e45c662c12a90486419eb55413bf5d9df44c662c192f676b116eb55415de5447344c662c1635280b812eb554127e758b644c662c10ecc27b80feb554163ae4feb44c662c1e9647d460ceb55417e3418c044c662c1c37ed85307eb5541140b9aa943c662c1723ddfce01eb55413cfcea9e43c662c1413e4750fdea5541d811253e44c662c13279b15dfaea55416a02563847c662c1bee2ac95f4ea55412389af7949c662c164eebd75f2ea554121f77abb4ac662c1fb384eb8f2ea55411dcb2ff54ec662c16032c1aeebea5541ffbb4a0254c662c15cafde46e7ea55412614addd56c662c14495f233e3ea5541124671aa59c662c1a247fb5ee4ea55410e812bc35cc662c1afbf6cf3e2ea5541797cfea25fc662c160038e19e2ea5541adccb84864c662c1c9908852e1ea55413d9ec20565c662c18e258d48e0ea55411020e6ec64c662c1b1fbd91af1ea5541434840d163c662c1fd245667efea5541db08497756c662c121633cd0eeea554166fdbcdb53c662c194d4b6b2eeea55419b9377af4fc662c1d9f7eb04f7ea55419eb627ce4ac662c1d3edc9d900eb554170a9063d4ac662c1377e8f8b0feb5541a97a2d4f4cc662c17642b6261beb5541610a68c74cc662c1824151e220eb5541314ae45a4cc662c15ac8611a23eb55414588f63f4dc662c1284edeee26eb5541ed134cf14ac662c18973c81b2beb5541a38c33e247c662c1e3eceaa430eb55413d5c2a2b47c662c16ec423f031eb5541df38480544c662c150ee7ea237eb554115c2986b41c662c101afdf4e3eeb5541e2f330253ec662c1e84f399445eb5541e528a68438c662c138da1d904aeb5541d44a8d1f32c662c148828ca34feb55417394d15330c662c12d37764755eb5541694f370736c662c1cc43e0f85ceb5541e08ebeb639c662c1273036ce64eb55412c4e90f43ac662c1fa0fc1cc66eb55418a8be5f837c662c15e695ee475eb5541d440d92636c662c1acd9311a7feb5541ea2f65a930c662c100efde4380eb5541ab6fa0b02dc662c11023bc3c86eb5541d19cd7a523c662c17d5479168beb55415f64689b1fc662c10cfd5a7693eb5541ff54f8901bc662c15d163fd69beb5541e36c12a816c662c1e379c3c6a2eb5541f5d23aa713c662c1865e7005a7eb55419420664413c662c14c6a50b2a3eb5541970498ce11c662c18857004ba0eb5541345bcc2011c662c13ca5abc59feb5541fe';
const format = new WKB();
const feature = format.readFeature(wkb);
const mylayer = new VectorLayer({
  source: new VectorSource({
    features: [feature],
  }),
});

WKT Conversion

MULTIPOLYGON(((30 20,45 40,10 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))
James
  • 702
  • 2
  • 15
  • 39
  • MULTIPOLYGON should have type 0006 or 1006. Probably some fall back will tell you it is a like a MULTIPOLYGON, but openlayer cannot know it. IIRC some programs have "meshed" around that number). If you can: just convert the original data into more standardized geometries – Giacomo Catenazzi Mar 23 '23 at 14:49
  • The issue is other tools can convert is correctly but not openlayers. https://tools-utils.com/wkb-to-wkt for example converts it correctly – James Mar 23 '23 at 16:20
  • Other tools know more. Look what it mean such code (the data is from your) and file a bug to openlayer. For now I didn't find any information about the meaning of such type, you may know more (so you can help the developers). Note: various open source tools have problems with some types (geopandas has more problem than fiona/shapely, but geopandas uses both tools to read data). And are you sure the tools you linked do it correctly? In any case it is not a MULTIPOLYGON (which has different types) – Giacomo Catenazzi Mar 24 '23 at 08:15
  • I was able to query the database with asText(GEOMETRY) and use WKT without any issues. This means there has to be something wrong in the way openlayers is processing the WKB code. – James Mar 24 '23 at 14:24
  • So tell OpenLayers to copy copyrighted code (and possibly proprietary code) because you found tools which uses it. Still I do not know what it is such type (you didn't yet linked to any documentation of it), and I do not know why your tools are producing non-standard types (there should be a reason, and probably such reason should not be ignored). "Just work" is a very bad idea when working on web (or any hostile environment). – Giacomo Catenazzi Mar 24 '23 at 14:33

0 Answers0