def esri2geojson(esri_url, geojson_path):
    workdir = mkdtemp(prefix='esri2geojson-')
    ogr.UseExceptions()

    try:
        task = EsriRestDownloadTask('esri')
        (csv_path, ) = task.download([esri_url], workdir)

        _L.info('Saved {esri_url} to {csv_path}'.format(**locals()))
    
        vrt_path = write_vrt_file(csv_path)
    
        ds_in = ogr.Open(vrt_path)
        driver = ogr.GetDriverByName('GeoJSON')
    
        if exists(geojson_path):
            remove(geojson_path)
    
        ds_out = driver.CopyDataSource(ds_in, geojson_path)
        ds_out.Release()

        _L.info('Converted {csv_path} to {geojson_path}'.format(**locals()))
    
    finally:
        rmtree(workdir)

        _L.info('Removed {workdir}'.format(**locals()))
Convert single ESRI feature service URL to GeoJSON file.
dataset/ETHPy150Open openaddresses/machine/openaddr/util/esri2geojson.py/esri2geojson