NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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... ♦

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.

permanent link

answered 20 Jul '12, 13:26

Vincent%20de%20Phily's gravatar image

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

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×126
×60
×59
×45

question asked: 20 Jul '12, 12:40

question was seen: 3,426 times

last updated: 20 Jul '12, 13:26

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum