here an example pattern to link hosts to locations (no TPL knowledge needed)
All you need to make this work is:
- create the locations and add the subnets to the description field
- upload the attached pattern
- rescan your server
the pattern is not doing any fancy Subnet calculation. It's just looking on the IP address of the host and matches the Subnet from there to the entry in the description field.