You can use the AutoInput plug-in. AutioInput's
Query UI can be used to retrieve all of the visible and hidden text from the Location Settings screen. One of the hidden text items is whether Location is OFF or ON.
CAUTION: The Custom Quick Settings plug-in for Tasker has a major bug that causes it to manipulate the incorrect tile. A bug report has been filed and hopefully it will be corrected in the next revision.