[FREE] AddressInfo - Some calculations about address

Description

Hello every one…Today I introduce my first extension…It’s an extension that makes some calculation about addresses…
Currently it only supports getting distance between two coordinates…And also indicates if a coordinate is in a radius around a location…
Note: This extension doesn’t use any formula in calculation…It uses a class for calculation provided by android…So calculating is more accurate…
release time : 2020-08-06T23:00:00Z
current version: 1.1
last update: 2020-08-07T23:00:00Z

Blocks

blocks - 2020-08-08T103533.488

Documentation

Error occurred


component_event (11)
Event is triggered when an error occurs…
error ~ String

Distance between


component_method (13)
Returns the distance between two points in meters.Returns -1 if coordinates isn’t valid.
latA ~ int
lngA ~ int
latB ~ int
lngB ~ int

Is in radius

component_method (12)
Returns true if a specific coordinates is in a specific radius.
targetLat ~ int
targetLng ~ int
positionLat ~ int
positionLng ~ int
Radius ~ int

Usage example

blocks (98)
That’s represents how far i am from london in meters ( can be easily converted to kilometres):


That represents if i’m in circle around london it’s radius 6000m:

Download links

AIA: MyExtension (2).aia (8.8 KB)
AIS: MyExtension_Screen1 (1).ais (3.6 KB)
APK: MyExtension (1).apk (5.1 MB)
AIX: io.mohamed.AddressInfo.aix (7.4 KB)
Note: Extension my return error “coordinates couldn’t be equal to 0”…That’s due to the time the location sensor takes to get the address/coordinates…

Credits

Thanks for every one who helped me developing this extension :smile:
If you have any improvements or there is any bug then please tell me…I’m going to update this extension when i have any new idea…

Mohamed Tamer

17 Likes

very useful extension

1 Like

Congratulations really well done well

1 Like

thank you for your contribution…
I only have some minor naming conventions remarks… :grimacing:

Please follow the naming conventions, which is UpperCamelCase for property, method and event names (i.e. the first letter should be a capital letter) and lowerCamelCase for parameter names, no underscores .

Which means in your case, you should write targetLat rather than targetlat, same for targetLng, positionLat, positionLng
there also is a spelling error for DistanceBetween and ErrorOccurred

Taifun

2 Likes

Thanks so much @Mohamed_Tamer great work !!!
Can I suggest post some phone screenshot about can be done with this extension.

1 Like

Thanks very much :grin:@Piman @alrmailay @taifun @bestprintsf

Already added:

Post updated :+1:

i have a button.
i have a school.
i want the button only visible when my position is in 50 radius of my school. How to set the block with your extension?

:one:, you must have your school coordinates( latitude and longitude)…
:two:, grab IsInRadius block from the extension…
:three:, set the target lat and lng to the coordinates of your school…
:four:,Set the position lat and lng to the coordinates ( it’s latitude and longitude) of the device…You can get it using location sensor component…
:five:, set the radius to 50… Note that the radius is in meters so if you want 50 km then set it to 50000…
:six:, You are done!

1 Like

the first step, do i have to use map component for it?
to get lat and long…

Nope, you can easily get the longitude and latitude of your school using those two blocks in the location sensor component…
https://docs.kodular.io/components/sensors/location-sensor/#latitude-from-address
https://docs.kodular.io/components/sensors/location-sensor/#longitude-from-address

1 Like

all of these, except first step are in “if then” control?

Yes…And then{
you will set the button visible to true…
}else{
you will set the button visible to false…
}

1 Like

OK. i should try it first. thankz a lot btw.

1 Like

You are welcome :smile:


i need ur help to bring me to step 1 :sweat_smile: :sweat_smile:

Something like that:
image

1 Like

what component to put these on?

Is in radius block target lat and target lng…
It’s a block in my extension…See here: