microsoft / USBuildingFootprints

Computer generated building footprints for the United States
Other
2.11k stars 263 forks source link

some polygons invalid #20

Closed darkblue-b closed 6 years ago

darkblue-b commented 6 years ago

after importing the California json set into PostGIS, testing for ST_Valid(geom) returns 193 invalids out of 10556550 rows.

msft_bldgs_invalids.tsv.zip

POSTGIS="2.4.3" PGSQL="100" GEOS="3.6.2-CAPI-1.10.2 4d2925d6" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.3.1, released 2018/06/22" LIBXML="2.9.3" LIBJSON="0.11.99" LIBPROTOBUF="1.2.1"

ogr2ogr -dim 2 -lco GEOMETRY_NAME=geom -lco SCHEMA=public -nln msft_ca_jun18 -nlt POLYGON -lco FID=gid -f PostgreSQL PG:dbname=msft_bldgs California.json -t_srs EPSG:4326

msft_bldgs-# COPY (select gid, st_asgeojson(geom) as geom from msft_ca_jun18 where not st_isvalid(geom)) to '/tmp/msft_bldgs_invalids.tsv' ;

jsdunn50 commented 6 years ago

Interesting

So 0.00183% of them are invalid ?

Regards.

Jeremy.

nitrif commented 6 years ago

We should have this check in place. We'll try it against the samples you provided and fix. Thanks.

darkblue-b commented 6 years ago

ah great news -- btw I like this paper on the topic fyi

About Invalid, Valid and Clean Polygons
Peter van Oosterom, Wilko Quak and Theo Tijssen
Delft University of Technology, The Netherlands
nitrif commented 6 years ago

Fixed in the latest release.

darkblue-b commented 5 years ago

team - new set of bldgs data for California shows an increase in these invalids feb-2019

