[OpenLayers-Users] Problem with Mapserver + PostGIS + Openlayers
cole gillespie
mcg42387 at gmail.com
Fri May 1 19:59:18 EDT 2009
Users,
I am having trouble with my Openlayers map. I have a mapfile that I am
trying to view inside of Openlayers. I feel like I am doing every thing
right but all I am getting to show up inside of Openlayers is a white image.
Below I will include both my map file and my openlayers html file. Any
suggestions on what I am doing wrong would be greatly appreciated.
///////////////////////////////Mapfile///////////////////////////////////////////
MAP
EXTENT -84.321869 33.752878 -75.400119 36.588157
FONTSET "fonts/fonts.list"
IMAGECOLOR 255 255 255
IMAGETYPE png
SHAPEPATH "/ms4w/apps/tutorial/data"
SIZE 800 600
STATUS ON
UNITS METERS
NAME "MS"
OUTPUTFORMAT
NAME "png"
MIMETYPE "image/png"
DRIVER "GD/PNG"
EXTENSION "png"
IMAGEMODE "PC256"
TRANSPARENT FALSE
END
OUTPUTFORMAT
NAME "AGG"
MIMETYPE "image/png; mode=24bit"
DRIVER "AGG/PNG"
EXTENSION "png"
IMAGEMODE "RGB"
TRANSPARENT FALSE
END
PROJECTION
"init=epsg:32119"
END
LEGEND
IMAGECOLOR 255 255 255
KEYSIZE 20 10
KEYSPACING 5 5
LABEL
SIZE MEDIUM
TYPE BITMAP
BUFFER 0
COLOR 0 0 0
FORCE FALSE
MINDISTANCE -1
MINFEATURESIZE -1
OFFSET 0 0
PARTIALS TRUE
END
POSITION LL
STATUS OFF
END
QUERYMAP
COLOR 255 255 0
SIZE -1 -1
STATUS OFF
STYLE HILITE
END
SCALEBAR
ALIGN CENTER
COLOR 0 0 0
IMAGECOLOR 255 255 255
INTERVALS 4
LABEL
SIZE MEDIUM
TYPE BITMAP
BUFFER 0
COLOR 0 0 0
FORCE FALSE
MINDISTANCE -1
MINFEATURESIZE -1
OFFSET 0 0
PARTIALS TRUE
END
POSITION LL
SIZE 200 3
STATUS OFF
STYLE 0
UNITS MILES
END
WEB
IMAGEPATH "/ms4w/apache/htdocs/tmp/ms_tmp"
IMAGEURL "tmp/ms_tmp"
QUERYFORMAT text/html
LEGENDFORMAT text/html
BROWSEFORMAT text/html
END
LAYER
CONNECTION "user=postgres dbname=postgis password=help37546"
CONNECTIONTYPE POSTGIS
DATA "the_geom FROM (
SELECT
Zipcodes.the_geom AS the_geom,
Zipcodes.gid as gid,
Zip.income as income
FROM zipcodes JOIN zip
ON zipcodes.zcta = zip.zcta) AS new_table USING UNIQUE gid USING
SRID=-1"
FILTER "income > 0 and income <= 200000"
NAME "themelayer"
PROJECTION
"init=epsg:32119"
END
STATUS ON
TYPE POLYGON
UNITS METERS
CLASS
STYLE
ANGLE 360
COLOR 255 228 181
OPACITY 100
SYMBOL 0
END
END
END
END
/////////////////////////////////////openlayers
file///////////////////////////////////////////////////////
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MapServer Layer</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"
/>
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="http://openlayers.org/dev/lib/OpenLayers.js"></script>
<script type="text/javascript">
var map, layer;
function init(){
map = new OpenLayers.Map('map', {
projection: "epsg:32119",
numZoomLevels: 14,
units : "meters",
controls: [
new
OpenLayers.Control.ZoomToMaxExtent(),
new
OpenLayers.Control.PanZoomBar({zoomWorldIcon: true}),
new
OpenLayers.Control.LayerSwitcher({'ascending':false}),
new
OpenLayers.Control.MousePosition(),
new
OpenLayers.Control.MouseDefaults(),
new
OpenLayers.Control.KeyboardDefaults()
]
});
layer = new OpenLayers.Layer.MapServer( "County Map",
"http://localhost/cgi-bin/mapserv.exe", {map:
"C:/ms4w/Apache/htdocs/test_mapfile_edit.map", layers: "themelayer"} );
map.addLayer(layer);
map.zoomToMaxExtent();
}
</script>
</head>
<body onLoad="init()">
<div id="title">MapServer Layer</div>
<div id="tags"></div>
<div id="shortdesc">Shows MapServer Layer</div>
<div id="map" class="smallmap"></div>
<div id="docs">
</div>
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090501/e9247976/attachment.html
More information about the Users
mailing list