Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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=""></script>
<script type="text/javascript" src=""></script>
<link rel="stylesheet" type="text/css" href="" />
<link rel="stylesheet" type="text/css" href="" />
<script src=""></script>
<script type="text/javascript" src="./script/GeoExt.js"></script>
<script src=";sensor=false"></script>

<link rel="stylesheet" href="" type="text/css">
<link rel="stylesheet" href="" 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
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=""></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=""></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

Your Answer


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.