Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

The JavaScript worked just fine when I was running it in a straight HTML page on a local server. But, when I moved it to the .aspx page it no longer displays. Firebug shows no script errors and I know the map data is loading because it lists the attributes on the page properly. But, the map itself does not display. The zoom icon typically in the corner does not display either, the element is left untouched. It didn't work in IE either.

Here is the code for the initialization, it calls when the window loads.

function init() {
        var map = new OpenLayers.Map('map', {
            allOverlays: true
        });


        countries = new OpenLayers.Layer.Vector("Countries", {
            protocol: new OpenLayers.Protocol.HTTP({
                url: "../../Content/simplify3.geojson",
                format: new OpenLayers.Format.GeoJSON({
                    extractAttributes: true,
                    visibility: true
                })
            }),
            strategies: [new OpenLayers.Strategy.Fixed()]
        });


        map.addLayer(countries);
        select = new OpenLayers.Control.SelectFeature(countries,
                { multiple: true, toggle: true });


        countries.events.on({
            "featureselected": onFeatureSelect,
            "featureunselected": onFeatureUnselect,
            "loadend": populateList
        });

        map.addControl(select);
        select.activate();
        map.zoomToMaxExtent();
    }

The map should go here:

<div id="map" style="width: 800px; height: 400px; border: 2px solid black;">There Should Be A Map Here!</div>

Any thoughts other than shooting the damn thing?

share|improve this question
I called <script> window.onload = init(); </script> too early in the code. The <div> was not yet created and so the map couldn't be populated correctly. I knew it was going to be something dumb. – bshender Dec 29 '12 at 19:45

closed as too localized by Devdatta Tengshe, whuber Jan 1 at 3:55

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.