Map is initially not rendered correctly in SAP HCP Web Application

6 posts / 0 new
Last post
mang
Map is initially not rendered correctly in SAP HCP Web Application

Hi there,

I inlcuded a map in my web app UI (<HBox> is similar to <div> in html):

<HBox id="map" fitContainer="true" justifyContent="Center" alignItems="Center" width="100%" height="80%"  />

When the window is drawn the map is only rendered in the top right corner and also the copyright information in the bottom right corner is not displayed. The mapquest logo and terms link is displayed.

When I resize the window. Everything is drawn correctly. Any idea how I could fix this problem?

Regards,

Sarah

P.S: I found that if I check the size of the map with map.getSize(), I get a size of (0,0) before resizing the window. After resize the map has a size.

 


MQBrianCoakley
If you're using the MapQuest
If you're using the MapQuest JavaScript sdk, the map size has to be set in pixels, not percentage, before the map is instantiated. Leaflet, with the MapQuest map tile plugin, is much better handling map size as a percentage.

mang
Hi I am using the leaflet

Hi I am using the leaflet plugin and I also tried giving the size in pixel. the effect was the same. The map only did show after manually resizing the window.


MQBrianCoakley
Is there a url where we can
Is there a url where we can see this happening?

mang
Here's the URL:

MQBrianCoakley
Make sure the map element is
Make sure the map element is visible and sized before the map is instantiated. If there is still an issue, try changing the map element to a div.