openaddresses / machine

Scripts for running OpenAddresses on a complete data set and publishing the results.
http://results.openaddresses.io/
ISC License
97 stars 36 forks source link

Handle Null GeoJSON Properties Field #671

Open ingalls opened 7 years ago

ingalls commented 7 years ago
 {"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-71.180681,42.9028365],[-71.1803247,42.9028607],[-71.1801864,42.9025815],[-71.1801912,42.9025801],[-71.1801972,42.9025783],[-71.1802032,42.9025764],[-71.1802091,42.9025745],[-71.180215,42.9025724],[-71.1802209,42.9025703],[-71.1802267,42.9025681],[-71.1802324,42.9025658],[-71.1802381,42.9025635],[-71.1802437,42.9025611],[-71.1802493,42.9025586],[-71.1802548,42.902556],[-71.1802602,42.9025534],[-71.1802656,42.9025507],[-71.1802709,42.902548],[-71.1802762,42.9025451],[-71.1802814,42.9025422],[-71.1802865,42.9025393],[-71.1802915,42.9025362],[-71.1802965,42.9025331],[-71.1803014,42.90253],[-71.1803062,42.9025268],[-71.180311,42.9025235],[-71.1803156,42.9025201],[-71.1803202,42.9025167],[-71.1803247,42.9025133],[-71.1803291,42.9025098],[-71.1803335,42.9025062],[-71.1803377,42.9025026],[-71.1803419,42.9024989],[-71.180346,42.9024951],[-71.1803499,42.9024913],[-71.1803538,42.9024875],[-71.1803576,42.9024836],[-71.1803614,42.9024797],[-71.180365,42.9024757],[-71.1803685,42.9024717],[-71.1803719,42.9024676],[-71.1803753,42.9024635],[-71.1803785,42.9024593],[-71.1803816,42.9024551],[-71.1803846,42.9024509],[-71.1803876,42.9024466],[-71.1803904,42.9024423],[-71.1803931,42.902438],[-71.1803958,42.9024336],[-71.1803983,42.9024292],[-71.1804007,42.9024247],[-71.180403,42.9024202],[-71.1804052,42.9024157],[-71.1804073,42.9024112],[-71.1804093,42.9024066],[-71.1804103,42.9024041],[-71.180681,42.9028365]]]},"properties":null}

Machine currently chokes if a properties value is set to null as the one above.

Relevant code: https://github.com/openaddresses/machine/blob/master/openaddr/conform.py#L808-L819

PR Showing this behavior: https://github.com/openaddresses/openaddresses/pull/3472/files#diff-aae27130822df4c8d527944d4f0c7cacR33

cc/ @migurski @NelsonMinar

NelsonMinar commented 7 years ago

Something like if row is None: row = {} should fix this.