diff --git a/databases/fountains.db b/databases/fountains.db index 228921b..b0e90a8 100644 Binary files a/databases/fountains.db and b/databases/fountains.db differ diff --git a/databases/populatedb.py b/databases/populatedb.py index 4ee3ef5..5a7bcf8 100755 --- a/databases/populatedb.py +++ b/databases/populatedb.py @@ -8,28 +8,88 @@ KML = "{http://www.opengis.net/kml/2.2}" def iterate_kml(filepath): fp = open(filepath) parser = ET.XMLPullParser(["end"]) + autoincrement = 0 while True: chunk = fp.read(1024 * 8) parser.feed(chunk) for event, element in parser.read_events(): assert event == "end" if element.tag == f"{KML}Placemark": + autoincrement += 1 name = element.find(f".//{KML}name").text description = 'soon' #description = element.find(f".//{KML}description").text longitude, latitude, unknown = map( float, element.find(f".//{KML}coordinates").text.split(",") ) + yield { - "name": name, - "x": latitude, - "y": longitude, - "description": description, - } + "FMID": autoincrement, + "MarketName": name, + "Website": "https://deflax.net", + "Facebook": "https://facebook.com/page", + "Twitter": "tw_user", + "Youtube": "yt_user", + "OtherMedia": "om_user", + "street": "1 afxhq", + "city": "none", + "County": "none", + "State": "none", + "zip": "none", + "Season1Date": "1970-01-01", + "Season1Time": "", + "Season2Date": "", + "Season2Time": "", + "Season3Date": "", + "Season3Time": "", + "Season4Date": "", + "Season4Time": "", + "x": latitude, + "y": longitude, + "Location": description, + "Credit": "", + "WIC": "", + "WICcash": "", + "SFMNP": "", + "SNAP": "", + "Organic": "", + "Bakedgoods": "", + "Cheese": "", + "Crafts": "", + "Flowers": "", + "Eggs": "", + "Seafood": "", + "Herbs": "", + "Vegetables": "", + "Honey": "", + "Jams": "", + "Maple": "", + "Meat": "", + "Nursery": "", + "Nuts": "", + "Plants": "", + "Poultry": "", + "Prepared": "", + "Soap": "", + "Trees": "", + "Wine": "", + "Coffee": "", + "Beans": "", + "Fruits": "", + "Grains": "", + "Juices": "", + "Mushrooms": "", + "PetFood": "", + "Tofu": "", + "WildHarvested": "", + "updateTime": "" + } + if not chunk: break if __name__ == "__main__": db = sqlite_utils.Database("fountains.db") - db["locations"].insert_all(iterate_kml(sys.argv[-1])) \ No newline at end of file + + db["locations"].insert_all(iterate_kml(sys.argv[-1])) diff --git a/forestmapview.py b/forestmapview.py index 9677794..a56f9ef 100644 --- a/forestmapview.py +++ b/forestmapview.py @@ -39,7 +39,7 @@ class ForestMapView(MapView): def add_tree(self, tree): # Create TreeMarker - lat, lon = tree[1], tree[2] + lat, lon = tree[20], tree[21] treemarker = TreeMarker(lat=lat, lon=lon) treemarker.tree_data = treemarker @@ -47,5 +47,5 @@ class ForestMapView(MapView): self.add_widget(treemarker) # Keep track of the TreeMarker's name - name = tree[0] + name = tree[1] self.tree_names.append(name) diff --git a/treepopupmenu.py b/treepopupmenu.py index eb9ee0d..b8c3ad4 100644 --- a/treepopupmenu.py +++ b/treepopupmenu.py @@ -5,8 +5,8 @@ class TreePopupMenu(ListMDDialog): super().__init__() # Set all of the fields of tree data - headers = "Name,Lat,Lon,Description" - #headers = "FMID,MarketName,Website,Facebook,Twitter,Youtube,OtherMedia,street,city,County,State,zip,Season1Date,Season1Time,Season2Date,Season2Time,Season3Date,Season3Time,Season4Date,Season4Time,x,y,Location,Credit,WIC,WICcash,SFMNP,SNAP,Organic,Bakedgoods,Cheese,Crafts,Flowers,Eggs,Seafood,Herbs,Vegetables,Honey,Jams,Maple,Meat,Nursery,Nuts,Plants,Poultry,Prepared,Soap,Trees,Wine,Coffee,Beans,Fruits,Grains,Juices,Mushrooms,PetFood,Tofu,WildHarvested,updateTime" + #headers = "Name,Lat,Lon,Description" + headers = "FMID,MarketName,Website,Facebook,Twitter,Youtube,OtherMedia,street,city,County,State,zip,Season1Date,Season1Time,Season2Date,Season2Time,Season3Date,Season3Time,Season4Date,Season4Time,x,y,Location,Credit,WIC,WICcash,SFMNP,SNAP,Organic,Bakedgoods,Cheese,Crafts,Flowers,Eggs,Seafood,Herbs,Vegetables,Honey,Jams,Maple,Meat,Nursery,Nuts,Plants,Poultry,Prepared,Soap,Trees,Wine,Coffee,Beans,Fruits,Grains,Juices,Mushrooms,PetFood,Tofu,WildHarvested,updateTime" headers = headers.split(',') for i in range(len(headers)):