2013/2/20 Jerome A. Wendell <jawendell@anonymised.com>:
I setup another test map by basically copying the source from the geoserver
preview. With it, the background does show up pink after a few seconds.
The code for that is below (there is a lot of extra stuff, sorry):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers map preview</title>
<!-- Import OL CSS, auto import does not work with our minified
OL.js build -->
<link rel="stylesheet" type="text/css"
href="http://166.78.30.120/openlayers/theme/default/style.css"/>
<!-- Basic CSS definitions -->
<style type="text/css">
/* General settings */
body {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: small;
}
/* Toolbar styles */
#toolbar {
position: relative;
padding-bottom: 0.5em;
display: none;
}
#toolbar ul {
list-style: none;
padding: 0;
margin: 0;
}
#toolbar ul li {
float: left;
padding-right: 1em;
padding-bottom: 0.5em;
}
#toolbar ul li a {
font-weight: bold;
font-size: smaller;
vertical-align: middle;
color: black;
text-decoration: none;
}
#toolbar ul li a:hover {
text-decoration: underline;
}
#toolbar ul li * {
vertical-align: middle;
}
/* The map and the location bar */
#map {
clear: both;
position: relative;
width: 512px;
height: 357px;
border: 1px solid black;
}
#wrapper {
width: 512px;
}
#location {
float: right;
}
#options {
position: absolute;
left: 13px;
top: 7px;
z-index: 3000;
}
/* Styles used by the default GetFeatureInfo output, added to
make IE happy */
table.featureInfo, table.featureInfo td, table.featureInfo th {
border: 1px solid #ddd;
border-collapse: collapse;
margin: 0;
padding: 0;
font-size: 90%;
padding: .2em .1em;
}
table.featureInfo th {
padding: .2em .2em;
font-weight: bold;
background: #eee;
}
table.featureInfo td {
background: #fff;
}
table.featureInfo tr.odd td {
background: #eee;
}
table.featureInfo caption {
text-align: left;
font-size: 100%;
font-weight: bold;
padding: .2em .2em;
}
</style>
<!-- Import OpenLayers, reduced, wms read only version -->
<script src="http://166.78.30.120/openlayers/OpenLayers.js"
type="text/javascript">
</script>
<script defer="defer" type="text/javascript">
var map;
var untiled;
var tiled;
var pureCoverage = false;
// pink tile avoidance
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
// make OL compute scale according to WMS spec
OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
function init(){
// if this is just a coverage or a group of them, disable a
few items,
// and default to jpeg format
format = 'image/png';
if(pureCoverage) {
document.getElementById('filterType').disabled = true;
document.getElementById('filter').disabled = true;
document.getElementById('antialiasSelector').disabled =
true;
document.getElementById('updateFilterButton').disabled =
true;
document.getElementById('resetFilterButton').disabled =
true;
document.getElementById('jpeg').selected = true;
format = "image/jpeg";
}
var bounds = new OpenLayers.Bounds(
-82.64451214652546, 37.20144080151447,
-77.7190620395735, 40.638801538808
);
var options = {
controls: ,
maxExtent: bounds,
maxResolution: 0.0192400394802811,
projection: "EPSG:4326",
units: 'degrees'
};
map = new OpenLayers.Map('map', options);
// setup tiled layer
tiled = new OpenLayers.Layer.WMS(
"wv_county:wv_county - Tiled",
"http://localhost:8080/geoserver/wv_county/wms",
{
LAYERS: 'wv_county:wv_county',
STYLES: '',
format: format,
tiled: true,
tilesOrigin : map.maxExtent.left + ',' +
map.maxExtent.bottom
},
{
buffer: 0,
displayOutsideMaxExtent: true,
isBaseLayer: true,
yx : {'EPSG:4326' : true}
}
);
// setup single tiled layer
untiled = new OpenLayers.Layer.WMS(
"wv_county:wv_county - Untiled",
"http://localhost:8080/geoserver/wv_county/wms",
{
LAYERS: 'wv_county:wv_county',
STYLES: '',
format: format
},
{
singleTile: true,
ratio: 1,
isBaseLayer: true,
yx : {'EPSG:4326' : true}
}
);
map.addLayers([untiled, tiled]);
// build up all controls
map.addControl(new OpenLayers.Control.PanZoomBar({
position: new OpenLayers.Pixel(2, 15)
}));
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new
OpenLayers.Control.MousePosition({element: $('location')}));
map.zoomToExtent(bounds);
// wire up the option button
var options = document.getElementById("options");
options.onclick = toggleControlPanel;
// support GetFeatureInfo
map.events.register('click', map, function (e) {
document.getElementById('nodelist').innerHTML =
"Loading... please wait...";
var params = {
REQUEST: "GetFeatureInfo",
EXCEPTIONS: "application/vnd.ogc.se_xml",
BBOX: map.getExtent().toBBOX(),
SERVICE: "WMS",
INFO_FORMAT: 'text/html',
QUERY_LAYERS: map.layers[0].params.LAYERS,
FEATURE_COUNT: 50,
Layers: 'wv_county:wv_county',
WIDTH: map.size.w,
HEIGHT: map.size.h,
format: format,
styles: map.layers[0].params.STYLES,
srs: map.layers[0].params.SRS};
// handle the wms 1.3 vs wms 1.1 madness
if(map.layers[0].params.VERSION == "1.3.0") {
params.version = "1.3.0";
params.j = parseInt(e.xy.x);
params.i = parseInt(e.xy.y);
} else {
params.version = "1.1.1";
params.x = parseInt(e.xy.x);
params.y = parseInt(e.xy.y);
}
// merge filters
if(map.layers[0].params.CQL_FILTER != null) {
params.cql_filter = map.layers[0].params.CQL_FILTER;
}
if(map.layers[0].params.FILTER != null) {
params.filter = map.layers[0].params.FILTER;
}
if(map.layers[0].params.FEATUREID) {
params.featureid = map.layers[0].params.FEATUREID;
}
OpenLayers.loadURL("http://localhost:8080/geoserver/wv_county/wms", params,
this, setHTML, setHTML);
OpenLayers.Event.stop(e);
});
}
// sets the HTML provided into the nodelist element
function setHTML(response){
document.getElementById('nodelist').innerHTML =
response.responseText;
};
// shows/hide the control panel
function toggleControlPanel(event){
var toolbar = document.getElementById("toolbar");
if (toolbar.style.display == "none") {
toolbar.style.display = "block";
}
else {
toolbar.style.display = "none";
}
event.stopPropagation();
map.updateSize()
}
// Tiling mode, can be 'tiled' or 'untiled'
function setTileMode(tilingMode){
if (tilingMode == 'tiled') {
untiled.setVisibility(false);
tiled.setVisibility(true);
map.setBaseLayer(tiled);
}
else {
untiled.setVisibility(true);
tiled.setVisibility(false);
map.setBaseLayer(untiled);
}
}
// Transition effect, can be null or 'resize'
function setTransitionMode(transitionEffect){
if (transitionEffect === 'resize') {
tiled.transitionEffect = transitionEffect;
untiled.transitionEffect = transitionEffect;
}
else {
tiled.transitionEffect = null;
untiled.transitionEffect = null;
}
}
// changes the current tile format
function setImageFormat(mime){
// we may be switching format on setup
if(tiled == null)
return;
tiled.mergeNewParams({
format: mime
});
untiled.mergeNewParams({
format: mime
});
/*
var paletteSelector =
document.getElementById('paletteSelector')
if (mime == 'image/jpeg') {
paletteSelector.selectedIndex = 0;
setPalette('');
paletteSelector.disabled = true;
}
else {
paletteSelector.disabled = false;
}
*/
}
// sets the chosen style
function setStyle(style){
// we may be switching style on setup
if(tiled == null)
return;
tiled.mergeNewParams({
styles: style
});
untiled.mergeNewParams({
styles: style
});
}
// sets the chosen WMS version
function setWMSVersion(wmsVersion){
// we may be switching style on setup
if(wmsVersion == null)
return;
if(wmsVersion == "1.3.0") {
origin = map.maxExtent.bottom + ',' + map.maxExtent.left;
} else {
origin = map.maxExtent.left + ',' + map.maxExtent.bottom;
}
tiled.mergeNewParams({
version: wmsVersion,
tilesOrigin : origin
});
untiled.mergeNewParams({
version: wmsVersion
});
}
function setAntialiasMode(mode){
tiled.mergeNewParams({
format_options: 'antialias:' + mode
});
untiled.mergeNewParams({
format_options: 'antialias:' + mode
});
}
function setPalette(mode){
if (mode == '') {
tiled.mergeNewParams({
palette: null
});
untiled.mergeNewParams({
palette: null
});
}
else {
tiled.mergeNewParams({
palette: mode
});
untiled.mergeNewParams({
palette: mode
});
}
}
function setWidth(size){
var mapDiv = document.getElementById('map');
var wrapper = document.getElementById('wrapper');
if (size == "auto") {
// reset back to the default value
mapDiv.style.width = null;
wrapper.style.width = null;
}
else {
mapDiv.style.width = size + "px";
wrapper.style.width = size + "px";
}
// notify OL that we changed the size of the map div
map.updateSize();
}
function setHeight(size){
var mapDiv = document.getElementById('map');
if (size == "auto") {
// reset back to the default value
mapDiv.style.height = null;
}
else {
mapDiv.style.height = size + "px";
}
// notify OL that we changed the size of the map div
map.updateSize();
}
function updateFilter(){
if(pureCoverage)
return;
var filterType =
document.getElementById('filterType').value;
var filter = document.getElementById('filter').value;
// by default, reset all filters
var filterParams = {
filter: null,
cql_filter: null,
featureId: null
};
if (OpenLayers.String.trim(filter) != "") {
if (filterType == "cql")
filterParams["cql_filter"] = filter;
if (filterType == "ogc")
filterParams["filter"] = filter;
if (filterType == "fid")
filterParams["featureId"] = filter;
}
// merge the new filter definitions
mergeNewParams(filterParams);
}
function resetFilter() {
if(pureCoverage)
return;
document.getElementById('filter').value = "";
updateFilter();
}
function mergeNewParams(params){
tiled.mergeNewParams(params);
untiled.mergeNewParams(params);
}
</script>
</head>
<body onload="init()">
<div id="toolbar" style="display: none;">
<ul>
<li>
<a>WMS version:</a>
<select id="wmsVersionSelector"
onchange="setWMSVersion(value)">
<option value="1.1.1">1.1.1</option>
<option value="1.3.0">1.3.0</option>
</select>
</li>
<li>
<a>Tiling:</a>
<select id="tilingModeSelector"
onchange="setTileMode(value)">
<option value="untiled">Single tile</option>
<option value="tiled">Tiled</option>
</select>
</li>
<li>
<a>Transition effect:</a>
<select id="transitionEffectSelector"
onchange="setTransitionMode(value)">
<option value="">None</option>
<option value="resize">Resize</option>
</select>
</li>
<li>
<a>Antialias:</a>
<select id="antialiasSelector"
onchange="setAntialiasMode(value)">
<option value="full">Full</option>
<option value="text">Text only</option>
<option value="none">Disabled</option>
</select>
</li>
<li>
<a>Format:</a>
<select id="imageFormatSelector"
onchange="setImageFormat(value)">
<option value="image/png">PNG 24bit</option>
<option value="image/png8">PNG 8bit</option>
<option value="image/gif">GIF</option>
<option id="jpeg" value="image/jpeg">JPEG</option>
</select>
</li>
<li>
<a>Styles:</a>
<select id="imageFormatSelector"
onchange="setStyle(value)">
<option value="">Default</option>
</select>
</li>
<!-- Commented out for the moment, some code needs to be
extended in
order to list the available palettes
<li>
<a>Palette:</a>
<select id="paletteSelector"
onchange="setPalette(value)">
<option value="">None</option>
<option value="safe">Web safe</option>
</select>
</li>
-->
<li>
<a>Width/Height:</a>
<select id="widthSelector" onchange="setWidth(value)">
<!--
These values come from a statistics of the viewable
area given a certain screen area
(but have been adapted a litte, simplified numbers,
added some resolutions for wide screen)
You can find them here:
http://www.evolt.org/article/Real_World_Browser_Size_Stats_Part_II/20/2297/
--><option value="auto">Auto</option>
<option value="600">600</option>
<option value="750">750</option>
<option value="950">950</option>
<option value="1000">1000</option>
<option value="1200">1200</option>
<option value="1400">1400</option>
<option value="1600">1600</option>
<option value="1900">1900</option>
</select>
<select id="heigthSelector" onchange="setHeight(value)">
<option value="auto">Auto</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
<option value="600">600</option>
<option value="700">700</option>
<option value="800">800</option>
<option value="900">900</option>
<option value="1000">1000</option>
</select>
</li>
<li>
<a>Filter:</a>
<select id="filterType">
<option value="cql">CQL</option>
<option value="ogc">OGC</option>
<option value="fid">FeatureID</option>
</select>
<input type="text" size="80" id="filter"/>
<img id="updateFilterButton"
src="http://166.78.30.120/openlayers/img/east-mini.png"
onClick="updateFilter()" title="Apply filter"/>
<img id="resetFilterButton"
src="http://166.78.30.120/geoserver/openlayers/img/cancel.png"
onClick="resetFilter()" title="Reset filter"/>
</li>
</ul>
</div>
<div id="map">
<img id="options" title="Toggle options toolbar"
src="http://localhost:8080/geoserver/options.png"/>
</div>
<div id="wrapper">
<div id="location">location</div>
<div id="scale">
</div>
</div>
<div id="nodelist">
<em>Click on the map to get feature info</em>
</div>
</body>
</html>
Thanks.
From: Stefano Iacovella [mailto:stefano.iacovella@anonymised.com]
Sent: Wednesday, February 20, 2013 2:27 PM
To: jawendell@anonymised.com
Cc: Olivier Gagnon; geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] Layer Does Not Display
Pale white?
Is it possible you are sending getmap requests out of data extent?
Check with firebug or similar requests sent to GeoServes.
Cheers,
Stefano
Il giorno 20/feb/2013 20:22, "Jerome A. Wendell"
<jawendell@anonymised.com> ha scritto:
Stefano,
Thanks for your reply. No, the background is white.
Thanks.
From: Stefano Iacovella [mailto:stefano.iacovella@anonymised.com]
Sent: Wednesday, February 20, 2013 2:16 PM
To: jawendell@anonymised.com
Cc: geoserver-users@lists.sourceforge.net; Olivier Gagnon
Subject: Re: [Geoserver-users] Layer Does Not Display
Is the coloured background pink?
It is the default behaviour with Open Layers when tiles can not be
retrieved.
Il giorno 20/feb/2013 20:08, "Jerome A. Wendell"
<jawendell@anonymised.com> ha scritto:
Olivier,
Yes, I have tried zooming out max, and a couple of zoom levels before the
max a colored background shows up, but nothing else. I have been viewing
the page source in preview, and have tried to make adjustments to the layer
based on that, but so far have not been successful.
Thanks.
From: Olivier Gagnon [mailto:mcnolii@anonymised.com]
Sent: Wednesday, February 20, 2013 1:37 PM
To: jawendell@anonymised.com; geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] Layer Does Not Display
Have you tried zooming out max ? Sometimes the map isn't positioned at the
place we expect it to ...
As a final resort, open the layer in preview and then view page source ...
You'll find your answer in there
________________________________
From: jawendell@anonymised.com
To: mcnolii@anonymised.com; geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] Layer Does Not Display
Date: Wed, 20 Feb 2013 13:34:42 -0500
Olivier,
Thanks for your reply. Yes, I can see the layer in layer preview in
geoserver. I have tried just adding this layer to the map by itself, and
still cannot see anything.
Thanks.
From: Olivier Gagnon [mailto:mcnolii@anonymised.com]
Sent: Wednesday, February 20, 2013 1:11 PM
To: jawendell@anonymised.com; geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] Layer Does Not Display
Are you able to see it in layer preview in geoserver ?
Also check if no other layers is in front when viewing with openlayers ...
________________________________
From: jawendell@anonymised.com
To: geoserver-users@lists.sourceforge.net
Date: Wed, 20 Feb 2013 12:57:58 -0500
Subject: [Geoserver-users] Layer Does Not Display
I am new to GeoServer and have only been using OpenLayers for a short time.
I am trying to publish a shapefile that contains polygons. I have added
that layer to an OpenLayers map as a baselayer, but when I click on that
layer my overlay layers disappear and the background is completely white
with no polygons. Apparently I am doing something wrong, but being new to
both applications have not been able to determine what. The geoserver log
for trying to access that layer is below:
2013-02-20 11:08:15,211 INFO [geoserver.wms] -
Request: getServiceInfo
2013-02-20 11:08:15,257 INFO [geoserver.wms] -
Request: getMap
Filters = null
Tiled = false
Palette = null
SRS = EPSG:4326
FeatureVersion = null
Legend = false
Styles = [StyleImpl[ name=polygon]]
Layers = [org.geoserver.wms.MapLayerInfo@anonymised.com]
MaxFeatures = null
Bbox = ReferencedEnvelope[-85.107237200002 :
-75.256336986098, 35.485774122931 : 42.354468217391]
RemoteOwsType = null
RemoteOwsURL = null
Env = {}
FormatOptions = {}
Angle = 0.0
CQLFilter = null
Elevation =
FeatureId = null
StartIndex = null
ViewParams = null
Crs = GEOGCS["WGS 84",
DATUM["World Geodetic System 1984",
SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
UNIT["degree", 0.017453292519943295],
AXIS["Geodetic longitude", EAST],
AXIS["Geodetic latitude", NORTH],
AUTHORITY["EPSG","4326"]]
BgColor = java.awt.Color[r=255,g=255,b=255]
Transparent = false
SldBody = null
ValidateSchema = false
Sld = null
SldVersion = null
TilesOrigin = null
Exceptions = SE_XML
KMScore = 40
KMattr = true
Height = 357
Width = 512
Filter = null
Time =
Format = image/png
Buffer = 0
Request = GetMap
RawKvp =
{BBOX=-85.107237200002,35.485774122931,-75.256336986098,42.354468217391,
VERSION=1.1.1, FORMAT=image/png, SERVICE=WMS, HEIGHT=357,
LAYERS=wv_county:wv_county, REQUEST=GetMap, STYLES=, SRS=EPSG:4326,
WIDTH=512}
Get = true
BaseUrl = http://localhost:8080/geoserver/
RequestCharset = UTF-8
Version = 1.1.1
If anyone can help me figure out what I am doing wrong, I appreciate it
greatly.
Thanks in advance.
Jerome A. Wendell
------------------------------------------------------------------------------
Everyone hates slow websites. So do we. Make your web apps faster with
AppDynamics Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________ Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users