How maps work in apex and how you can leverage them?

How maps work in apex and how you can leverage them in your applications so I mean what is a map well I think we’re all pretty familiar with that what a map is but in terms of apex it’s actually just a special type of chart and how these maps work and is all they’re doing is they are associating some sort of value to a certain location on the chart or map so in other words and if you say you have a map of the United States and you’re showing all 50 states and you have the value of CA which is California it knows that whatever value you’re trying to associate to California is nowhere to display it and the great thing is it doesn’t it well technically it is a third party because it’s based off of any charts but it’s already tightly integrated into the apex framework so well what I’m trying to say here is you don’t have to go download anything to make this work you already have this I will say that the ape are the Google Maps like API and all that good stuff and we’ll probably look a little better.

But the reason why we don’t talk about that or the reason why we’re not going to integrate that and is just kind of food for thought here and the apex Maps API and it only it allows you to perform like a thousand requests a day and then it starts charging you and you have to set up an API key and some accounts and all sorts of good stuff there, so this is something that the reason why we talked about this is that it doesn’t charge you there’s no API you don’t have to be able to connect to google so you don’t need internet access just simply intranet access if you’re like behind a firewall or something this will continue to work, so that’s why we focus on this um but I would just like to say that it is a web application if you want to explore Google Maps and they kind of explore setting up a component there you can, but that’s not what we’re talking about today and this is based on any map library which coincidentally is what apex uses for charting as well.

So it just made sense that they integrated everything but not just their charts but also their maps any questions at this point ok so here’s what an any chart or any map example looks like and so here we’re actually have a mat a chart is called count of customers by state and we can see that we’re associating values to these different states you can probably guess what the expected value is to associate to associate something to a state and you can see it’s the abbreviation here right GA for Georgia il-4 Illinois’s VA for Virginia right NY for New York and it does have some zooming options but as far as displaying the data or kind of as far as making the point that whatever it is that you’re trying to make it’s very doable right if you’re just trying to show how sales by state or something in kind of more visual way than just a regular report and what you can do this and we’re actually going to make a chart very similar to this or a map but in this case there are kinda it’s almost synonymous here.

So creating a map and the first thing that you have to do when you go to make a map and you have to there are many levels of maps that you can pick or in other words trying to get to the exact map you’re looking for there’s a bunch of different categories and you can almost think of them as folders at the very top level and you have what we see here on the screen which is just trying to kind of narrow you down to certain types of maps, so the first one is Matt as the United States of America, so that’s just a folder of maps that you can pick from then there’s going to be another sub option that says well do you want a map of the United States or do you want a map of regions to take do you want how exactly what type of map of the United States are you looking for and then finally the third level is the actual map so you could say something like I like a map of the United States I like it to be the entire country and I, would like it to be broken up by the state.

And that’s in fact the map that we looked at and that is indeed the map that we are going to create in the workshop, so the idea here is you just need to pick the map best suited for your location data and to view the data examples you can actually click here so what I mean by location data well we’ll see here basically we’re going to be going off of region IDs or essentially the abbreviations for a given region so okay if you want to see data based on any of the countries that are available like let’s go down let’s find the United States I can say demo so here’s the data that it’s looking for right so you have us whoa go away and we have us and then you can see that we have the abbreviation let me open up my magnifying glass here for you but okay CA for California the value is, and then the value is 8 you don’t have to worry too much about kind of this value and what not the biggest thing is we’re just we just were looking at the example of the type of data that it’s looking for.

So, in other words, we’re going to be leveraging the state abbreviations okay if you want to look somewhere else um you can and let’s go I wanted to go to like South America I don’t know if it has one big enough for that only a South Africa but anyway let’s just click on that and you’ll see so you can see this actually has a different prefix and then again there are just codes here to reference different areas so you can just see which one it’s referring to based on the value right because this one has value zero so if I find it there go value of zero that’s the ID and actually it’s displaying the ID and next to it so if any way if you’re trying to determine if you have a particular location you’re trying to display a map of and this is the ID will give you an idea of what your data needs to be to know to kind of map a piece of information to a particular location on the map.

Leave a comment