Skip to Content
0
Jul 25, 2016 at 04:11 PM

Image with address from google maps api isn't visible

90 Views

Hi guys!

I developed an application in SAPUI5 in Eclipse and run it via a Tomcat Server. I have the problem that one image is visible and the others are not - there's only a placeholder where the maps picture should be and if I click on it with the right mouse button and select "Copy address of picture" (don't use Firefox, just Opera or Chrome) from the context menu and paste it into the address bar of the browser the correct web address and data is shown, e.g. https://maps.googleapis.com/maps/api/staticmap?zoom=15&size=640x400&markers=23751%20N.%2023rd%20Ave.%2c%2085085%20Phoeni…:

1) The SupplierInfo.fragment.xml which is embed into Object.view.xml implements a panel with the image:

<Panel class="sapUiResponsiveMargin sapUiHideOnPhone" width="auto" headerText="{i18n>mapTitle}"> <Image src="{ parts: [ 'ToSupplier/Address/Street', 'ToSupplier/Address/PostalCode', 'ToSupplier/Address/City', 'ToSupplier/Address/Country' ], formatter: '.formatter.formatMapUrl'}" />

</Panel>

2) The formatter.js calculates the valid web address (Google Maps API):

formatMapUrl: function(sStreet, sZIP, sCity, sCountry) {
return "https://maps.googleapis.com/maps/api/staticmap?zoom=15&size=640x400&markers=" + jQuery.sap.encodeURL(sStreet + ", " + sZIP + " " + sCity + ", " + sCountry);

}

What is wrong with my source code? If I duplicate, adapt and execute the application via SAP Web IDE everything's fine so I don't really believe in limitiations by Google.