Geo location item: changing from string to location

running OH4.2.2-release on openHABian.

I’ve collected geolocation information in string items over a long time. They’re in the format: 52.51992490069972, 13.369058138496499.
What’s the gain, if I changed the item from string to location? I can insert the “string” item into a map in pages for MainUI and ther marker will show up accordingly.
So two questions:

  1. Can I just change the item type to location without losing its histroy in the persistence (rrd4j, MariaDB)?
  2. What is something you could only do with a location-item but not with a string-item with the correct location format?

thanks.

Can’t really answer your question regarding persistence, but the second one.

With pointType (Location Items), you can directly do calculations like LocationItem1.distanceFrom(LocationItem2),
whereas Strings have to be translated to PointTypes first.

1 Like

Usually not but the full answer will need to come from an expert.

Personally I’d backup and try it out and see what happens. Or maybe test it out with a test Item.

The problem will arise if the MariaDB add-on splits the three fields of a PointType (altitude is in there too) into three separate columns, or if it just converts them to a String and drops that into a single column in the DB.

good point.

  • string-item: VARCHAR(50) with the location 52.51992490069972,13.369058138496499
  • location-item: VARCHAR(16255) with the location 52.51992490069972,13.369058138496499.

=> both items have the exact same values

I’m not sure, why there’s a 50char limit on String as there’s 16255 on the location. But should be enough both ways.

And I think I’ll just test it, was curious if someone knew the answer right away.