Select to view content in your preferred language

AGOL Hosted Notebook Results

399
1
Jump to solution
12-07-2023 10:59 AM
gargarcia
New Contributor III

I developed a python script to check the geometry of line features and compare it to point features and make an error list out of lines who's ends don't touch the points. I run this script locally using my ArcGIS Pro python environment. I want to upload it to a hosted notebook on ArcGIS online to run as a scheduled task. When I ran the script in the hosted notebook I got different results than when I ran it locally. Both were run within seconds of each other on the same data, so the only difference was where it was run from. The script that ran in the hosted notebook selected all the features, but my local one correctly only selects the errors. Is there any good reason for getting a difference in results?

 

Notebook Difference.png

def check_endpoints(validation_line_layer_sedf, check_point_layer_sedfs, match_type='and'):
    errors = []
    for index, validation_line_row in validation_line_layer_sedf.iterrows():
        geometry = validation_line_row['SHAPE']
        start_point = geometry.first_point
        end_point = geometry.last_point

        start_match = end_match = False

        for check_point_layer_sedf in check_point_layer_sedfs:
            if (check_point_layer_sedf['SHAPE'].geom.equals(start_point)).any():
                start_match = True
            if (check_point_layer_sedf['SHAPE'].geom.equals(end_point)).any():
                end_match = True

        if match_type == 'and':
            if not (start_match and end_match):
                errors.append(validation_line_row)
        elif match_type == 'or':
            if not (start_match or end_match):
                errors.append(validation_line_row)
    return errors


water_main_errors = check_endpoints(water_main_sedf, water_main_check_sedfs, match_type='and')

 

0 Kudos
1 Solution

Accepted Solutions
gargarcia
New Contributor III

I solved the issue by switching the notebook runtime from standard to advanced. I did not use arcpy or any other advanced libraries not included in standard so I'm not 100% sure why that fixed it. I would have thought the notebook would have failed at some point instead of returning different results. I assume some library had a different version I needed.

View solution in original post

0 Kudos
1 Reply
gargarcia
New Contributor III

I solved the issue by switching the notebook runtime from standard to advanced. I did not use arcpy or any other advanced libraries not included in standard so I'm not 100% sure why that fixed it. I would have thought the notebook would have failed at some point instead of returning different results. I assume some library had a different version I needed.

0 Kudos