Topic
  • 3 replies
  • Latest Post - ‏2013-08-30T16:37:46Z by Kevin_Foster
RajeshKumarMandal
RajeshKumarMandal
21 Posts

Pinned topic Geofence Match computing with streams

‏2013-08-29T08:30:43Z |

Hello,

We are planning to develop a geofence match of customers using streams. We are providing customer information with corresponding lat and long into streams. We also have set of geofence polygons (set of lat and long) configured and provided to streams. Now were are using geospatial toolkit available in streams to create polygons for all geofence polygon configuration provided and checking if the customer lies in polygon or not.

Currently this check of customer lying in geofence polygon is comparing each customer in all geofence polygons which we think is not a optimized solution.

We also planned to predefine the geofence polyons into fixed sets and create fixed set of operator in streams and pass customer information to these operators using split.

I need some suggestions on best way to divide geofences dynamically and increase processing speed. We would receive new / updated geofences polygon information periodically into streams which must be again used for matching customer information.

Any suggestions ??

Thanks,

Rajesh

  • Kevin_Foster
    Kevin_Foster
    98 Posts

    Re: Geofence Match computing with streams

    ‏2013-08-29T19:01:01Z  

    There is a geospatial indexing library that works inside of Streams that you can download from here:

    https://www.ibm.com/developerworks/community/files/app?lang=en#/file/b94ce757-c8a4-4cfa-8d67-1bb1915a0475

    There is a README file in the download.

    Reading it now, the operator indexes point locations and then gives back results based on the distance from that point. Would work fine for circles, or you can use this as a part of a two-pass algorithm where you search in a larger circle and then check for polygon overlap as a second step.

     

    To learn more about R-tree indexing, look here:

    http://en.wikipedia.org/wiki/R-tree

    This is a well proven indexing method used within Informix and other software.

    -Kevin

  • RajeshKumarMandal
    RajeshKumarMandal
    21 Posts

    Re: Geofence Match computing with streams

    ‏2013-08-30T08:43:02Z  

    There is a geospatial indexing library that works inside of Streams that you can download from here:

    https://www.ibm.com/developerworks/community/files/app?lang=en#/file/b94ce757-c8a4-4cfa-8d67-1bb1915a0475

    There is a README file in the download.

    Reading it now, the operator indexes point locations and then gives back results based on the distance from that point. Would work fine for circles, or you can use this as a part of a two-pass algorithm where you search in a larger circle and then check for polygon overlap as a second step.

     

    To learn more about R-tree indexing, look here:

    http://en.wikipedia.org/wiki/R-tree

    This is a well proven indexing method used within Informix and other software.

    -Kevin

    Hello Kevin,

    Thanks for the reply.

    We were looking into the Rtree JavaOp implementation provided in your reply and checking how we can reuse the same for our development.

    Do we have to first provide all Geofence Config data to Rtree Operator and later verify for customer match or some other way.

    Considering if I have 2 data sources:

    1-> Customer Source (Id, lat and long)

    ex: Cust1 , 22.588199, 88.4076

    2-> Geofence config data (Geo Fence Id, List of lat / long)

    ex:

    McDonalds, 22.551712, 88.3545, 22.548114, 88.351729, 22.542724, 88.351686

    Starbucks, 22.588278, 88.40577, 22.586535, 88.407058, 22.587981, 88.409761, 22.589863, 88.40856

    How can we use this Rtree JavaOp so that the check of customer across available Geofences can be optimized so that the processing speed is not impacted.

    Thanks,

    Rajesh

  • Kevin_Foster
    Kevin_Foster
    98 Posts

    Re: Geofence Match computing with streams

    ‏2013-08-30T16:37:46Z  

    I haven't used this particular toolkit. So as a *theory* on how you could use it:

    How big are your geofence areas? If they are relatively small compared to the entire map area, then you can calculate an approximate center point for each geofence:

    latitude = ( Min(latitude) + Max(latitude) / 2.0 )

    longitude= ( Min(longitude) + Max(longitude) / 2.0 )

    and feed those into the operator for indexing. (A geofence should be relatively small otherwise it defeats the purpose.)

    Then as your customer location data arrives, you can query the stored indexes using each customer's location and a distance value that's 1.5 times greater than the largest geofence. This will produce a list of candidate geofences.

    These will include false positives - inside the radius but still outside the geofence - so you would then use the Geospatial toolkit functions to test the customer location against the list of candidate locations.

     

    A longer term approach is to implement a bounding box R-tree index that contains the actual geofence boundaries. But that would take more time and skill than using the existing toolkit from Streams Exchange.

    -Kevin