Geographic information system

logo

overview

Blockly addons to handle GEO positions and calculate the distance between two GEO positions.

Blocks

Distance between %1 and %2

Calculate the distance between the two arguments. Both arguments have to be internal Position objects.

Format %1 as %2

Format the given position in the given format (dummy).

Convert %1 meter to %2

Convert the parameter (Number) from meter to the given non-meter Unit.

Convert %1 in unit %2 to meter

Convert the parameter (Number) in the selected non-meter unit to meter.

Position at latitude %1 and longitude %2 (Direct input)

Create a position object at the given latitude and longitude position. The arguments are direct numbers and there are validators.

Position at latitude %1 and longitude %2 (From Blocks)

Create a position object at the given latitude and longitude position. The arguments are other Number Blocks.

Changelog

Version 0.2

  • Fix colors and validation for input arguments

Version 0.1

Resources

https://raw.githubusercontent.com/lochmueller/openhab-block-libraries/e2b6b70b85d4501864f55e8ade1e42073f32a561/gis/BlockLibrary.yaml

4 Likes

Oooooh man.
If only the android app returned the gps position of the smartphone… you could then have the distance to the openHAB instance.
And run/turn off stuff as you get nearer or farther from home.

This could be cool!

1 Like

Nice idea, Tim, thanks for the contribution. This is exactly what the block libraries are for. Looks already pretty good

Here is my feedback from reviewing your code and documentation:

  • blocks returning a number (output: Number) should use the same color 230 like in the core block library, Only blocks of type Geoposition should have the 300

  • in general each type should have a (slightly) different color

  • you should make sure that only valid blocks can be applied. Here is an example which is probably not intended

  • there is a small typo “formated” instead of formatted :angel:

regarding

Format the given position in the given format (dummy).

What do you mean with “dummy”?

The arguments are direct numbers and there are validators

Can you explain the documentation what the validators do? I think you are referring to -180 → 180 degrees

I would be also >nice< if you provided some details in the documentation how to use that in openHAB (e.g. via the GPS Tracker Binding?)

Hope that helps,
Stefan

Hey @stefan.hoehn
thanks for your feedback. I changed the colors, fix the typo and release a version.
I will check the GPS Tracker Binding and also the native Location Type in the future.
Regards,
Tim

1 Like