Personal tools
You are here: Home Documentation Errors loadMapInternal(): Given map extent is invalid

loadMapInternal(): Given map extent is invalid

Document Actions
When loading your mapfile or one of your layers, MapServer complains about an invalid extent

Beginning in MapServer 4.6, MapServer got more strict about LAYER and MAP extents. If minx is greater than maxx, or miny is greater than maxy, this error will be generated. Check your MAP's EXTENT, LAYER's EXTENT, or wms_extent setting to make sure this is not the case. MapServer always takes in extents in the form of:

EXTENT minx miny maxx maxy

How to get a file's EXTENT values?

The easiest way to get a vector file's EXTENT is to use the ogrinfo utility, that is part of the GDAL/OGR library (for raster files you would use the gdalinfo utility). Windows users can download the FWTools package, which includes all of the GDAL and OGR commandline utilities. MS4W also includes the utilities (in ms4w/tools/gdal-ogr-utils/). Linux users will probably already have the GDAL libraries, if not you can also use the FWTools package.

For example, here is the results of the ogrinfo command on a shapefile (notice the "Extent" line):

$ ogrinfo province.shp province -summary
  INFO: Open of `province.shp'
  using driver `ESRI Shapefile' successful.

  Layer name: province
  Geometry: Polygon
  Feature Count: 1071
  Extent: (-2340603.750000, -719746.062500) - (3009430.500000, 3836605.250000)
  Layer SRS WKT:
  (unknown)
  AREA: Real (16.0)
  PERIMETER: Real (16.0)
  PROVINCE_: Real (16.0)
  PROVINCE_I: Real (16.0)
  STATUS: String (64.0)
  NAME: String (64.0)
  NAME_E: String (64.0)
  NAME_F: String (64.0)
  REG_CODE: Real (16.0)
  POLY_FEATU: Real (16.0)
  ISLAND: String (64.0)
  ISLAND_E: String (64.0)
  ISLAND_F: String (64.0)
  YYY: Real (16.0)
  SIZE: Real (16.0)
  ANGLE: Real (16.0)

Ogrinfo gives the file's extent in the form of (minx, miny),(maxx, maxy), therefore the EXTENT in a mapfile would be:

EXTENT -2340603.750000 -719746.062500 3009430.500000 3836605.250000

Note that the EXTENT in a mapfile must be in the same units as the MAP-level PROJECTION.

This Error Reference applies to: MapServer 4.6, MapServer 4.8

by Howard Butler last modified 2006-01-11 09:47

Powered by Plone