Wir haben einen OSM-Server und einen UMN-Mapserver. Wir möchten jetzt gerne mit Openlayers einen Grundlayer mit Openstreetmap machen und darüber die vorhandenen Layer des UMN-Mapservers legen. Leider haben wir extreme Probleme. 1. Die Layer werden nicht an den richtigen Orten angezeigt 2. Es werden nur die POIs angezeigt, die Luftbilder nicht 3. Die Layer werden mit einem großen schwarzen Kasten umrahmt Hier unsere openlayers.html
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="http://www.openlayers.org/api/OpenLayers.js"></script> <script src="OpenStreetMap.js"></script> <script type="text/javascript"> <!-- var map; function init(){ map = new OpenLayers.Map('map', { maxExtent: new OpenLayers.Bounds(), numZoomLevels: 1, maxResolution: 156543.0399, units: 'm', projection: new OpenLayers.Projection("EPSG:31467"), displayProjection: new OpenLayers.Projection("EPSG:4326") }); var layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik (updated weekly)", {transparent: 'true'}); var layerTah = new OpenLayers.Layer.OSM.Osmarender("Tiles@Home", {transparent: 'true'}); map.addLayers([layerMapnik,layerTah]); var twms2 = new OpenLayers.Layer.MapServer( "Luftbilder", "http://lbs.uni-koblenz.de/cgi-bin/mapserv.exe?m$ { transparent: 'true', layers: 'mittelrhein', format: 'jpeg', projection: map.displayProjection} ); var twms = new OpenLayers.Layer.MapServer( "POI", "http://lbs.uni-koblenz.de/cgi-bin/mapserv.exe?map=$ { transparent: 'true', layers: 'poi', format: 'jpeg', projection: map.displayProjection} ); map.addLayer(twms); map.addControl(new OpenLayers.Control.PanZoomBar()); map.addControl(new OpenLayers.Control.MouseToolbar()); map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false})); map.addControl(new OpenLayers.Control.Permalink()); map.addControl(new OpenLayers.Control.Permalink('permalink')); map.addControl(new OpenLayers.Control.MousePosition()); map.addControl(new OpenLayers.Control.OverviewMap()); map.addControl(new OpenLayers.Control.KeyboardDefaults()); var lonLat = new OpenLayers.LonLat(0, 0).transform(map.displayProjection, map.projection); map.setCenter (lonLat, 12); } // --> </script> </head> <body onload="init()"> <div id="map"></div> </body> </html>
Und hier die Map-Datei:
MAP NAME server STATUS ON SIZE 240 240 SYMBOLSET '/ms4w/symbols/symbols.sym' WEB TEMPLATE 'C:/ms4w/template/template.html' IMAGEPATH '/ms4w/Apache/htdocs/wiki/map_output/' IMAGEURL '/wiki/map_output/' LOG 'C:/ms4w/errorlog/mapserv.log' METADATA "wms_title" "WMS mGeoWiki Server" "WMS_FEATURE_INFO_MIME_TYPE" "text/html" "wms_onlineresource" "http://lbs.uni-koblenz.de/cgi-bin/mapserv.exe?map=/ms4w/wiki.map" "wms_srs" "EPSG:31467 EPSG:4326" "wfs_title" "GMap WMS mGeoWiki Server" "wfs_onlineresource" "http://lbs.uni-koblenz.de/cgi-bin/mapserv.exe?map=/ms4w/wiki.map&service=WFS" "wfs_srs" "EPSG:31467 EPSG:4326" "wms_encoding" "utf8" "wms_namespace_prefix" "topp" END END fontset "/ms4w/font.txt" EXTENT 3.39194e+006 5.578e+006 3.39406e+006 5.58e+006 UNITS meters IMAGECOLOR 10000 10000 10000 OUTPUTFORMAT NAME jpeg DRIVER "GD/JPEG" MIMETYPE "image/jpeg" IMAGEMODE RGB #PC256 EXTENSION "jpg" FORMATOPTION "QUALITY=75" END PROJECTION "init=epsg:31467" END ### LEGEND ### LEGEND STATUS ON KEYSIZE 8 8 LABEL TYPE BITMAP SIZE MEDIUM COLOR 0 0 89 END # LABEL END # LEGEND ### Layer der Karte ### LAYER NAME "mittelrhein" STATUS ON METADATA "wms_title" "orthopics" ##required END TILEINDEX "merge.shp" TILEITEM "Location" TYPE RASTER END LAYER NAME natural CONNECTIONTYPE postgis CONNECTION "user=postgres password=******* dbname=template_postgis host=localhost port=5432" STATUS ON METADATA "wms_title" "natural" ##required END # METADATA DATA "the_geom from natural" TYPE RASTER END #Layer ### Layer der Strassennamen ### LAYER NAME streetnames TYPE LINE STATUS ON METADATA "wms_title" "streetnames" ##required END # METADATA DATA /ms4w/street/texte #TRANSPARENCY 0 LABELITEM "name" CLASSITEM "name" #FILTER "NAME='Neugasse'" CLASS NAME "Texte" LABEL ANTIALIAS TRUE FONT "arial" SIZE medium POSITION AUTO ANGLE FOLLOW COLOR 255 255 255 OUTLINECOLOR 64 64 64 BUFFER 15 PARTIALS FALSE END # LABEL END # CLASS END # LAYER ### Layer der Strassenlinien ### LAYER NAME streetlines TYPE LINE STATUS ON METADATA "wms_title" "streetlines" ##required END # METADATA DATA /ms4w/streetlines/linien CLASS NAME "linien" STYLE OUTLINECOLOR 100 0 0 COLOR 255 0 0 ANTIALIAS TRUE END # STYLE END # CLASS END # LAYER ### Layer der Strassenlinien-Suche ### LAYER NAME streetsearchlines TYPE LINE STATUS ON METADATA "wms_title" "streetsearchlines" ##required END #METADATA DATA /ms4w/streetlines/linien CLASS NAME "linien" #EXPRESSION ('[ID]'= '300PX5R' OR '[ID]' = '300PX1P') EXPRESSION (%strasse%) STYLE WIDTH 2 #OUTLINECOLOR 0 0 0 COLOR 255 255 0 ANTIALIAS TRUE END #STYLE END #CLASS END #LAYER ### Layer der Strassennamen-Suche ### LAYER NAME streetsearchnames TYPE LINE STATUS ON METADATA "wms_title" "streetsearchnames" ##required END #METADATA DATA /ms4w/street/texte #TRANSPARENCY 0 LABELITEM "name" CLASSITEM "name" CLASS NAME "Texte" EXPRESSION (%strasse%) #EXPRESSION ('[ID]'= '300PX5R' OR '[ID]' = '300PX1P') LABEL ANTIALIAS TRUE FONT "arial" SIZE medium POSITION AUTO ANGLE FOLLOW COLOR 255 255 0 OUTLINECOLOR 0 0 0 BUFFER 5 PARTIALS FALSE END #LABEL END #CLASS END #LAYER ### Layer der Points of Interest ### LAYER NAME "poi" CONNECTIONTYPE postgis CONNECTION "user=postgres password=******* dbname=wiki_postgis host=localhost port=5432" TYPE point STATUS ON METADATA "wms_title" "poi" ##required END # METADATA DATA "the_geom from poi" LABELITEM "text1" # fuer Darstellung der Namen CLASSITEM "text2" # fuer Darstellung der Kategorie CLASS NAME "Allgemein" EXPRESSION "Allgemein" STYLE SYMBOL 'circle' COLOR 255 0 0 # ROT SIZE 8 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Sport" EXPRESSION "Sport" STYLE SYMBOL 'circle' COLOR 0 255 0 SIZE 8 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Tourismus" EXPRESSION "Tourismus" STYLE SYMBOL 'circle' COLOR 255 255 0 SIZE 8 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Unterhaltung" EXPRESSION "Unterhaltung" STYLE SYMBOL 'star' COLOR 255 0 0 # ROT SIZE 8 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Kunst" EXPRESSION "Kunst" STYLE SYMBOL 'star' COLOR 0 0 255 SIZE 8 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Freizeit" EXPRESSION "Freizeit" STYLE SYMBOL 'freizeit' COLOR 255 0 255 SIZE 12 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Kultur" EXPRESSION "Kultur" STYLE SYMBOL 'freizeit' COLOR 255 0 255 SIZE 12 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Gesundheitswesen" EXPRESSION "Gesundheitswesen" STYLE SYMBOL 'medizin' COLOR 255 0 255 SIZE 12 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Gastronomie" EXPRESSION "Gastronomie" STYLE SYMBOL 'gastronomie' COLOR 255 0 255 SIZE 12 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Wohnhaus" EXPRESSION "Wohnhaus" STYLE SYMBOL 'haus' COLOR 255 0 255 SIZE 12 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Verwaltung" EXPRESSION "Verwaltung" STYLE SYMBOL 'verwaltung' COLOR 255 0 255 SIZE 12 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS CLASS NAME "Sonstiges" EXPRESSION "Sonstiges" STYLE SYMBOL 'circle' COLOR 0 255 255 # CYAN SIZE 8 END # STYLE LABEL antialias true font "arial" size medium position auto angle follow color 255 255 255 outlinecolor 64 64 64 buffer 30 partials false END # LABEL TEMPLATE "C:/ms4w/Apache/htdocs/wiki/template/poi.html" END # CLASS END # LAYER ### Layer der PICTURES ### LAYER NAME "pix" CONNECTIONTYPE postgis CONNECTION "user=postgres password=******* dbname=wiki_postgis host=localhost port=5432" TYPE point STATUS ON METADATA "wms_title" "pix" ##required END # METADATA DATA "the_geom from pix" CLASS NAME "pictures" STYLE SYMBOL 'picture' COLOR 255 0 255 SIZE 12 END # STYLE END # CLASS END # LAYER END # MAPFILE
Wäre toll, wenn uns jemand Tipps geben kann! Danke! Mod-Edit: Habe die PW mal rausgenommen sicherheitshalber. Danke für den Hinweis, Detlef. Wenn sie nötig sind, kann er sie ja gerne wieder reinsetzen, wo jetzt ******* steht.