When no Building SQL Table exist, we parse geojson file and each building get's assigned and ID starting from 0.
When the app is ran again, the dbh gets recreated and numBuilding is initialized to zero. (as per the constructor). The app attempts to read the geojson file and add the buildings found to the database.
Database throws error since the buildings have already been added with the same ID.
Possible fixes:
initialize numBuilding to size of buildings table
have a flag to check whether the building sql table exists and only parse buildings.geojson if it doesn't
When no Building SQL Table exist, we parse geojson file and each building get's assigned and ID starting from 0. When the app is ran again, the dbh gets recreated and numBuilding is initialized to zero. (as per the constructor). The app attempts to read the geojson file and add the buildings found to the database. Database throws error since the buildings have already been added with the same ID.
Possible fixes: