6

There are many questions & answers here addressing how to convert between WKT and WKB geometries, and about the specifications or implementation details. But what are the considerations for choosing between them in general, when there are no external requirements? For example, is WKB faster?

Or for my specific use case: I want to convert a shapefile to SQLite in QGIS, and have to choose between WKT and WKB. When should I choose one over the other?

  • 1
    What did you research tell you? My quick search suggested that WKB is a binary equivalent used for storing the information in a database. See Well-known text on Wikipedia. – Midavalo Apr 6 '17 at 15:55
  • 2
    If you're storing it in a database such as SQLite, then I would lean towards WKB. If it needs to be human readable however, then you might want to use WKT. – T_Bacon Apr 6 '17 at 15:59
  • 1
    The question is put on hold as too broad, but it is a specific question (the second paragraph about SQLite is just one example when you would want to know the answer to the question). I'm not sure how to make it more specific. // @Midavalo and T_Bacon: the information encoded is obviously equivalent, but two formats have been standardized and implemented. And both WKT and WKB are options for storing geometries in a database. – arjan Apr 8 '17 at 18:41
  • 1
    Now, it's possible that the answer is simply that WKT is meant for human-readability. But in that case you would expect there are also downsides to WKT, why else would WKB exist? Hence my note about potential speed differences (or perhaps space usage?). And in that case I would expect rules-of-thumb like "use WKB for very large data sets". But I didn't find such guidelines. – arjan Apr 8 '17 at 18:42
  • 1
    @arjan human readability for WKT, binary storage in a database for WKB. Tidier to store but harder to read, and vice versa – Midavalo Apr 8 '17 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.