This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Maps rendering with spaces

0

When i display a map in a div called venuemap, the map is displayed with gaps.

Example:

http://www.diigo.com/item/image/1w8bo/ck4u

This is the code i use for displaying the map

        /* Open map */
            map = new OpenLayers.Map("venuemap");
            map.addLayer(new OpenLayers.Layer.OSM());

            var lonLat = new OpenLayers.LonLat( venue.location.lng ,venue.location.lat )
                  .transform(
                    new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
                    map.getProjectionObject() // to Spherical Mercator Projection
                  );

            var zoom=16;

            var markers = new OpenLayers.Layer.Markers( "Markers" );
            map.addLayer(markers);

            markers.addMarker(new OpenLayers.Marker(lonLat));

            map.setCenter (lonLat, zoom);
            /* end open map */

What is wrong with my code? Kind regards brantje

asked 20 Jul '12, 12:40

brantje's gravatar image

brantje
11112
accept rate: 0%

The example url seems wrong : no map there.

(20 Jul '12, 13:23) Vincent de P... ♦

One Answer:

0

Probably your JS code is right, but your HTML style is wrong ? Make sure you set margin and padding to 0 on your map div and the tag surrounding the div.

answered 20 Jul '12, 13:26

Vincent%20de%20Phily's gravatar image

Vincent de P... ♦
17.3k18152249
accept rate: 19%

Source code available on GitHub .