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

Include geographical data #56

Open
ThangLeQuoc opened this issue Jun 3, 2024 · 4 comments · May be fixed by #64
Open

Include geographical data #56

ThangLeQuoc opened this issue Jun 3, 2024 · 4 comments · May be fixed by #64
Assignees

Comments

@ThangLeQuoc
Copy link
Owner

ThangLeQuoc commented Jun 3, 2024

Include geographical data
Geographical data referenced from daohoangson/dvhcvn repository, his repository GIS resource is awesome. Don't hesitate to give his amazing repository a star as well

@trungnam003
Copy link

Up

@ThangLeQuoc ThangLeQuoc self-assigned this Jul 22, 2024
@ThangLeQuoc
Copy link
Owner Author

ThangLeQuoc commented Aug 3, 2024

Feature is actively developed on branch integrate_gis_data, will ship it to the release soon
Sneak peak:
image

@ThangLeQuoc
Copy link
Owner Author

ThangLeQuoc commented Aug 17, 2024

When trying to check the validity of geom records, there are some records failed the check
MySQL

SELECT *
FROM vn_gis vg 
WHERE ST_IsValid(gis_geom) IS FALSE;
image

The result is the same for Microsoft SQL Server, so we need to take time looking into the faulty geo record issue.

@ThangLeQuoc
Copy link
Owner Author

ThangLeQuoc commented Aug 17, 2024

Using PostGis ST_IsValidReason reveal the following problem to the multipolygon

SELECT vn_gis.code, vn_gis."level", ST_IsValidReason(gis_geom)
FROM vn_gis
WHERE ST_IsValid(gis_geom) IS FALSE;
code level st_isvalidreason
184 district Ring Self-intersection[106.59603 21.99901]
617 district Self-intersection[108.001813 15.001936]
515 district Ring Self-intersection[108.001816 15.370833]
516 district Self-intersection[108.001813 15.002585]
511 district Self-intersection[108.001816 15.370833]
512 district Ring Self-intersection[108.001818 15.601409]
62 province Self-intersection[108.001813 15.001936]
645 district Self-intersection[108.001798 13.107198]
646 district Self-intersection[108.001798 13.106812]
639 district Ring Self-intersection[108.001801 13.600474]
660 district Ring Self-intersection[107.755919 11.998976]
661 district Self-intersection[107.755977 11.998976]
666 district Self-intersection[107.455934 11.998978]
667 district Self-intersection[107.455603 11.998978]
86 province Ring Self-intersection[106.074994 9.944899]

Validity rule of a Polygon

Some of the rules of polygon validity feel obvious, and others feel arbitrary (and in fact, are arbitrary).
- Polygon rings must close.
- Rings that define holes should be inside rings that define exterior boundaries.
- Rings may not self-intersect (they may neither touch nor cross themselves).
- Rings may not touch other rings, except at a point.
- Elements of multi-polygons may not touch each other.

Checking further, the self intersection look like this on the map
image

List of invalid geo_gis items:

SELECT *
FROM vn_gis vg 
WHERE code IN ('617','184','515','516','511','512','62','645','646','639','660','661','666','667','86');

@ThangLeQuoc ThangLeQuoc linked a pull request Sep 3, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants