DataSift allows users to create filters based on the location that interactions were sent from. This can be done in a number of ways.
First of all we need to decide which target we are going to use. The most versatile target is interaction.geo, this allows you to filter on Geographical data across all active sources using a single target. However, if you want your logic to be a little more complex, you can use source specific targets such as twitter.geo and facebook.geo.
Now we have to choose an operator, we can use any of the following:
- geo_polygon allows you to construct a polygon to filter on interactions within the area.
- geo_radius uses a coordinate and a radius (KM) to filter on interactions from within a circle.
- Finally, geo_box uses two coordinates to create a bounding box.
After following the steps mentioned previously our CSDL might look something like
interaction.geo geo_polygon "58.72259882804337,-8.525390625:59.48972603553692,-0.791015625:51.28940590271674,2.98828125:49.61070993807422,-3.955078125:49.32512199104001,-5.361328125:52.64306343665879,-12.919921875"
twitter.geo geo_radius "46.49839225859763,2.8125:238.43677467843835"
facebook.geo geo_box "40.88029480552824,-109.0283203125:36.949891786813296,-102.216796875"
Another CSDL target to take a look at is twitter.place.name, this makes filtering for Twitter geographic data even simpler, allowing you to write things like
twitter.place.name contains "London"