Can you determine if a GPS location is inside a polygon?

I have a Shape File. I'd like to know if it is possible to determine if a geo-location is within a particular polygon. If so, can you explain how to do this?

  • Use the INPOLYGON function. 

  • Hi Will,

    Thank you. I see the function, but how does it work? Do you have an examples or advice?


  • I'm trying to use this function to determine whether or not an inspection took place within a 4-sided polygon. I can't seem to get the function to return true. 

    I am requiring the user to get the GPS location using the Location field. I am using the results from that field in the INPOLYGON function. Doesn't seem to want to work for me. 

    I noticed that the GPS location from the location field returns location in DMS format. I tried using the GEO-FORMAT function to convert the DMS lat/lon to Decimal Format (which it appears the INPOLYGON function uses). Still won't work. Any ideas? 

    Should the INPOLYGON function work both within the form itself and as a condition within a connector? 


  • After giving this some thought I have come up with another solution that doesn't require the use of the INPOLYGON function. 

    1. Use a "Location" field in the form that requires the user to record the GPS location where the inspection is being performed. 

    2. Create hidden fields for Latitude LAT((inspectionLocation)) and Longitude LON{{inspectionLocation}} to extract the latitude and longitude from the {{inspectionLocation}} field. 

    3. Use another hidden field to determine whether or not the inspection took place within a polygonal geofence by using the following IF statement:

     IF((({{lat}} < 40) AND ({{lat}} > 36) AND ({{lon}} > -80) AND ({{lon}} < -76)), 'True', 'False')

    There might be a more elegant way to do this using the INPOLYGON function......however this approach works.

  • Thank you, Will -- that's a good solution!

Login or Signup to post a comment