1

i have longitude and latitude in geofence table how to check longitude and latitude in database level. if car longitude latitude are in Zone, update geofance column zones = 'car in zone area'

CREATE TRIGGER Tr_CheckGeoFance
ON CheckGeoFance
AFTER INSERT AS
BEGIN
Update tblgeofencing
Set CarZone ='Car In Zone Area'
END
GO
ShapesString ={"shapes":[{"type":"rectangle","color":"#1E90FF","bounds":{"northEast":{"lat":"32.379961464357315","lon":"70.99365234375"},"southWest":{"lat":"31.840232667909362","lon":"70.2685546875"}}}]}

enter image description here

enter image description here

Adeel Khan
  • 185
  • 5
  • 15

1 Answers1

0

First You have to decode the ShapesString which is currently in json format and then find out the latitude and longitude out of the decoded json. Then check the lat-long lie in your defined range to update the column.

Refer this to decode the json:- Parse JSON in TSQL

Community
  • 1
  • 1