SAP Flash Island and Google Maps
And why could it be helpfull to integrate Google Maps with SAP using Flash Islands? Well… it’s just one of those examples which illustrate some of the basic ideas of SAP Flash Island – you embed a powerfull UI with SAP which isn’t available in SAP Netweaver. And with this feature it’s suddenly easy to show e.g.:
- where your customers are located
- which installations needs a visit from a service technician
- where is the nearest truck
- and more…
You just need to pass either the GPS coordinate or the address of the location(s) to your Flash Island – and the Flash Island will handle the rest. The gecoding feature in Google will help you with the address conversions to GPS coordinates.
Remember to include the SAP Flash Island swc’s into your library path as well – see example here
Example source code below – replace the API key and the initial address in the example below.
if you want to try it without the SAP Flash lib – just remove:
public var inputAddress:String;
private var gMap:Map;
private var MyCurrentLocation:String;
private function init():void
{
FlashIsland.register(this);
gMap = new Map();
gMap.key = "enter your api key here - enter your api key here";
gMap.width = 600;
gMap.height = 400;
gMap.addEventListener(MapEvent.MAP_READY, mapReadyHandler);
mapContainer.addChild(gMap);
if ( inputAddress == null )
{
inputAddress = "your initial location"
addr1.text = inputAddress;
}
}
private function mapReadyHandler(e:MapEvent):void
{
gMap.setCenter(new LatLng(55.999121,9.540081), 4 ,
MapType.NORMAL_MAP_TYPE);
gMap.setSize(new Point(mapContainer.width, mapContainer.height));
gMap.addControl(new PositionControl());
gMap.addControl(new ZoomControl());
gMap.addControl(new MapTypeControl());
FindMyLocation();
}
public function FindMyLocation():void
{
doGeocode();
}
private function doGeocode():void
{
var geocoder:ClientGeocoder = new ClientGeocoder("AU");
geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,
function(event:GeocodingEvent):void
{
var placemarks:Array = event.response.placemarks;
if (placemarks.length > 0)
{
gMap.setCenter(placemarks[0].point);
var marker:Marker = new Marker(placemarks[0].point);
marker.addEventListener(MapMouseEvent.CLICK,
function (event:MapMouseEvent):void
{
marker.openInfoWindow(new InfoWindowOptions(
{content: placemarks[0].address}));
});
marker.setOptions(new MarkerOptions(), fillStyle:
new FillStyle(), radius: 12,
Jim
thank's, just tested it with WebDynpro ABAP - it works!!!
Best Regards
Konstantin
Remember to check your implementation/functionality in WebDynpro with the Google Maps API Terms (http://code.google.com/apis/maps/terms.html)
br,
Mogens Enevoldsen