Fixing Geometry Errors

Has anyone put together a list of "x error can be fixed by doing y" for geometry errors?
I ask this because I am in the middle of writting code to fix geometry errors within a database from imported ESRI-based data. Presently I have the code to find all errors, and can fix:
13349 and 13366
Fix with a self union (same geometry twice): SDO_GEOM.SDO_UNION
13356
Fix with the new SDO_UTIL.REMOVE_DUPLICATE_VERTICES function.
I started with these, since they are most pervasive.
Obviously, some errors like 13351 and 13350 are harder, since the code actually needs to slightly alter the original data (move the rings or touching points) to remove the errors.

Bryan,
I have a ShapeCheck routine in PL/SQL that I have deployed in the past databases as a dbms_job...
I have a number of versions depending on how you want the errors to be reported: one via SMTP_UTL for emailing, another writes answers to a table for visualisation with Application Express.
If you want a copy email me at simon at spatialdbadvisor dot com
Or.... here it is...
DEFINE defaultSchema='&1'
set serverout on SIZE 1000000
DROP PROCEDURE ShapeCheck;
DROP TABLE ALL_FEATURE_ERROR;
CREATE TABLE ALL_FEATURE_ERROR (
owner VARCHAR2(30),
table_name VARCHAR2(30),
column_name VARCHAR2(30),
feature_rowid VARCHAR2(20),
error_code VARCHAR2(10),
error_status CHAR(1),
error_context VARCHAR2(2000),
error_date DATE
grant insert,update,delete,select on all_feature_error to public;
CREATE PROCEDURE ShapeCheck( p_schema IN VARCHAR2,
p_tableName IN VARCHAR2,
p_shapeName IN VARCHAR2,
p_whereClause IN VARCHAR2)
AUTHID CURRENT_USER
IS
v_shape MDSYS.SDO_GEOMETRY;
c_shape MDSYS.SDO_GEOMETRY;
v_OwnerName VARCHAR2(30);
v_TableName VARCHAR2(30);
v_ColumnName VARCHAR2(30);
c_rowid ROWID;
v_error_code ALL_FEATURE_ERROR.ERROR_CODE%TYPE;
v_error_status ALL_FEATURE_ERROR.ERROR_STATUS%TYPE;
v_error_context ALL_FEATURE_ERROR.ERROR_CONTEXT%TYPE;
v_error_count number;
v_error_found number;
v_fixed_count number;
v_count number;
v_diminfo MDSYS.SDO_DIM_ARRAY;
v_start_date DATE;
v_end_date DATE;
v_tolerance number;
v_query varchar2(1024);
TYPE shapeCursorType IS REF CURSOR;
shapeCursor shapeCursorType;
BEGIN
v_TableName := UPPER(p_tablename);
v_OwnerName := UPPER(p_schema);
v_ColumnName := UPPER(p_ShapeName);
BEGIN -- In case get NO_DATA_FOUND
SELECT diminfo
INTO v_diminfo
FROM ALL_SDO_GEOM_METADATA
WHERE owner = v_OwnerName and table_name = v_TableName and column_name = v_ColumnName;
EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('No diminfo found in all_sdo_geom_metadata for '||v_OwnerName||'.'||v_TableName||'.'||v_ColumnName);
RETURN;
END;
v_tolerance := v_diminfo(1).sdo_tolerance;
v_count := 0;
v_error_count := 0;
v_fixed_count := 0;
IF ( p_whereClause is not null ) THEN
v_query := 'SELECT ROWID,' ||v_ColumnName|| ' FROM ' ||v_OwnerName|| '.' ||v_TableName|| ' WHERE ' ||p_whereClause;
ELSE
v_query := 'SELECT ROWID,' ||v_ColumnName|| ' FROM ' ||v_OwnerName|| '.' ||v_TableName;
END IF;
v_start_date := SYSDATE;
OPEN shapeCursor
FOR v_query;
LOOP
FETCH shapeCursor INTO c_rowid, c_shape;
EXIT WHEN shapeCursor%NOTFOUND;
IF ( c_shape IS NULL ) THEN
v_error_code := 'NULL';
ELSE
v_error_code := SUBSTR(MDSYS.SDO_GEOM.VALIDATE_GEOMETRY( c_shape, v_diminfo ),1,5);
END IF;
IF ( v_error_code <> 'TRUE' ) THEN
v_error_count := v_error_count + 1;
v_error_status := 'E'; -- if exception raised in following block this will remain 'E'
IF ( v_error_code <> 'NULL' ) THEN
BEGIN -- Exception block in case any of the functions trying to fix the shape fail...
IF ( v_error_code = '13356' ) THEN
v_shape := mdsys.sdo_util.remove_duplicate_vertices(c_shape,v_tolerance);
ELSIF c_shape.sdo_gtype in (2003,3007) THEN -- only try to fix bad polygons
v_shape := mdsys.sdo_geom.sdo_union(c_shape,v_diminfo,c_shape,v_diminfo);
IF ( v_shape.sdo_gtype = 2004 ) THEN
v_shape := &&defaultSchema..geom.ExtractPolygon(v_shape);
END IF;
END IF;
-- Update shape to reflect whatever happened...
EXECUTE IMMEDIATE 'UPDATE ' || v_OwnerName||'.'||v_TableName || ' A SET A.'||v_ColumnName||' = :1 WHERE rowid = :2 '
USING v_shape,c_rowid;
-- Check whether it was corrected or not...
v_error_context := SUBSTR(MDSYS.SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(v_shape,v_diminfo),1,2000);
v_error_code := SUBSTR(v_error_context,1,5);
v_error_context := SUBSTR(v_error_context,6,2000);
IF v_error_code = 'TRUE' THEN
v_error_status := 'F';
v_fixed_count := v_fixed_count + 1;
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END IF; -- v_error_code = NULL
INSERT INTO &&defaultSchema..All_Feature_Error(owner,table_name,column_name,feature_rowid,error_code,error_status,error_context,error_date) VALUES (v_OwnerName,v_TableName,v_ColumnName,c_rowid,v_error_code,v_error_status,v_error_context,SYSDATE);
END IF;
END LOOP;
v_count := shapeCursor%ROWCOUNT;
CLOSE shapeCursor;
v_end_date := SYSDATE;
dbms_output.put_line('SHAPECHECK SUMMARY.');
dbms_output.put_line(' TABLE: ' || v_OwnerName||'.'||v_TableName||'.'||v_ColumnName);
dbms_output.put_line(' PROCESSING START: ' || to_char(v_start_date,'YYYY-MM-DD HH24:MM') );
dbms_output.put_line(' PROCESSING END: ' || to_char(v_end_date,'YYYY-MM-DD HH24:MM') );
dbms_output.put_line('FEATURES PROCESSED: ' || to_char(v_count) );
dbms_output.put_line('TOTAL ERRORS FOUND: ' || to_char(v_error_count) );
dbms_output.put_line('TOTAL ERRORS FIXED: ' || to_char(v_fixed_count) );
dbms_output.put_line('See table ALL_FEATURE_ERROR for list of errors');
END ShapeCheck;
show errors
grant execute on &&defaultSchema..ShapeCheck to public;
-- connect radtrain4@radtrain4@sdb1test
-- execute &&defaultSchema..shapecheck('RADTRAIN4','AB_LANDCLAIM','GEOMETRY',NULL);
-- VARIABLE jobno number;
-- BEGIN
-- DBMS_JOB.SUBMIT(:jobno,'&&defaultSchema..shapecheck(''RADTRAIN4'',''SP_PARCEL'',''GEOMETRY'',NULL)'',''[email protected],[email protected]'' );',SYSDATE,'next_day(sysdate,''SUNDAY'')' );
-- COMMIT;
-- END;
--

Similar Messages

  • Does anyone know how to fix an error in cc photoshop on Win8 that says puppet warp could not complete request due to program error?

    Does anyone know how to fix an error in cc photoshop on Win8 that says puppet warp could not complete request due to program error?

    Questions on using a specific program should go in that program forum
    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • I am having troubles, when I open LR I get a message that there is an error and it will try to fix the error next time it opens, but I get the error next time it opens, and this is going on and on where I can not use LR, any suggestions?

    I am having troubles, when I open LR I get a message that there is an error and it will try to fix the error next time it opens. LR closes on it's own, I reopen it and get that same message next time it opens, and this is going on and on where I can not use LR, any suggestions? If I click on a different set of photos in the libary before I get that message I might or might not get the message next time it oipens, but I still can not get to those photos, and it is not just one or two but most of my photos. HELP!!!!
    Thanks
    Carol

    The first thing I would suggest is for you to go to the folder containing your catalog, using your system browser. There will be a folder that has the extension .lrdata. Delete that folder, and then try to start Lightroom. If that doesn't work, replace your catalog with your most recent backup.

  • I recieve the following error when running an executable ("This VI is not Executable. The full development version of Labview is required to fix the errors"

    I recieve the following error when trying to build and run a labview executable. I am able to build the executable but when trying to run the executable, a pop up window comes up asking the user to select a dll. (please see screen shot attached). Once the DLL is selected, I get the error that This VI is not Executable. The full development version of Labview is required to fix the errors. (please see screen shot attached). I have also attached a snapshot of the project window.
    I have the professional development system
    I can run the main VI
    all the required DLL's are in the dependencies section of the project window.
    I am trying to find the root cause of this error but to no avail. can anyone give me a clue to what i am missing here. Any suggestions on where i should look to find the problem ?
    Thanks in advance to all labview users for your help
    Attachments:
    project window.PNG ‏36 KB

    other PNG
    Attachments:
    Broken Arrow on EXE.PNG ‏179 KB

  • How do I fix this error, Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modal session requires modal window'?

         I have been trying to start up my Batman: Arkham City game recently and it says that it cannot open and gives me this error;
                   "Terminating app due to uncaught exception 'NSInternalInconsistancyException', reason: 'Model session requires model window'"
         I have played the game for about 13 hours before this error started to pop up and I was wondering if anyone knew of a way to fix it.  Any information would be greatly appreaciated.

    Yesterday I had the same problem.
    I installed the game and played for five hours with no problem but in the last execution my iMac show me that error. I tried to uninstall and install the game again but always show me the error. I did the same with the Steam client with no solution.
    Finally I fixed the error deleting a folder.
    Go to Macintosh HD/Users/[username]/Library/Caches/com.feralinteractive.bmac
    and delete the folder named "com.plausiblelabs.crashreporter.data"
    Try to launch the game again.
    Good luck.

  • I keep receiving this error every time I open LR, "Lightroom encountered and error when reading from its preview cache and needs to quit" and the app won't open. It said LR would try and fix this error next time I opened it but the error remains. I tried

    I keep receiving this error every time I open LR, "Lightroom encountered and error when reading from its preview cache and needs to quit" and the app won't open. It said LR would try and fix this error next time I opened it but the error remains. I tried uninstalled and installing the app and the error remains. I have windows 8. Can anyone please help???

    Use Windows Explorer to open the folder containing your catalog. The normal location is Pictures\Lightroom. Locate a folder with the extension .lrdata and delete that folder. Then you should be able to start Lightroom again, and Lightroom will begin building and new previews folder. Do not delete anything else.

  • Lightroom crashes at start up with the error message "Lightroom encountered an error when reading from its preview cache and needs to quit".  Please advise on how to fix this error.  Thanks

    Lightroom crashes at start up with the error message "Lightroom encountered an error when reading from its preview cache and needs to quit".  Please advise on how to fix this error.  Thanks

    You probably need to delete your preview cache.  See here  
    Why And How To Clear Your Lightroom Cache - Lightroom Fanatic
    Preference and other file locations in Lightroom 5

  • When i tried to update my apps in the app store, i coudn't update because of particular error is irritating me whenever i try to update..[There was an error in the app store please try again later.(20)] Any one suggest me to fix this error soon.

    When i tried to update my apps in the app store, i coudn't update because of particular error is irritating me whenever i try to update..[There was an error in the app store please try again later.(20)] Any one suggest me how to fix this error soon.

    Yea i deleted all the apps which was purchased earlier with old Apple id ..and nw i installed all apps with my new apple id...Tanq for helping guys (Linc Davis and Dah•veed ).

  • How do I fix an error "4652747.png" when publishing my iWeb site to iMac?

    Every time I try to publish my iWeb site to .Mac I get an error message that says there's an error in " ...files/ca4652747.png." I know this is an image file, but when i search for it on my hard drive it shows a blank image. I've tried deleting the file from the hard drive but when I re-publish, a second file "c00ff001c.png" on a different web page shows the same error. I can't figure out how to fix these errors. It publishes to a folder, or so it says, but i don't know how to check that. I am supposed to publish the entire site at the end of this week and have all the work done but can't get past this point. Can anyone help me? I'm a new mac user and this is my first shot at web design, so I've probably missed something obvious, but would appreciate any help.

    k, try this:
    backup your domain file! delete the one in the folder BUT HAVE A COPY OF IT SOMEWHERE ELSE. Then open iWeb, create something save it and publish it!
    now go to your backuped file,make one more backup!!!!
    move one of the backuped files into the Users/username/bblablabla folder and open iWeb. try publish all and see if it works!
    max

  • How to fix this error message The backup disk image "/Volumes/AirPort Disk/FARES DEL VALLE's iMac.sparsebundle" could not be accessed (error -1).

    how to fix this error message The backup disk image “/Volumes/AirPort Disk/FARES DEL VALLE’s iMac.sparsebundle” could not be accessed (error -1).

    The troubleshooting C17 is the specific article.
    http://pondini.org/TM/Troubleshooting.html
    This is generally a Lion error.. and you will need 5.6 utility to get access to the disk area.
    So download the real utility. Run it instead of v6 toy version.
    http://support.apple.com/kb/DL1482
    Go to the manual setup, disk page and click on disconnect all users.. that will unmount all users connected to the disk and allow it to start working. But there are a number of other issues that are possible cause. Pondini lists some of them.

  • How to fix connection error on facebook via iphone 4s

    How to fix connection error on facebook via iphone 4s?

    I had the same problem for days. I reset the phone bu holding down the home button and the on off switch together. Don't swipe to turn off. Just hold down the two buttons until phone switched off then wait a few seconds and switch it back on. I can't also use Facebook on safari which I was also having problems with. Hope it helps

  • How to fix itunes error 1611 while restoring ios 4.3.2 , and when i restore to 4.2.1 the can be ok.plz help me

    how to fix itunes error 1611 while restoring ios 4.3.2 , and when i restore to 4.2.1 the can be ok.plz help me

    have a look at this support article.

  • How to fix vecter error

    how to fix vecter error  

    WB, welcome to the forum.
    When requesting help, you should always include the make/model of the computer and/or monitor. This information is necessary for us to review the specifications of the them.
    Signature:
    HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
    HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
    HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
    HP Photosmart 7520 AIO
    ++++++++++++++++++
    **Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
    Intelligence is God given; Wisdom is the sum of our mistakes!
    I am not an HP employee.

  • How to fix imessage error on ios8.1.2 .. Already reset network still same issue please help

    How to fix imessage error on ios8.1.2 .. Already reset network still same issue please help

    Hi ashmanryan36,
    Thanks for using Apple Support Communities. Based on what you stated, it sounds like you are having trouble with iMessage. It looks like you have already done some troubleshooting. I would recommend that you read these articles, they may be helpful in troubleshooting your issue.
    If you can't send or receive messages on your iPhone, iPad, or iPod touch - Apple Support
    You did not mention what the error was but since you are running 8.1.2 and update is available and my help. 
    Update the iOS software on your iPhone, iPad, and iPod touch - Apple Support
    Cheers,
    Mario

  • How to fix download error on Adobe Creative Cloud

    How to fix download error on Adobe Creative Cloud, I've reinstalled like three times and it's not working.

    Quit Creative Cloud desktop application  and close All Adobe applications.
    Follow below steps :
    Step 1 :
    1) Right click on Finder icon and  select "Go-To" Folder option.
    2) You will get a text box, type-in below command and then hit 'Return' key.( Do not miss ~ symbol)
    ~/library
    3)Then navigate to Application Support>Adobe
    Right click on Adobe folder and select "GetInfo" option.
    Expand the Sharing & Permissions section.
    Click the lock icon in the lower-right corner. Enter your administrator user name and password when prompted, and then click OK.
    Please click on '+' symbol , it will open list of user accounts. Add Currently logged in user name and Administrator option,
    Then provide "Read & Write" permission to Currently logged in user name and Administrator option,.
    Click the Gear icon, and select Apply to Enclosed Item. Close the Get Info dialog box.
    Step 2:
    1) Right click on Finder icon and  select "Go-To" Folder option.
    2) You will get a text box, type-in below command and then hit 'Return' key.
    /library
    3)Then navigate to Application Support>Adobe
    Right click on Adobe folder and select "GetInfo" option.
    Expand the Sharing & Permissions section.
    Click the lock icon in the lower-right corner. Enter your administrator user name and password when prompted, and then click OK.
    Please click on '+' symbol , it will open list of user accounts. Add Currently logged in user name and Administrator option,
    Then provide "Read & Write" permission to Currently logged in user name and Administrator option,.
    Click the Gear icon, and select Apply to Enclosed Item. Close the Get Info dialog box.
    Then launch Creative Cloud desktop application and check.

Maybe you are looking for