10 Replies Latest reply on Apr 16, 2017 12:53 AM by Nate Jacobs

    Hot Spot Mapping

    Patrick Koch

      Does Tableau have the ability to create a 'hot spot' visualization?

      I work within the Crime Analysis field and while the current map displays are useful, they don't visually present a relationship between points.

      Thanks

      Pat

        • 1. Re: Hot Spot Mapping
          Santiago Sanchez

          Hi Patrick,

           

          Would you have an example of the kind of visualization you are looking for? On Tableau Public, you can find some pretty interesting dashboards about crime, for instance:

           

          50 Years of Crime in the US | Tableau Public

          Chicago Crime Scene | Tableau Public (see 'hotspots')

           

          Hope this helps!

          • 2. Re: Hot Spot Mapping
            Patrick Koch

            Thanks for getting back to me!

            I have looked through several Tableau Forums and available workbooks, but haven’t yet found what I need. The Chicago Viz you shared probably comes close, but does not give the level of fidelity I require.

            Below are a couple of examples of Hot Spot maps that represent what I am looking for. I assume that it would mean creating some kind of adjustable relationship analysis between points or multiple points of data – perhaps within a layer of associated hex or polygons.

             

             

             

            Within the law enforcement community, this type of visualization is ubiquitus to any crime reporting. I have also seen is used in many other industries to represents frequency of events geographically.

            I currently use Tableau as a visualization tool for many aspects of basic crime analysis, but to create hot spot maps, I need to export my material over to Arc GIS and create them there. Unfortunately, Arc GIS is significantly more rigid and does not allow us the interactive, near real time response to filters and queries that I get and appreciate with Tableau.

             

            Pat

            Patrick Koch

            Manager Risk and Information

            Metro Vancouver Transit Police

             

            transitpolice.ca

            300 – 287 Nelson's Court

            New Westminster, BC V3L 0E7

            Phone: (604) 516-7432

            Cell: (604) 347-8729

            General Phone: (604) 515-8300

            --- Text non-emergency reports to 87-77-77 | Download our OnDuty App ---

             

            Transit Police is committed to maintaining order, promoting safety and reducing crime on the transit system in Metro Vancouver.

             

            This message, together with any attachments, is intended only for the use of the individual or entity to which it is addressed. It may contain information that is confidential and prohibited from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination or copying of this message or any attachment is strictly prohibited. If you have received this message in error, please notify the original sender immediately by telephone or by return email and delete this message along with any attachments, from your computer

            • 3. Re: Hot Spot Mapping
              Sean Boon

              Hi Patrick,

               

              I'm adding Bora Beran.  He has actually built a workbook that does Hot Spot Analysis using our new Python Integration feature in Tableau.  I'm attaching here for your review.  You can tweak the parameters that go into the model.  This data is based on public data from the Seattle PD.

               

               

              How does it work?

              Our integration with Python has two main components:

              • Tableau (Desktop or Server) 10.1 or higher
              • TabPy (short for Tableau Python Server, a web server that can execute Python code)

              If you have Tableau 10.1, all you need to do is to point it to a TabPy server instance and you’re ready to start writing Python code.

               

              You can find detailed instructions on how to get started with TabPy (including installation, how to run code in Tableau, model deployment and reuse) on our Github site. We have installer scripts for Windows, Mac and Linux that automatically install the packages and their dependencies and initializes the server for you, so you can quickly get up and running.

               

               

              The example below....

              The attached workbook uses the DBSCAN algorithm available in scikit-learn to find crime hotspots using roughly 6 years of 911 incident response data from Seattle Police Department.

               

              You can change the type of the crime as well as the definition of a hotspot and interactively explore the data with the help of the algorithm. In the example below a hotspot is defined as having at least an average of 1 incident per quarter with incidents no more than 150 feet apart.

               

               

              Let us know if this helps and if you have any questions feel free to reach out to us here.

               

              Kind regards,

              Sean

              • 4. Re: Hot Spot Mapping
                Naledi Hollbruegge

                Hi Patrick,

                 

                I don't think it is currently possible to make heat maps like the ones in the images directly in Tableau.
                When I've made these heat maps before I've used Alteryx to create the polygons. There is an app in the Alteryx Analytics Gallery that does this for you.

                 

                Here is some more information about this:

                http://www.theinformationlab.co.uk/2014/12/03/geospatial-heat-maps-tableau-via-alteryx/ 

                Mapping Big Data using Tableau + Alteryx…..(Part 2 – Heat Maps) - The Data School

                Why is my Alteryx Heatmap tool not working? - The Data School

                 

                Best wishes

                Naledi

                • 5. Re: Hot Spot Mapping
                  Patrick Koch

                  Thanks for your assistance.

                  I have played with Alteryx; unfortunately, the cost of the program is out of reach for my small organization.

                   

                  Thanks again

                   

                  Pat

                  Patrick Koch

                  Manager Risk and Information

                  Metro Vancouver Transit Police

                   

                  transitpolice.ca

                  300 – 287 Nelson's Court

                  New Westminster, BC V3L 0E7

                  Phone: (604) 516-7432

                  Cell: (604) 347-8729

                  General Phone: (604) 515-8300

                  --- Text non-emergency reports to 87-77-77 | Download our OnDuty App ---

                   

                  Transit Police is committed to maintaining order, promoting safety and reducing crime on the transit system in Metro Vancouver.

                   

                  This message, together with any attachments, is intended only for the use of the individual or entity to which it is addressed. It may contain information that is confidential and prohibited from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination or copying of this message or any attachment is strictly prohibited. If you have received this message in error, please notify the original sender immediately by telephone or by return email and delete this message along with any attachments, from your computer

                  • 6. Re: Hot Spot Mapping
                    Bora Beran

                    The hotspot map is published as part of this blog post

                     

                    Leverage Tableau and Python to build advanced-analytics applications

                     

                    • 7. Re: Hot Spot Mapping
                      Jonathan Drummey

                      FYI the "lots of points" technique for doing hotspots in Tableau can be enhanced using halftone custom shapes, Robert Rouse did a really nice version of this on his Every Pitch of the 2014 season viz: https://www.interworks.com/blog/rrouse/2014/10/15/every-pitch-2014-mlb-season-visualized-tableau.

                       

                      Jonathan

                      • 8. Re: Hot Spot Mapping
                        Nate Jacobs

                        Hi Sean and Bora,

                         

                        I have downloaded both sample workbooks with the TabPy integration and have gotten both to work successfully. However, when I tried to apply this to the crime data set I have, I get an error. As far as I can tell the data is essentially the same as the Seattle Police calls for service. I have attached a workbook with a small subset of the crime data and the hot spot calculations.

                         

                        Dropbox - Police Crime Data Hot Spot.twbx

                         

                        This is the error message I get when I add the _Is Hotspot Measure to the Marks box. I have tried troubleshooting this for several hours now and keep hitting the same roadblock. Thank you for your assistance.

                         

                        ------

                        An error occurred while communicating with the Predictive Service.

                        Error processing script

                        Error when POST /evaluate: Traceback

                        Traceback (most recent call last):

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py", line 467, in post

                        result = yield self.call_subprocess(function_to_evaluate, arguments)

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run

                        value = future.result()

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/concurrent.py", line 232, in result

                        raise_exc_info(self._exc_info)

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py", line 1014, in run

                        yielded = self.gen.throw(*exc_info)

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py", line 488, in call_subprocess

                        ret = yield future

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run

                        value = future.result()

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_base.py", line 400, in result

                        return self.__get_result()

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_base.py", line 359, in __get_result

                        reraise(self._exception, self._traceback)

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_compat.py", line 107, in reraise

                        exec('raise exc_type, exc_value, traceback', {}, locals_)

                        File "/root/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/thread.py", line 61, in run

                        result = self.fn(*self.args, **self.kwargs)

                        File "<string>", line 4, in _user_script

                        AttributeError: 'float' object has no attribute 'radians'

                        Error type : AttributeError

                        Error message : 'float' object has no attribute 'radians'

                        • 9. Re: Hot Spot Mapping
                          Bora Beran

                          Hi Nate,

                          You have a row with null latitude/longitude.  If you filter it out, it should work.

                           

                          Screen Shot 2017-04-13 at 3.27.05 PM.png

                           

                          Thanks,

                           

                          Bora

                          • 10. Re: Hot Spot Mapping
                            Nate Jacobs

                            Thank you Bora. I don't know why I didn't think to do that. Somestimes the simplest things are overlooked.