The Internet of Production Alliance

Preliminary data report for the OKW Map of Machines¶

Author: Antonio de Jesus Anaya Hernandez, DevOps eng. for the IoPA.

Author: The internet of Production Alliance, 2023.

Data was collected by "Fab Foundation", location: https://fablabs.io/

The Open Know Where (OKW) Standard is part of the Internet of Production Alliance and its members.

License: CC BY SA

CC BY SA

In [1]:
import pandas as pd
import os
from datetime import datetime
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
#!pip install folium
import folium
from folium.plugins import HeatMap, MiniMap, FloatImage, Search, LocateControl, MarkerCluster, FastMarkerCluster
from IPython.display import display, HTML
# import geopandas as gpd
import json
In [2]:
geoloc_machines = pd.read_csv('geomachines.csv').drop(columns=['city', 'county', 'Unnamed: 0']).dropna()
In [3]:
display(HTML(geoloc_machines.head(10).to_html(notebook=True)))
name brand slug class_1 lab country_code latitude longitude
0 ultimaker 2 ultimaker thebeachlab three_d_printer The Beach Lab x Europe ES 41.256795 1.857121
1 kinect v1 microsoft thebeachlab scanner The Beach Lab x Europe ES 41.256795 1.857121
2 gx-24 roland thebeachlab vinyl_cutting The Beach Lab x Europe ES 41.256795 1.857121
3 mdx-20 roland thebeachlab precision_milling The Beach Lab x Europe ES 41.256795 1.857121
4 imodela roland thebeachlab precision_milling The Beach Lab x Europe ES 41.256795 1.857121
5 othermill other machine co thebeachlab precision_milling The Beach Lab x Europe ES 41.256795 1.857121
6 5th gen 40w/45w laser full spectrum laser thebeachlab laser The Beach Lab x Europe ES 41.256795 1.857121
7 fireball v90 probotix thebeachlab cnc_milling The Beach Lab x Europe ES 41.256795 1.857121
8 ultimaker 2 ultimaker fablabiedmadrid three_d_printer Fab Lab IED Madrid ES 40.390583 -3.729061
9 prusa i3 reprap fablabiedmadrid three_d_printer Fab Lab IED Madrid ES 40.390583 -3.729061
In [4]:
unique_values = geoloc_machines['class_1'].unique()

# create an empty dictionary to store dataframes
machines_bytype = {}
geojson = {}

# iterate over unique values and create new dataframes
for value in unique_values:
    machines_bytype[value] = geoloc_machines[geoloc_machines['class_1'] == value]
    # geojson[value] = gpd.GeoDataFrame(machines_bytype[value], geometry=gpd.points_from_xy(machines_bytype[value].longitude, machines_bytype[value].latitude))
In [5]:
for value in machines_bytype.values():
    display(HTML(value.head(5).to_html(notebook=True)))
