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

Kart import --replace-existing with identical shapefile results in schema change #791

Closed
hamishcampbell opened this issue Feb 17, 2023 · 0 comments

Comments

@hamishcampbell
Copy link
Member

hamishcampbell commented Feb 17, 2023

Describe the bug

During testing of the import --replace-existing flag I've found that re-importing an identical shapefile appears to result in a schema change and a change to every feature. It was expected that I'd get an empty commit.

Similarly, if a minor change is made before re-importing, a schema change is applied and every feature modified. I would expect just the minor change to be applied.

To Reproduce
Steps to reproduce the behaviour:

mkdir test
kart import ~/Desktop/territorial-authorities-SHP/territorial-authorities.shp
kart import ~/Desktop/territorial-authorities-SHP/territorial-authorities.shp --replace-existing
kart show

Produces

commit 1f00c236cc3fc6dd1458a21768aa699c80629315
Author: Hamish Campbell <hn.campbell@gmail.com>
Date:   Fri Feb 17 13:55:25 2023 +1300

    Import from territorial-authorities.shp:territorial-authorities to territorial-authorities/

--- territorial-authorities:meta:schema.json
+++ territorial-authorities:meta:schema.json
  [
    {
      "id": "bbd5a5f7-a0a4-4ab6-9b5e-cbe0f5510811",
      "name": "auto_pk",
      "dataType": "integer",
      "primaryKeyIndex": 0,
      "size": 64
    },
-   {
-     "id": "9a0f10b3-b6d5-4c60-8d05-bbdb7dfdfeda",
-     "name": "geom",
-     "dataType": "geometry",
-     "geometryType": "MULTIPOLYGON",
-     "geometryCRS": "EPSG:2193"
-   },
-   {
-     "id": "d5f7531c-70a4-4167-9d33-ab0b59d8a720",
-     "name": "id",
-     "dataType": "text",
-     "length": 254
-   },
-   {
-     "id": "e9a6c4c7-929c-4c31-975b-6909cd0706ee",
-     "name": "name",
-     "dataType": "text",
-     "length": 254
-   },
+   {
+     "id": "d82007e8-2bff-40ea-830a-a0c19f838166",
+     "name": "geom",
+     "dataType": "geometry",
+     "geometryType": "MULTIPOLYGON",
+     "geometryCRS": "EPSG:2193"
+   },
+   {
+     "id": "019475cf-a1ce-4cf8-a4d3-cb75f6bfe418",
+     "name": "id",
+     "dataType": "text",
+     "length": 254
+   },
+   {
+     "id": "2b5793aa-57b6-4548-b524-efec23261786",
+     "name": "name",
+     "dataType": "text",
+     "length": 254
+   },
  ]
--- territorial-authorities:feature:1
-                                  auto_pk = 1
-                                     geom = MULTIPOLYGON(...)
-                                       id = 025
-                                     name = Whakatane District
--- territorial-authorities:feature:2
-                                  auto_pk = 2
-                                     geom = MULTIPOLYGON(...)
-                                       id = 027
-                                     name = Ōpōtiki District
--- territorial-authorities:feature:3
-                                  auto_pk = 3
-                                     geom = MULTIPOLYGON(...)
-                                       id = 029
-                                     name = Wairoa District
- ....etc...
-

Version Info

» kart --version                                                                                     ~/Kart/test 130 ↵
Kart v0.12.2, Copyright (c) Kart Contributors
» GDAL v3.6.2; PROJ v9.1.1; PDAL v2.4.3
» PyGit2 v1.9.0; Libgit2 v1.4.2; Git v2.38.1; Git LFS v3.3.0
» SQLAlchemy v1.4.45; pysqlite3 v2.6.0/v3.40.0; SpatiaLite v5.0.1; Libpq v14.0.4
Executed via helper, PID: 15068
olsen232 pushed a commit that referenced this issue Feb 17, 2023
Fix for #791 - Kart import --replace-existing with identical shapefile
results in schema change
olsen232 pushed a commit that referenced this issue Feb 17, 2023
Fix for #791 - Kart import --replace-existing with identical shapefile
results in schema change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants