+1

Using regionenter and regionexit on actions and datasources

choffmann 12 years ago updated by icahill (Administrator) 12 years ago 3
Are these datasourceevents out of beta? If so, how do you use them? I am tinkering around with the map stuff and I can't seem to get it to work. I have tried:



<wire>
<datasources>
<datasource name="geo" source="significant-change" query="something" providertype="location"/>
<datasource name="range" source="significant-change" query="something" providertype="location"/>
</datasources>
<main>
<map name="map" alias="MAP" width="100%" height="100%" datasource="geo" currentlocation="yes" showuser="yes"></map>
</main>
<actions>
<action name="setmaplocation" oninit="yes">
<sync>
<assign property="datasource:range.eventDuration" value="5"/>
<assign property="datasource:range.distanceFilter" value="5"/>
<assign property="datasource:range.location" value="on"/>
<assign property="datasource:range.regionenter" value="39.014426 -94.43163"/>
</sync>
</action>
<action name="enterregion" datasource="range" datasourceevent="regionenter">
<alert message="Entered Region" />
</action>
</actions>
</wire>


And:

<wire>
<datasources>
<datasource name="geo" source="significant-change" query="something" providertype="location"/>
<datasource name="range" source="significant-change" query="something" providertype="location"/>
</datasources>
<main>
<map name="map" alias="MAP" width="100%" height="100%" datasource="geo" currentlocation="yes" showuser="yes"></map>
</main>
<actions>
<action name="setmaplocation" oninit="yes">
<sync>
<assign property="datasource:range.region" value="39.014393 -94.431786 39.01427 -94.431454"/>
<assign property="datasource:range.eventDuration" value="5"/>
<assign property="datasource:range.distanceFilter" value="5"/>
<assign property="datasource:range.location" value="on"/>
</sync>
</action>
<action name="enterregion" datasource="range" datasourceevent="regionenter">
<alert message="Entered Region" />
</action>
</actions>
</wire>



I can't seem to get either to work. Am I way off?
You are not that far off. The regionenter and regionexit are dependant on two things: the user's current location and the current region assigned to the map. Your second example is fairly close, only your map is assigned to the geo datasource and your enterregion action is using the range datasource.
Can you use only one map object within a wire? I am trying to display a map that shows the user's current location with the map zoomed in enough to see details like street names and then trigger an action when they enter another region. Think about someone walking down a street and having an alert popup when they walk by a street.

It would be immensely helpful if there was a way to define multiple regions within a map, almost like hotspots that would trigger something to happen. I have tried everything I can think of (which admittedly is probably limited given my experience with maps).
The current map tag does only allow a single region to be defined, but similar to the datasource example on the maps documentation, you could create an XML file that contains several regions.

http://content.rarewire.com/wordpress...

http://earthquake.usgs.gov/earthquake...