marineenergy / apps

shiny apps for MHK-env
https://marineenergy.github.io/apps/
MIT License
3 stars 1 forks source link

`oil-gas-lease` throwing spatial error: Self-intersection at or near point ... #70

Closed bbest closed 2 years ago

bbest commented 2 years ago
tab..._shp_within_aoi(dataset_code='oil-gas-lease', aoi_wkt='POLYGON ((-97.39714 24.15911, -97.39714 37.64227, -75.1278 37.64227, -75.1278 24.15911, -97.39714 24.15911))')
Warning: Error in : Problem with `mutate()` column `sp_data`.
ℹ `sp_data = map(code, get_spatial_intersection, aoi_wkt = aoi_wkt)`.
x Failed to fetch row: ERROR:  lwgeom_intersection: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -163.00000206734327 25.389757947825256 at -163.00000206734327 25.389757947825256
bbest commented 2 years ago

Added ST_MakeValid(geometry) to select_sql column in spatial | marineenergy.app - Google Sheets

select
        prot_numbe as protraction_num, 
        prot_aprv_ as protraction_aprv, 
        block_numb as block_num, 
        blk_fed_ap::date as block_fed_aprv, 
        mms_region, 
        mms_plan_a as mms_plan_area, 
        geometry
from (
        select
                prot_numbe, prot_aprv_, block_numb, blk_fed_ap, mms_region, mms_plan_a, geometry
        from shp_blk_clip
        UNION
        select
                prot_numbe, prot_aprv_, block_numb, blk_fed_ap, mms_region, mms_plan_a, geometry
        from "shp_PC_BLK_CLIP"
        UNION
        select 
                prot_numbe, prot_aprv_, block_numb, blk_fed_ap, mms_region, mms_plan_a, geometry
        from "shp_ATL_BLKCLP"
        UNION
        select
                prot_numbe, prot_aprv_, block_numb, blk_fed_ap, mms_region, mms_plan_a, ST_MakeValid(geometry) AS geometry
        from "shp_AK_BLKCLP")
bbest commented 2 years ago

Woops, above SQL is from dataset ocs-lease-blk