jremillard / images-to-osm

Use Mask R-CNN/Keras/TensorFlow and OSM to find features in satellite images for fun.
MIT License
500 stars 84 forks source link

BingTiles download error fixed. #9

Open vaghawan opened 5 years ago

vaghawan commented 5 years ago

While trying to run python gettilesfrombing.py , it returns with the following error:

osm/soccer/250124836.GeoJSON Traceback (most recent call last):
  File "gettilesfrombing.py", line 44, in <module>
    tilePixel = quadkey.TileSystem.geo_to_pixel((float(row[0]),float(row[1])), cfg.tileZoom)
ValueError: could not convert string to float: '{"type": "FeatureCollection", "features": [{"geometry": {"coordinates": [[[-71.0508224, 42.3263835], [-71.0508827, 42.3258583], [-71.0496463, 42.3257808], [-71.049586, 42.326306], [-71.0508224, 42.3263835]]], "type": "Polygon"}, "properties": {"wayOSMId": 250124836, "sport": "soccer", "leisure": "pitch"}, "type": "Feature"}]}'

Because the code tries to read the csv hence assuming the osm dir only contains the .csv file, but GEOJson file too are in the directory, and when the loop stumbles on the GEOJson the above error throws. What I simply did is that I checked the fileformat type and only proceeded the loop, if it's fileformat is .csv . And it downloads the tiles accordingly without an error.