machine icon indicating copy to clipboard operation
machine copied to clipboard

Fragile geometry transform with invalid points

Open migurski opened this issue 9 years ago • 5 comments

From http://s3.amazonaws.com/data.openaddresses.io/runs/123587/output.txt

2016-11-05 06:22:51,727  WARNING: Error doing conform; skipping
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/openaddr/__init__.py", line 185, in conform
    csv_path, addr_count = task4.convert(data, decompressed_paths, workdir)
  File "/usr/local/lib/python3.4/dist-packages/openaddr/conform.py", line 501, in convert
    rc = conform_cli(source_definition, source_path, dest_path)
  File "/usr/local/lib/python3.4/dist-packages/openaddr/conform.py", line 1057, in conform_cli
    extract_to_source_csv(source_definition, source_path, extract_path)
  File "/usr/local/lib/python3.4/dist-packages/openaddr/conform.py", line 1004, in extract_to_source_csv
    ogr_source_to_csv(source_definition, ogr_source_path, extract_path)
  File "/usr/local/lib/python3.4/dist-packages/openaddr/conform.py", line 624, in ogr_source_to_csv
    geom.Transform(coordTransform)
  File "/usr/lib/python3/dist-packages/osgeo/ogr.py", line 4621, in Transform
    return _ogr.Geometry_Transform(self, *args)
TypeError: in method 'Geometry_Transform', argument 2 of type 'OSRCoordinateTransformationShadow *'

migurski avatar Nov 05 '16 17:11 migurski

I'm pretty sure this shows up when proj can't parse the .prj file included in a shapefile. There's a bit more error reporting we can get out of OGR that would be helpful to include, too.

iandees avatar Nov 05 '16 17:11 iandees

Here is some additional error output from a more-recent run:

2016-11-20 00:12:09,742    DEBUG: Selected /tmp/worker-3c10_w5q/work-vbsq607t/out/process_one-d50qgv2c/conform-fuq8d54f/unzipped/SPAD.shp for source
2016-11-20 00:12:09,742    DEBUG: extract temp file /tmp/openaddr-extracted-wuz6wnjo.csv
2016-11-20 00:12:09,751     INFO: Converting a layer to CSV: SPAD
2016-11-20 00:12:09,751    DEBUG: Assuming shapefile data is encoded utf-8
2016-11-20 00:12:09,939    ERROR: GDAL gave Failure 6: No translation for Mercator_Auxiliary_Sphere to PROJ.4 format is known.

(Same error as above follows)

migurski avatar Nov 20 '16 19:11 migurski

Based on this StackOverflow answer the error that GDAL is giving here:

Failure 6: No translation for Mercator_Auxiliary_Sphere to PROJ.4 format is known

Is because the exporter they're using (probably FME or similar) is writing out an invalid .prj file. We could probably fix this by allowing the srs attribute on conform to override the projection of the source, even if its specified in a .prj. This should probably be a machine bug/feature.

iandees avatar Dec 28 '16 15:12 iandees

Would that be the same as #500, then?

migurski avatar Dec 28 '16 16:12 migurski

I don't think the issues are the same, but implementing #500 would allow us to manually override the bad SRS with one that we know.

iandees avatar Dec 28 '16 16:12 iandees