msft_bldgs=# create table feb19_invalids as (select ogc_fid,geom from msft_ca_feb19 where not st_isvalid(geom));
NOTICE:  Ring Self-intersection at or near point -119.076734 35.415402999999998
NOTICE:  Self-intersection at or near point -117.386296 33.986578000000002
NOTICE:  Self-intersection at or near point -117.1690282188603 32.784222051773405
NOTICE:  Ring Self-intersection at or near point -118.256179 34.136153999999998
NOTICE:  Ring Self-intersection at or near point -117.83945900000001 34.114434000000003
NOTICE:  Self-intersection at or near point -115.52636200000001 34.516970000000001
NOTICE:  Self-intersection at or near point -118.15104103225235 34.166552000354422
NOTICE:  Self-intersection at or near point -122.271523 40.489851000000002
NOTICE:  Ring Self-intersection at or near point -120.368949 36.148878000000003
NOTICE:  Self-intersection at or near point -118.82645315503876 34.023635017226525
NOTICE:  Self-intersection at or near point -118.39956809884559 34.073387018567679
NOTICE:  Self-intersection at or near point -117.87930900668566 34.093952715859849
NOTICE:  Self-intersection at or near point -118.15263936898396 34.148645005347596
NOTICE:  Self-intersection at or near point -120.07173899845409 36.721275080386469
NOTICE:  Self-intersection at or near point -119.612751 36.753546999999998
NOTICE:  Self-intersection at or near point -119.24843401269597 34.270055017024141
NOTICE:  Self-intersection at or near point -117.93736899887085 34.045446103881439
NOTICE:  Self-intersection at or near point -118.13840582507943 34.020237604933662
NOTICE:  Self-intersection at or near point -118.08877100029373 34.055576979731711
NOTICE:  Self-intersection at or near point -122.27752603361058 41.231076000339506
NOTICE:  Self-intersection at or near point -117.128387 35.420909000000002
NOTICE:  Ring Self-intersection at or near point -121.404124 38.601194999999997
NOTICE:  Self-intersection at or near point -117.06367295762034 32.767922027186948
NOTICE:  Ring Self-intersection at or near point -122.26977599999999 40.165106999999999
NOTICE:  Ring Self-intersection at or near point -117.692986 35.589367000000003
NOTICE:  Self-intersection at or near point -120.97758599933253 37.674683953277267
NOTICE:  Ring Self-intersection at or near point -118.245364 34.218843999999997
NOTICE:  Self-intersection at or near point -118.40124400000001 34.152785069444448
NOTICE:  Self-intersection at or near point -117.97001599859617 33.830237932615816
NOTICE:  Self-intersection at or near point -118.31865000000001 33.78773001083033
NOTICE:  Self-intersection at or near point -121.41798502644143 38.340550705104661
NOTICE:  Self-intersection at or near point -122.39994199967715 37.652617027442041
NOTICE:  Self-intersection at or near point -119.4686010225909 36.183771119308155
NOTICE:  Ring Self-intersection at or near point -121.70714700000001 36.940446999999999
NOTICE:  Self-intersection at or near point -117.190929 32.835073999999999
NOTICE:  Ring Self-intersection at or near point -118.56584599999999 34.078259000000003
NOTICE:  Self-intersection at or near point -121.42484909818461 38.540784267685844
NOTICE:  Self-intersection at or near point -117.00633799880539 32.738465111099046
NOTICE:  Ring Self-intersection at or near point -117.971194 35.122920000000001
NOTICE:  Ring Self-intersection at or near point -122.235024 38.107346999999997
NOTICE:  Self-intersection at or near point -118.24239799999999 33.894502000000003
NOTICE:  Self-intersection at or near point -116.34489600000001 33.719872000000002
NOTICE:  Self-intersection at or near point -117.88510099901137 34.109977073158674
NOTICE:  Self-intersection at or near point -121.2987847775518 38.75956385318419
NOTICE:  Self-intersection at or near point -119.924537 36.239708999999998
NOTICE:  Self-intersection at or near point -118.451341 35.126666999999998
NOTICE:  Self-intersection at or near point -118.45376599836501 34.169962054772121
NOTICE:  Self-intersection at or near point -119.74045599999999 36.402939000000003
NOTICE:  Ring Self-intersection at or near point -120.280845 38.001345999999998
NOTICE:  Ring Self-intersection at or near point -117.902828 34.108975000000001
NOTICE:  Self-intersection at or near point -119.79789504402515 36.791004999999998
NOTICE:  Ring Self-intersection at or near point -121.352 38.170189999999998
NOTICE:  Ring Self-intersection at or near point -117.890812 33.7258
NOTICE:  Ring Self-intersection at or near point -118.32844299999999 33.897986000000003
NOTICE:  Self-intersection at or near point -118.28405099970834 33.942088035290688
NOTICE:  Self-intersection at or near point -119.10567899999999 34.329389999999997
NOTICE:  Self-intersection at or near point -122.54988171774193 38.404280564516128
NOTICE:  Self-intersection at or near point -121.00680008 37.652518000000001
NOTICE:  Self-intersection at or near point -118.19056087770228 33.946137272390366
NOTICE:  Self-intersection at or near point -118.301174 33.828797999999999
NOTICE:  Self-intersection at or near point -117.21097299928384 33.670542024826922
NOTICE:  Self-intersection at or near point -121.33875095239567 38.786752999381761
NOTICE:  Self-intersection at or near point -121.47459094 38.317055205000003
NOTICE:  Self-intersection at or near point -118.46714103773347 34.185465000251554
NOTICE:  Self-intersection at or near point -117.15797108163265 32.748773999999997
NOTICE:  Self-intersection at or near point -118.38867326519522 34.051726001699969
NOTICE:  Self-intersection at or near point -118.36534 33.954521999999997
NOTICE:  Self-intersection at or near point -122.1667230324509 37.734492043552521
NOTICE:  Self-intersection at or near point -121.30598743367827 38.688072867356539
NOTICE:  Ring Self-intersection at or near point -118.38060900000001 33.961787000000001
NOTICE:  Ring Self-intersection at or near point -118.298689 33.953702
NOTICE:  Self-intersection at or near point -117.18315934990594 34.067007996237571
SELECT 72