From wiki.ginstr.com
Jump to: navigation, search

gn:act_geocode

Description
Action used to get gps coordinates based on provided address from nominatim server: https://nominatim.enaikoon.de/
Action returns
void

Action signatures

[gn:act_geocode]|[target, query]
Parameter Description
target target target to which gps data will be set
query sources source from which query will be read. Query is a textual string which represents address of a location.
gn:act_setOnGeocodeFound Action set which will get executed if and after server returns some geocode result
  • callback to be set on same widget on which geocode action is executed
gn:act_setOnGeoCodeNotFound Action set which will get executed if and after server returns empty result
  • callback to be set on same widget on which geocode action is executed

Example

variables.xml
<variable id="getNominatimData_geocodeQuery" type="text">11, street, place, place, county, postcode, country</variable>
screen.xml
<FrameLayout
    android:id="@+id/exampleFrame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    gn:act_set="[gn:act_geocode]|[@+id/getNominatimData_geocodedGPS,@variable/getNominatimData_geocodeQuery]" />

<com.ginstr.widgets.GnEditText
    android:id="@+id/getNominatimData_geocodedGPS"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    gn:style="@style/textEditable_input"
    gn:noServiceOnUpdate="true"
    gn:autoLoadLocation="false"
    gn:s_hint="@string/getNominatimData_geocodedGPSHint"
    gn:s_sourceType="gps"/>
after action execution
@+id/getNominatimData_geocodedGPS will have stored coordinates if location address is matching a gps location