Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix .dbf fields allowed length and num #58848

Closed

Conversation

notguiltyspark
Copy link
Contributor

@notguiltyspark notguiltyspark commented Sep 23, 2024

Description

Fix dbf-format allowed field width and maximum number of fields

  1. Shapefile format is using dbf-tables to store geometry attributes, which, according to specification, has a set number of max fields and each field has a max width, depending on its type. Width numbers and max number are taken from here:

    https://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Geoprocessing%20considerations%20for%20shapefile%20output

    Thus in the shapefile layer creation menu width-text-edit field changed to int spinbox and it would have it's max value changed according to chosen field type.

    Origin version
    qgis_shapefile_dlg_origin

    Fix version
    image

  2. It may be advised to double-check width-values since dbf has several versions. Here ESRI was chosen as the first guideline, but there still may be nuances, which were not understood/confused/interpreted incorrectly during our research and fix

@github-actions github-actions bot added this to the 3.40.0 milestone Sep 23, 2024
@notguiltyspark notguiltyspark force-pushed the fix_dbf_allowed_field_length branch 2 times, most recently from ac28aa1 to 7e754b5 Compare September 23, 2024 19:39
Copy link

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit 7e754b5)

@notguiltyspark notguiltyspark marked this pull request as draft September 25, 2024 05:07
Comment on lines 174 to 175
if ( mWidth->value() < 1 || mWidth->value() > ESRI_SHORT_INTEGER_MAX_WIDTH_INCLUSIVE )
mWidth->setValue( ESRI_SHORT_INTEGER_MAX_WIDTH_INCLUSIVE );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually required? I believe it should be handled by QSpinBox in the setMaximum call already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, i see!
Changed QSpinBox to QgsSpinBox, undone this check and used ClearValue as additional tweak

@@ -252,6 +246,16 @@
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="mWidth">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<widget class="QSpinBox" name="mWidth">
<widget class="QgsSpinBox" name="mWidth">

This is a subclass of QSpinBox which adds additional tweaks

Copy link

The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check

  • that all unit tests are passing

  • that all comments by reviewers have been addressed

  • that there is enough information for reviewers, in particular

    • link to any issues which this pull request fixes

    • add a description of workflows which this pull request fixes

    • add screenshots if applicable

  • that you have written unit tests where possible
    In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request.
    If there is no further activity on this pull request, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Oct 14, 2024
@lbartoletti lbartoletti added Requires Tests! Waiting on the submitter to add unit tests before eligible for merging Vectors Related to general vector layer handling (not specific data formats) labels Oct 14, 2024
@github-actions github-actions bot removed the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Oct 15, 2024
@nyalldawson nyalldawson removed the Requires Tests! Waiting on the submitter to add unit tests before eligible for merging label Oct 17, 2024
@notguiltyspark notguiltyspark force-pushed the fix_dbf_allowed_field_length branch from 7e754b5 to 9c07906 Compare October 18, 2024 11:27
@notguiltyspark
Copy link
Contributor Author

Fixed previous review-remarks and incapsulated setting length values to the format-specific method, in case extension to other formats and format-specific behaviour will be needed.

New ui version looks like this:
image

@notguiltyspark notguiltyspark force-pushed the fix_dbf_allowed_field_length branch from 9c07906 to 63d1f82 Compare October 18, 2024 11:46
Copy link

github-actions bot commented Oct 18, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 63d1f82)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 63d1f82)

Copy link

github-actions bot commented Nov 2, 2024

The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check

  • that all unit tests are passing

  • that all comments by reviewers have been addressed

  • that there is enough information for reviewers, in particular

    • link to any issues which this pull request fixes

    • add a description of workflows which this pull request fixes

    • add screenshots if applicable

  • that you have written unit tests where possible
    In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request.
    If there is no further activity on this pull request, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Nov 2, 2024
Copy link

While we hate to see this happen, this PR has been automatically closed because it has not had any activity in the last 21 days. If this pull request should be reconsidered, please follow the guidelines in the previous comment and reopen this pull request. Or, if you have any further questions, just ask! We love to help, and if there's anything the QGIS project can do to help push this PR forward please let us know how we can assist.

@github-actions github-actions bot closed this Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Uh oh! Seems this work is abandoned, and the PR is about to close. Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants