Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to enter in my maps application (Geoserver, postgis, openlayer) but it is empty and I get an error with Firebug: TypeError: OpenLayers.Map is not a constructor in my map.js script in line var map = new OpenLayers.Map({projection: "EPSG:900913",displayProjection: "EPSG:4326",numZoomLevels: 7});

What is wrong?

EDIT: This is my header html

<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.4.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.4.0/ext-all.js"></script>
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.4.0/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.4.0/examples/shared/examples.css" />
<script src="http://openlayers.org/dev/OpenLayers.js"></script>
<script type="text/javascript" src="./script/GeoExt.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>

<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/google.css" type="text/css">

<script type="text/javascript" src="map.js"></script>

The problem occurred suddenly while I looking the layers before added. I clicked in option Reload feature type in a particular layer page, Could this have something to do?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted
OpenLayers.Map is not a constructor

is related to the OpenLayers.js file, so this is saying that this file is not located in your script tag (ie. in the HEAD section of your HTML). Also, it could be that

<script src="http://openlayers.org/dev/OpenLayers.js"></script>

no longer works or there are some problems nowadays with it, this is because the examples of the openlayers examples link don't work now. Try instead

<script src="http://www.openlayers.org/api/2.11/OpenLayers.js"></script>

and post here what you get.

Hope this helps,

share|improve this answer
    
If the file is not located in the script tag the message error would be OpenLayers.Map is not defined, I guess. Please, see my edit. –  Overflow012 Jun 6 '13 at 19:05
    
I edited my answer, please see if that helps you. If it does, consider upvoting it and marking as the answer. –  Gery Jun 6 '13 at 20:08
    
Gery you are the man!!! I change the url works great! Thanks! :D –  Overflow012 Jun 6 '13 at 20:23
    
Glad to hear that works! =) thanxs for that –  Gery Jun 6 '13 at 20:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.