Title: Default field size and decimal length when writing shapefiles · Issue #114 · GeospatialPython/pyshp · GitHub
Open Graph Title: Default field size and decimal length when writing shapefiles · Issue #114 · GeospatialPython/pyshp
X Title: Default field size and decimal length when writing shapefiles · Issue #114 · GeospatialPython/pyshp
Description: Due to recent changes since 1.2.10, the issue of field and value types have been raised as a concern by several users. Most recently, @klasko2 pointed out in #99 that saving a float value to an 'F' field will save it as an integer, becau...
Open Graph Description: Due to recent changes since 1.2.10, the issue of field and value types have been raised as a concern by several users. Most recently, @klasko2 pointed out in #99 that saving a float value to an 'F'...
X Description: Due to recent changes since 1.2.10, the issue of field and value types have been raised as a concern by several users. Most recently, @klasko2 pointed out in #99 that saving a float value to an ...
Opengraph URL: https://github.com/GeospatialPython/pyshp/issues/114
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Default field size and decimal length when writing shapefiles","articleBody":"Due to recent changes since 1.2.10, the issue of field and value types have been raised as a concern by several users. Most recently, @klasko2 pointed out in #99 that saving a float value to an 'F' field will save it as an integer, because the default number of decimals is 0 when defining a new field. This begs the more general question for the next version of PyShp: \r\n\r\n**What should be the default field 'size' and 'decimal' for different field types?** \r\n\r\nI hope this thread can be used as a place for people to voice their concerns and share their experiences and expectations regarding shapefiles and dbf field types. \r\n\r\n# The Issue\r\n\r\nUntil now, field size (i.e. how many bytes) has been always set to 50, and decimal always to 0. \r\nInstead, I think the case can be made that **any numeric field should default to a decimal number**. This leaves us with some open questions: \r\n\r\n1. **...what's a good default size number?** Is 50 big enough to store most numbers that an average user would need and at the same time small enough to not waste filesize. For a negative decimal number, this could store a value as low as `-100000000000000000000000000000000000000000000000.0`, or as detailed as `-0.000000000000000000000000000000000000000000000001` (provided the decimal arg is set accordingly)? That might actually seem excessively high for most users so perhaps it should be lowered to produce smaller shapefiles? What's the default in other software? \r\n2. **...what's a good default decimal number?** Would 6 decimal places retain enough information for the average user not to feel they are losing information? This would mean floats being rounded to e.g. `0.123456`. Perhaps this is too small, should it be instead 12 or 16? What's the default in other software? \r\n3. **...should size and decimal be the same for 'F' and 'N' fields?** Float fields are decimals by definition, but Numeric fields can be both ints or floats. One might argue that both should default to decimal numbers, since defaulting to ints would result in lost information for unsuspecting users. Manually setting decimal=0 can be done if the user is certain they just want to save ints. \r\n\r\nFor the remaining field types I think the following would be non-controversial:\r\n- Type 'C': size=80, decimal irrelevant. Text fields are typically longer than numeric fields, and I believe that's the default QGIS text field size. This would save text values as long as `abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde`.\r\n- Type 'L': size=1, decimal irrelevant. \r\n- Type 'D': size=8, decimal irrelevant. \r\n\r\nAny and all thoughts are appreciated! \r\n","author":{"url":"https://github.com/karimbahgat","@type":"Person","name":"karimbahgat"},"datePublished":"2017-08-29T16:07:42Z","url":"https://github.com/GeospatialPython/pyshp/issues/114"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e0145b3f-dbd7-1c3a-d347-4a8c9df2c86c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2B2:DC070:43677B:5E9DDF:6B00709E |
| html-safe-nonce | 1dcfb14e4b9c86254a9850b471832d692fdc24474db40738696bf3f5fdfc0a8e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkIyOkRDMDcwOjQzNjc3Qjo1RTlEREY6NkIwMDcwOUUiLCJ2aXNpdG9yX2lkIjoiMzQwMDQxMjkyNjcyMzUxODYyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d1fd346429b853b9a535eeaf4baa1093dd98b59c0cf38d5cc50253e269899453 |
| hovercard-subject-tag | issue:253720773 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/GeospatialPython/pyshp/114/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bdcca97f4292e8ef93e2bb87d0ee637a273bdc39470ebfe8fa37919cdf4192ae/GeospatialPython/pyshp/issues/114 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bdcca97f4292e8ef93e2bb87d0ee637a273bdc39470ebfe8fa37919cdf4192ae/GeospatialPython/pyshp/issues/114 |
| og:image:alt | Due to recent changes since 1.2.10, the issue of field and value types have been raised as a concern by several users. Most recently, @klasko2 pointed out in #99 that saving a float value to an 'F'... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | karimbahgat |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6527e91c60c0b29d16606ff32ac5df8ecdc37a2a62205ea057a14d7762c870fa |
| turbo-cache-control | no-preview |
| go-import | github.com/GeospatialPython/pyshp git https://github.com/GeospatialPython/pyshp.git |
| octolytics-dimension-user_id | 5385450 |
| octolytics-dimension-user_login | GeospatialPython |
| octolytics-dimension-repository_id | 17410607 |
| octolytics-dimension-repository_nwo | GeospatialPython/pyshp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 17410607 |
| octolytics-dimension-repository_network_root_nwo | GeospatialPython/pyshp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 46f1cd2ae3cd8ae1a81019b5d619742e76f13bbd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width