name brand slug class_1 lab country_code latitude longitude
0 ultimaker 2 ultimaker thebeachlab three_d_printer The Beach Lab x Europe ES 41.256795 1.857121
8 ultimaker 2 ultimaker fablabiedmadrid three_d_printer Fab Lab IED Madrid ES 40.390583 -3.729061
9 prusa i3 reprap fablabiedmadrid three_d_printer Fab Lab IED Madrid ES 40.390583 -3.729061
13 form 1+ formlabs fablabiedmadrid three_d_printer Fab Lab IED Madrid ES 40.390583 -3.729061
15 deltawasp 3mt wasp fablabiedmadrid three_d_printer Fab Lab IED Madrid ES 40.390583 -3.729061
name brand slug class_1 lab country_code latitude longitude
1 kinect v1 microsoft thebeachlab scanner The Beach Lab x Europe ES 41.256795 1.857121
24 kinect v1 microsoft fablabtrivandrum scanner FABLAB KERALA - Trivandrum IN 8.557167 76.880297
39 kinect v1 microsoft fablabcochin scanner Super Fablab - Kerala IN 10.055420 76.354695
54 kinect v1 microsoft fablabkamplintfort scanner FabLab Kamp-Lintfort DE 51.499970 6.545330
62 sense 3d scanner 3d systems, inc fablabjordan scanner TechWorks Amman JO 31.971502 35.832792
name brand slug class_1 lab country_code latitude longitude
2 gx-24 roland thebeachlab vinyl_cutting The Beach Lab x Europe ES 41.256795 1.857121
11 camm-1 gs-24 roland fablabiedmadrid vinyl_cutting Fab Lab IED Madrid ES 40.390583 -3.729061
25 gx-24 roland fablabtrivandrum vinyl_cutting FABLAB KERALA - Trivandrum IN 8.557167 76.880297
40 gx-24 roland fablabcochin vinyl_cutting Super Fablab - Kerala IN 10.055420 76.354695
65 camm-1 gs-24 roland fablabjordan vinyl_cutting TechWorks Amman JO 31.971502 35.832792
name brand slug class_1 lab country_code latitude longitude
3 mdx-20 roland thebeachlab precision_milling The Beach Lab x Europe ES 41.256795 1.857121
4 imodela roland thebeachlab precision_milling The Beach Lab x Europe ES 41.256795 1.857121
5 othermill other machine co thebeachlab precision_milling The Beach Lab x Europe ES 41.256795 1.857121
10 srm-20 monofab roland fablabiedmadrid precision_milling Fab Lab IED Madrid ES 40.390583 -3.729061
19 mdx-20 roland fablabuni precision_milling Fab Lab UNI PE -12.020751 -77.051119
name brand slug class_1 lab country_code latitude longitude
6 5th gen 40w/45w laser full spectrum laser thebeachlab laser The Beach Lab x Europe ES 41.256795 1.857121
12 speedy 100 trotec fablabiedmadrid laser Fab Lab IED Madrid ES 40.390583 -3.729061
22 legend 36ext epilog laser fablabuni laser Fab Lab UNI PE -12.020751 -77.051119
28 speedy 100 trotec fablabtrivandrum laser FABLAB KERALA - Trivandrum IN 8.557167 76.880297
43 speedy 100 trotec fablabcochin laser Super Fablab - Kerala IN 10.055420 76.354695
name brand slug class_1 lab country_code latitude longitude
7 fireball v90 probotix thebeachlab cnc_milling The Beach Lab x Europe ES 41.256795 1.857121
14 tec cam 1000 perez camps fablabiedmadrid cnc_milling Fab Lab IED Madrid ES 40.390583 -3.729061
18 shopbot gantry shopbot tools, inc fablabuni cnc_milling Fab Lab UNI PE -12.020751 -77.051119
26 shopbot gantry shopbot tools, inc fablabtrivandrum cnc_milling FABLAB KERALA - Trivandrum IN 8.557167 76.880297
41 shopbot gantry shopbot tools, inc fablabcochin cnc_milling Super Fablab - Kerala IN 10.055420 76.354695
name brand slug class_1 lab country_code latitude longitude
29 gw instek gpd-3303d power supply gw instek fablabtrivandrum other FABLAB KERALA - Trivandrum IN 8.557167 76.880297
31 ds-1100 digital storage oscilloscope for 100 m... unisource fablabtrivandrum other FABLAB KERALA - Trivandrum IN 8.557167 76.880297
32 afg-2125 - function generator, arbitrary / di... gw instek fablabtrivandrum other FABLAB KERALA - Trivandrum IN 8.557167 76.880297
33 tob-135 deluxe convection toaster oven broiler... cuisinart fablabtrivandrum other FABLAB KERALA - Trivandrum IN 8.557167 76.880297
34 station 50/60w 120v wes51 weller fablabtrivandrum other FABLAB KERALA - Trivandrum IN 8.557167 76.880297
name brand slug class_1 lab country_code latitude longitude
1214 qbot minimill qbot gmbh NOIMakerSpace circuit_production NOI Techpark Maker Space IT 46.478455 11.332509
In [6]:
point_max = (geoloc_machines.latitude.max(),  geoloc_machines.longitude.max())
point_min = (geoloc_machines.latitude.min(),  geoloc_machines.longitude.min())

