Select to view content in your preferred language

check vehicle location inside or outside

1766
1
09-07-2014 07:58 PM
JulieBiju
Deactivated User

Hi all,

I need to do the below task. How can I do this?

we have a vehicle location with longitude and latitude  values. In a map we created a special layer named geofenceLayer. I need to check when this vehicle is coming in and going out from this particular layer. Is it possible to do?

0 Kudos
1 Reply
AsserSwelam1
Deactivated User

Hi Julie,

You can use Envelope.Intersects method.

Get your vehicle location extent and check if it is intersects with the geofecneLayer.

Something like this

Polygon geoFenceArea = geofenceLAyer.Graphics[0] as Polygon;

if(vehicleLocation.Extent.Intersects(geoFenceArea.Extent))

     //The vehicle is in

else

     //The vehicle is out

Hope this helps.

Thanks,

Asser