Search code examples
tableau-api

How to know if a coordinate is within a shape file in Tableau?


I have a set of coordinates (lat and lng) in an excel document. I have also a shape file which shows the different states/province of a country. The shape file contains the geometry field. I would like to merge those 2 together in order to be able to identify how many records are within a province and how much are there in the other province. Any idea how I can do a sum of records if a coordinate is within a shape file boundary/state ?

Thanks


Solution

  • I used python to convert the coordinates to the shapefile projection and looped through each record to find if it is within the bounderies of a polygon or multipolygon. I used python to prepare the data and I would simply plot it in Tableau. This is the way it worked for me. If you want more information about this, don't hesitate to let me know. I will share the python code.