I have created shapes to map neigborhoods in NYC in Tableau. I have this data in a CSV that I linked to Tableau. Each shape has several points that each have a longitude and latitude associated with it. I also have taxi data that for each pick up, it has a latitude and longitude. For every data point that I have, I want to map it to the neighborhood that contains it. I am struggling to do this in Tableau, even at the basic level, because I can't even get to the sheet portion of Tableau. The two datasets don't have any commonality, so I'm not sure how I should join these datasets. Can this be done in Tableau or is there another program where this would be easier to do?
1
votes
Tableau doesn't do geographic queries (i.e. this point is inside this shape). But you might be able to kludge it by using the hexbin functions (use small enough bins that average the polygon lat/lon and test whether the point lat/lon is in the same bin. Otherwise fin a way to use an external lookup to link points to areas (these often exist for common areas).
- matt_black
1 Answers
1
votes
I couldn't find a way to do it in Tableau so I found a python script at http://geospatialpython.com/2011/01/point-in-polygon.html that would identify if a point was within a shape. I then read in the excel file to the python script to use the shape data to make polygons and the trip data to provide the points. After querying every point with every shape, I added a field to the trip file with the shape that the trip started in. Then I fed this back into Tableau. This solution seemed to work well.