machines_map = folium.Map(tiles=None, prefer_canvas=False)
folium.raster_layers.TileLayer(tiles='cartodbpositron', name='Basic', control=False).add_to(machines_map)
machines_map.fit_bounds((point_min, point_max))
In [7]:
create_cluster_icon = '''
    function(cluster) {
    return L.divIcon({html:'<p class="centered" style="color: black; line-height: 25px; text-align: center;"> <strong>' + cluster.getChildCount() + '</strong></p>',
                      className: 'marker-cluster marker-cluster-small',
                      iconSize: new L.Point(20, 20)});
    }'''
In [8]:
marker_cluster = MarkerCluster(name="Machines", icon_create_function=create_cluster_icon, control=False).add_to(machines_map)
In [9]:
type(geojson)
Out[9]:
dict
In [10]:
colors = ['#7F3C8D','#11A579','#3969AC','#F2B701','#E73F74','#80BA5A','#E68310','#008695','#CF1C90','#f97b72','#4b4b8f','#A5AA99']
layers = {}

icon = '<i class="fas fa-circle" style="color: {color};"></i>'

for index, (key, data) in enumerate(machines_bytype.items()):
    
    data.crs = "EPSG:4326"
    
    group = folium.plugins.FeatureGroupSubGroup(marker_cluster, icon.format(color=colors[index]) + ' ' + key.title().replace("_", " ") )
    
    print(group.__dir__)
    
    layers[key] = group
    # name', 'brand', 'slug', 'class_1', 'edited', 'lab', 'country_code', 'latitude', 'longitude'
    
    for indx, row in data.iterrows():
        
        popup = f"""
            <div style="padding: 5px; width: 200px">
                <p><strong>Name:</strong>\t {row['name'].title()}</p>
                <p><strong>Brand:</strong>\t {row['brand'].title()}</p>
                <p><strong>Type:</strong>\t {row['class_1'].title().replace("_", " ")}</p>
                <p><strong>Lab:</strong>\t {row['lab']}</p>
                <p><strong>Lat, Lon:</strong>\t {row['latitude'],row['longitude'] }</p>
                <img src="https://fablabs.io/assets/logo-78c5ba6a9895eaf5debdd08d9856b62703ebf0658507f6972742505cb1f75a7b.svg" style="max-width: 80px;"/>
            </div>
        """
        
        marker = folium.CircleMarker(location=[row.latitude, row['longitude']],
                                                       radius=4, 
                                                       fill_color=colors[index], 
                                                       opacity=0.4, 
                                                       color=colors[index], 
                                                       weight=10,
                                                       popup=popup)
        marker.add_to(group)
    machines_map.add_child(group)
<built-in method __dir__ of FeatureGroupSubGroup object at 0x0000020F75C88460>
<built-in method __dir__ of FeatureGroupSubGroup object at 0x0000020F75C69D30>
<built-in method __dir__ of FeatureGroupSubGroup object at 0x0000020F70137A90>
<built-in method __dir__ of FeatureGroupSubGroup object at 0x0000020F70137BE0>
<built-in method __dir__ of FeatureGroupSubGroup object at 0x0000020F70137A60>
<built-in method __dir__ of FeatureGroupSubGroup object at 0x0000020F75CE12B0>
<built-in method __dir__ of FeatureGroupSubGroup object at 0x0000020F75CE1940>
<built-in method __dir__ of FeatureGroupSubGroup object at 0x0000020F75CE12E0>
In [11]:
logo_url = 'https://github.com/kny5/data_reports/raw/main/assets/img/iopa_logo_okw.png'
logo_size = (10, 10)
icon = folium.features.CustomIcon(logo_url, icon_size=logo_size)
span = 1
float_image = FloatImage(logo_url, bottom=span, left=span, width=logo_size[0], height=logo_size[1])
machines_map.add_child(float_image)

minimap = MiniMap()
machines_map.add_child(minimap)

loc_ctrl = LocateControl(zindex=50)
machines_map.add_child(loc_ctrl)

map_control = folium.LayerControl(collapsed=False, autoZIndex=False)

machines_map.add_child(map_control)
Out[11]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [12]:
machines_map.save("mapof_machines.html")
In [ ]: