 So, for our next talk, we have someone special joining us. You know, so this person who I'm going to introduce is like one of the funniest people I know. And you know, I see I sometimes secretly wish I was him. So, so let's welcome that person now. Okay. Hello everyone. It's my talk right now. Thank you for that humbling introduction. My name is Sangarshan. I work at Grofus and it's pronounced grofus. So I like building imaginary projects in my head talking about those imaginary projects in my head. And, you know, I also love all those imaginary projects. So I'm going to be talking about one such case where that imaginary project actually got executed and which was amazing. So that is the story of this is the story of how I did that. So I'm going to begin by proclaiming my love for pandas. You know, whenever we want to work out whenever almost all of us want to work with data. We know we move to pandas and you know rightly so pandas is amazing. It's like the Tom Hanks of Python libraries. And of course, it rests on top of all these amazing. You know, packages which are present in the open source environment. These include, you know, matplotlib. We have NumPy. We have pandas. And then we have scikit-learn. You know, all these amazing open source packages from the scientific Python community makes Python the code to language when anyone wants to do anything with data. So we're going to talk about a special type of data, which is location data. Location data has location component linked with it. For example, I'm reading a CSV file over here, which has latitude and longitude. So this is essentially a location component. So a data with a location component can be represented as a geometry. And there are, so geometries are basically just X and Y coordinates and the various ways you can arrange them. So these geometries can be a pair of lat-longs or they can be a list of lat-longs, just a polygon. And also I am grossly over simplifying what geometries are and Euclid would be really angry with me right now. But we also have line strings, which are like line strings. And we have multi-polygons, which is a fancy plural word for polygons. And we also have circles. Now, to work with these geometries, we have this amazing package in the open source community called Geopandas. So with Geopandas, we can work with data frame. And in this case, a geodata frame. And, you know, we can stay with a familiar interface. And Geopandas will let us read and write commonly used geospatial formats, like, you know, KML files, shape files and geochasin files using the other library called Fiona. And then we also can perform different spatial operations, like merge, overlay and joints with the help of another amazing package called Shaping. And also, of course, the crux of the talk, we can plot them on a map with matplotlet. And also, I'm leaving a whole, whole lot of things which we can do with Geopandas, like, you know, handling projections and recently added stuff like vectorized operations with pygeos and also indexing your data with, you know, our trees or any other data structure. And if you are interested in knowing more, this is a tutorial link which I have attached here. I will share these slides on the, on the break room. And this, this tutorial has been made by the maintainer. So it's like pretty comprehensive and it's pretty amazing. All right, so moving on to data frame. So we have this data frame which I read before. And we have lat and lawn. So now we convert it into geodata frame. So how we do that is we import Geopandas and also we convert this lat and lawn column into a point. A point is a geometry. So we set geometry equals combination of these two columns. So it creates a column called geometry and it creates a point, a point geometry object using shapely. So this is that point. And also, on the second line, we are setting something called, you know, CRS. So CRS is the coordinate reference system. So this is how we project our earth in a way that we can understand and interpret. So in these cases, so in this case, we have used ES, EPST for 326, which is like the most commonly used coordinate reference system, which is also used by GPS systems and all the navigation systems. So this is the reason why lat, latitudes and longitudes have spatial meaning in them. If not, if you don't have coordinate reference system, they are just arbitrary x and y coordinates. They are not latitudes and longitudes. So how do I plot them? So with Geopandas, everything becomes really simple. It's just a dot plot. So you just do import map plot lat and then you just, you know, So to do interactive maps with Geopandas, we actually have to move away from Geopandas and into other amazing open source libraries, which are there for creating interactive maps. So how do we do that? Do that we employ the most powerful weapon a developer has, which is Googling. So that's what I did. I just Google for a while and you know, I actually got to know that Folium is actually one such package that actually lets me do this. So I take in the geodata frame and then I import folium and then now I create an folium dot map. So this folium dot map is just an empty canvas, kind of like a canvas where you can draw on top of. So this just creates a dummy map for me where I pass in the location, the zoom start the tiles and also we have various other parameters you can pass to the map. So after creating that dummy canvas. Now we want to plot our data on top of this canvas. So to do that, we create a feature called points. So these points feature is made up of geodata frame, which we created before. And also we had a parameter called tooltip tooltip is also a feature in which the field is named. So when I hover over this map, I can actually see the name of each and every point that I just plotted. Now after creating this feature, I take the canvas and I add this feature to the canvas. This is a very simple and incredibly effective to create, you know, beautiful looking maps. Now, onward to polygons. So we again read geodata frame, which is made up of polygons instead of points as you can see it's made up of multi polygons, and also polygons, and these are all different, you know, countries and continents. So to create a map out of them with geopandas, we just again do just dot plot pretty easy. And we now choose the column which we want to plot on top of, for example, here I've chosen GDP. So that means this map is colored based on the GDP. And also, we pass the color map so that you know it goes from this color to that color. I have also attached a link for the color maps, you know, the different color maps for macro which are present, and also I give legend equals true so that I actually see this. So now onward to the interactive maps to do that first, we actually create this color map to do that I'm using another package called Brankar dot color map, using which I'm actually importing this color map. And then I'm passing the number of steps I have to split it out of. So after creating the color map, I define my empty folium canvas. And also I define a style function. So this style function contains the various parameters that I'm going to be passing to my map, which I'm going to create right now. So it's made up of a fill color which denotes the color which I have to fill in that particular polygon, and also the color of that polygon itself, and also the weight of that border, which is the polygon color, and also how much is the opacity of the color I have to fill it into. So these are the parameters. And then we again we create a geojson feature, we pass a Julia frame, we create the tool tip and this time I'm passing the name and also the GDP. So when I hover over it, I see both of them. Amazing. So I also pass in the style function and then just add it to the canvas and also notice that I add the color map to the canvas. So I see this incredibly distorted legend, but I still see. So folium also has several special maps that you can actually create with it essentially. So these are called plugins that you actually create with these. So one such plugin is called market cluster. So with market cluster, you just, you know, import a market cluster from folium dot plugin. And now, I think a little weird, where you're bearing you need to take a geojson frame and convert it into a list of latitudes and not so we do that over here. Now we have a list of lat lungs. And now we create an empty canvas. And you know, we again do the, do the drill at child market cluster locations, we pass the list. And, you know, we get it is it's cluster. So, so these two, the number two here means that this cluster is made up of two points. So the number eight means that this cluster is made up of eight points. And the cluster 76 means that this cluster is made up of 76 points. So I can click on it, it splits into several clusters again, I click on it, it splits into clusters still I'm able to see each and every individual point, which is pretty awesome. Now, heat map. So heat map is something which, you know, given the current situation we actually see on a daily basis. So we know how important they are to convey the message, you know, so this is the heat map we're creating. Also, this does not represent anything, this is just arbitrary heat map to do this we you know take the location and you know just create a heat map out of it with a radius of this particular map. Heat maps actually are pretty interesting because so you just have to take one look at it, do you know, get all the information out of it essentially. So these are pretty cool. So now more data and more problems. So one issue which I started to notice, you know, when going down the folium path is when the number of points in your map start to increase. Folium starts to get a little bit ineffective. Folium cannot handle a lot of points. So one such also one solution, which you can deploy to make folium actually handle a lot of points is to actually, you know, create clusters like this, you know, create clusters so that you can actually plot out of points. But in some cases, the number of points you have, you know, you know, is like a lot. So your DOM will just crash like your browser crashes and you will not be able to plot all these spots. So that's where things get a little hard. But no fret not, we have a new kid in town, and that's Kepler GL. So this is the textbook definition of Kepler GL. So essentially it's this amazing project, which was developed at Uber. So they have built Kepler on top of that GL and the GL. So, you know, they actually can render, you know, millions of points and perform spatial aggregations on the fly, which is pretty amazing. You know, and you can create, you know, amazing cool looking maps with Kepler when you want to scale out your points or scale out your data. So to install Kepler, when you are on a Jupyter notebook that's greater than, you know, the version 5.3, you can just do a pip install Kepler GL, it installs it. And when you are in Jupyter lab, you just do, you know, Jupyter lab extension, install the Kepler extension, and you know, you enable it after installing and then you are good to go. You just be able to import Kepler GL, you know, create a map out of it, and you see this amazing interface. So another amazing thing about Kepler is that it uses configs to customize the maps. So a config looks like this. It has version, it has, you know, states, filters, you know, I'm not going to go deep into the config because it is amazingly customizable. So I'm not going to go really deep into that, but I'm going to actually give you an overlay of, you know, all the things that you can control with the config. So Kepler's UX flow is actually made up of five layers. So initially you have your base map, right? So the base map is made up of tiles that you can acquire from various sources. For example, you have, you can acquire tiles from open street maps, you can acquire map tiles from Google, you can acquire map tiles from Mapbox, you know, several styles, and you know, that makes up your tiles. And on top of these tiles, you, you know, overlay your data. And also on this data, you can perform filters, aggregations, and, you know, all the lot. And, you know, to perform filters and aggregations, you can actually represent your data layer as, you know, five different types of with Kepler. So we have hexagonal layers, we have arc layers, we have point layers, we have path layers and we have grid layers. And the amazing thing about it is that these layers, like some of these layers are actually, you know, interchangeable, like for example, you can have a point layer that you can represent as a grid. And you have, you know, H3 grids, which are actually a spatial indexing system, which is also developed courtesy of Uber, which, which can, you know, help you plot a lot of points without having to actually show those points on a map, rather index them and aggregate them as grids so that, you know, the number of points in your map significantly decreases. And also you have interactions you can perform on the data that has been brought on a map. And these interactions include stuff like tooltip. For example, these, the tooltips are the ones which I showed before, where you hover over component in a map and you know, you see the name or something a little bit of that particular geometry. And also Kepler has these interactions like, for example, you can geocode a particular location by just, you know, using an interaction, you have brushes, and you know, you have also the coordinate, you know, interaction. So given the customizability of Kepler and, you know, given the amount of layers it can process you, you can actually see one in action right now, where, you know, with an aggregation of points is getting performed on the flight. So we're just choosing a color and we're choosing to color those grids based on a particular field, which is actually getting done pretty fast. And also this is one of the things I absolutely love about Kepler is how amazingly beautiful spatial temporal maps you can create. So a quick definition of spatial temporal maps, a spatial temporal data is when you have both space and time linked with a particular data, which is pretty cool. So an example of this can be a trip or a practical example would be a drone data, right, so you have a drone that you're flying around. And at, you know, when you get the data out of that drone, you actually have two components of where it was, and when wasn't there. So you can use this information to create a timeline chart using Kepler and it looks as beautiful as this. So this is actually a trip data. So you can see trips over time, it looks, you know, pretty beautiful if you can create. But as always, you know, these are not the only libraries that are there and given the amazing community that is present in the open source world. So you can actually, you know, we have like tons of libraries that you can depend on. You don't have to just, you know, you have countless libraries, that's what I'm trying to say. So I'm going to just explore them. The next library is to book it. So with okay, you can actually do something similar. So here I'm just, you know, importing the figure, the output file and I'm importing the tiles. I'm using carto TV styles, which is, which is going to be my base map provider. And you know, I'm just creating an empty map. So here I'm actually choosing my coordinate reference system, which is marketer. And also I'm providing the range of the X and Y, which is, you know, pretty interesting and is not a feature that you have in the other libraries. So with everything, you, you, you get something new out of it, you know, it's not all the same. And, you know, it, it's good to actually explore this, it's actually fun to explore these libraries, you know, and how people are doing the same thing, but in really different and really amazing I know, and also we have plot, a plot list, a plot lead bouquet are not just for maps, but for, but for, you know, just basic interactive plots. And also we have Altair. So over here with partly I'm actually using partly express so that this code is a little smaller with partly it gets a little bigger. So with partly express I'm importing the car share data set, and I'm creating a scatter map box plot by just passing the data frame, the latitude longitude, the color and the size. So here actually, this is pretty cool because I'm able to represent more than I would be able to represent normally. So I'm using color to represent a feature, and I'm using the size to represent another feature. So I have these two features complementing each other on the same map. So this is really useful in cases where you want to, you know, spot correlation between two events happening, link to the same spatial component at the same time. So it's cool that you can do this with plotting. So this talks about your pattern, which is something I worked on on my free time, which is kind of like a hack function of all the scripts that I wrote to quickly create interactive maps, but without going to other libraries by staying in the realm of your data frames essentially. So it's something like so, so if you have not cringed yet a geopatra is named geopatra because it rhymes with Cleopatra, and you know, a Cleo and geo, you know, kind of rhyme and you know, I thought I was being clever at the time. So to create a folium plot, you just import geopatra and you do the data frame dot folium dot plot, and you just plot it. So it's just a single line to, you know, plot your geopatra. Oh, but you know, one thing which you know even I thought myself while just writing this is, why can't they just be these scripts which I keep for myself and why does it have to be another library. It can just be a gist of, you know, functions that can, you know, plot visual effects, not a library, right. So again, it's not a library. It's a wrapper essentially, a gigantic wrapper. And it's an interface, an interface to interact with the existing libraries without leaving the geopandas ecosystem. And also I have Netflix syndrome. So if you don't know what that means, Netflix gives you a lot of choices when you open the app and you know people get really overwhelmed at that choice and it's really hard for you to choose something. So it's the same thing for me, you know, there are these amazing libraries, you know, which complement each other, and also they are different in their own way and I don't want to choose one of them. I want all of them. And also, I actually want to spend more time plotting and, you know, spend less time googling for APIs because I have a very bad memory and I tend to forget, you know, how do I create a chloropath map is fully how do I create a heat map. I just keep googling and, you know, for different packages and you know that sometimes gets tiring. So, oh, alright, so let me move to the documentation of geopandas essentially. So with geopandas, you can I'm actually just taking these two data frames out, and I'm creating these interactive maps. These are the geochason maps. So this documentation is at geopatra.readthetalks.io and the GitHub repository is GitHub slash Sangashnan slash geopatra. So since my name is really weird, like, I actually get my name to be the username in every platform that I go to. So on Twitter, on, you know, on GitHub, you know, on every platform is just my name. So I created geochason map with just one line. I create a circle map with just one line. I pass the parameters of the tooltip, which is named so that I hover over it actually see the name. And also I have the radius, which is the radius. And, you know, I fill it with the color and the fill color is red. And, you know, the zoom is, you know, 100 so that I can zoom out. So these are the chloropeth maps, which is again one line. You color by the population, instead of the GDP, but they are obviously correlated. And the tooltip is the name so I hover over it actually the name. I, you know, set the color. I set the zoom and I set the style. And the marker clusters are again one line. I create the marker clusters. And I also have weighted marker clusters, which are kind of in, in the experimental phase essentially. So these are the ways where you can cluster with not just points, but with value. So these two means there are two points, right. So the cluster clusters mean that when you go here, the sum of the values here, you know, account to 986. It's not essentially the number of points. And you know, they look really weird because it's not completely ready yet. I'm just playing around with things. So, and also, of course, we have the heat maps that are always there. And, you know, this is what I'm actually excited about, which is Kepler. I also have a way to create an interactive map with just a single line, which is, you know, again, the data frame dot Kepler dot plot. And, you know, it creates this map for me. So I'm actually controlling the conflict of Kepler with, you know, a ginger template essentially. So the parameters you pass here just replace those prebuilt templates which are there. And you know, it's pretty easy to plot them actually. So to create a simple polygon, I pass the color, I pass the stroke, which are now a list of RBG's, but they will not be really soon. I have a PR ready to, you know, make them into actual colors rather than passing a list of RGB's. But for now, they are. And also, I pass the stroke thickness, which is a parameter I pass the opacity. You know, to create this plot again. So now they are all the same color, right? I can also pass a new parameter called color field, which is the population estimate and I also pass the color scheme, which is blues. So right now, because of this, it is actually colored based on the population estimate rather than being colored arbitrarily. So yeah, that's it for Geopatra. And thank you for coming. Okay. I'm just going to look at the questions. Okay, I have two questions. Can you talk about how Kepler is better than Mapbox since it's built on top of it. Okay. So even Mapbox are actually complimenting like one is not better than the other essentially. So actually Kepler uses Mapbox internally to be honest. So, Mapbox is the tile provider for Kepler. So the base maps which you see when you want to create plots on Kepler, they are all Mapbox tiles. So it's not kind of a competition, but kind of complimenting each other essentially. So yeah, that's that. Also, another question, do either Folium or Kepler support non geographic map, for example, mapping a star map. I'm not, I'm not sure about Folium, but with Kepler, you can actually provide your own custom base map. So if you actually Google for it, you can actually find a map where people have plotted a baseball stadium and where they have actually modeled the whole stadium on the base map and plotted how different shots have flown. You know, the shots which were hit and the different trajectories they had gone into. So like that was pretty cool. So, so I guess it is possible, you know, where you can pass your own custom map custom tiles and create maps out of it, but it is actually pretty hard to do. But it is possible, but they are mainly present for geographic maps, that's their main use case, but it is possible to extend them and customize them and of course the code is all open source. So all the projects I talked about are open source. Are there any map packages that also integrate AR functionality. So I assume you mean augmented reality. And to be honest, I don't know I have not worked with AR maps. So I, I just have done stuff with your unity and euphoria, which is a pretty basic so I'm not really sure I can actually maybe Google for it, and you know, get back to you or we can discuss about it. So, okay, I think that is it. We are out of questions. Thank you very much, everyone. Thank you for joining. I hope you liked my introduction. That was something I was planning for. And, you know, thank you for being with us.