[OpenLayers-Users] Could u help me?

Stephen Woodbridge woodbri at swoodbridge.com
Thu Sep 6 19:13:18 PDT 2012


First, please keep this questions on the list for two reasons.
1. so everyone can learn from the responses and they get archived so 
people can find them in web searchs
2. there are a lot of people on the list that can offer help and I might 
not be the best person to answer or I might be away and someone else can 
answer

When you get you page into you browser where is localhost relative to 
the browser? Do you have mapserver running on the machine the browser is 
running on? or do you have it running on your server?

-Steve

On 9/6/2012 9:16 PM, 李杨 wrote:
>
> when I define with
> .... MapServer("OSM map"," http://222.129.45.107
> <http://222.129.45.107/> /cgi-bin/mapserv?", ... http://222.129.45.107
> <http://222.129.45.107/> is my server IP, it will run. But when I define
> with localhost, or 127.0.0.1, it will not run?
>
> how is the problem?
>
> baseLayer = new OpenLayers.Layer.MapServer("OSM
> map","localhost/cgi-bin/mapserv?",{map:"/home/jack/osm-demo/basemaps/osm-google.map",layers:"all",map_image_type:"png"},{singleTile:true,ratio:1.0});
>
>
>
> --------------------------------------------
> this is my soucecode of the html page"
> ----------------------
> <!DOCTYPE html>
> 	<html>
> 	<head>
> 	<title>Openlayers Tutorial --basic maps setup</title>
> 	<script src="http://openlayers.org/api/OpenLayers.js"></script>
> 	<script type="text/javascript">
> 	var map,baseLayer;
> 	function init() {
> 	map = new OpenLayers.Map('map');
> 	baseLayer = new OpenLayers.Layer.MapServer("OSM
> map","localhost/cgi-bin/mapserv?",{map:"/home/jack/osm-demo/basemaps/osm-google.map",layers:"all",map_image_type:"png"},{singleTile:true,ratio:1.0});
>
> 	map.addLayer(baseLayer);
> 	map.setCenter(new OpenLayers.LonLat(0,0),1);
> 	}
> 	</script>
> 	
> 	<style>
> 	@media screen
> 	{
> 	#map{width: 500px; height:250px; border: 2px solid black;}
> 	
> 	
> 	}
> 	</style>
> 	</head>
> 	<body onload="init()">
> 	<h3>Openlayers Tutrial-basic map Setup</h3>
> 	<div id="map"></div>
> 	</body>
> 	</html>
>
> ------------------------------------------------------------------
> --
> Yang Li
> GIS Developer
> P.R.China
>
>



More information about the Users mailing list