[OpenLayers-Users] I'm stupid?

Christopher Schmidt crschmidt at metacarta.com
Thu Jun 26 10:48:05 EDT 2008


On Thu, Jun 26, 2008 at 03:20:45PM +0200, David Martinez Morata wrote:
> Hy list, I start With OL " dais ago :S and I don't know javascript :SS!!
> But I start to developing some simple application... And at the first time
> was easy to  start (copy paste the code)...
> But now I have some problems with a gml layer, and I have the impression tha
> OL it's not more stable (maybe because I don't know javascript)...
> It's my 5 or 6 email to the list asking for a the same question. Problem
> with GML layer pan, they change the coordinates?!!!
> I start to play with projections and now the problem it's bigger.
> When I change the base layer... the map changes too!!!

You didn't follow the instructions previously given to you in email,
of moving the spherical mercator option into the correct place in your
GOogle Layer init. Until you do this, you will continue to have
problems.

> I don't understand anything:S this is the code i write:
> 
> <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
>   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
>   <head>
>   	<title>Test OpenLayers</title>
>     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
> 
>     <script type="text/javascript"
> src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAu_VBBdBvqz5BLcs7nrzUXBTtRbNeTxVoAy20KSc4Ig34aflRRhQFn5FeqUpODActln3OKR2UQ_14vg'></script>
>     <script type="text/javascript"
> src="http://openlayers.org/api/OpenLayers.js"></script>
> 		<script type="text/javascript">
> 
>         // make map available for easy debugging
>         var map;
> 
>         // avoid pink tiles
>         OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
>         OpenLayers.Util.onImageLoadErrorColor = "transparent";
> 
> 
>         function init(){
>             var options = {numZoomLevels: 20,
>                projection: new OpenLayers.Projection("EPSG:900913"),
>                displayProjection: new OpenLayers.Projection("EPSG:4623")};
> 
>               // Create a map Object
>             map = new OpenLayers.Map('map', options);
> 
>             // Create Google Mercator layers
>             var gmap = new OpenLayers.Layer.Google("Google
> Streets",{type: G_NORMAL_MAP},{"sphericalMercator": true});
>             var gsat = new OpenLayers.Layer.Google("Google
> Satellite",{type: G_SATELLITE_MAP},{"sphericalMercator": true});
>             var ghyb = new OpenLayers.Layer.Google("Google
> Hybrid",{type: G_HYBRID_MAP},{"sphericalMercator": true});
>             var gphy = new OpenLayers.Layer.Google("Google
> Physical",{type: G_PHYSICAL_MAP},{"sphericalMercator": true});
> //                Create a WFS Sites Layer
> 	           var sites = new OpenLayers.Layer.WFS( "Sites",
>                "http://10.192.160.133/cgi-bin/mapserv.exe?map=/ms4w/apps/Test/WFS_Test.map",
>                {typename: "Sites",maxfeatures: 100 },{
>                featureClass: OpenLayers.Feature.WFS});
> 
>            map.addLayer(new OpenLayers.Layer.GML("GML",
>            	"http://10.192.160.133/OpenLayers/ngo9_wgs84_01meu_cables_lille32.gml",
>             {format: OpenLayers.Format.GML,
>             formatOptions: {
>             	extractStyles: true,
>               extractAttributes: true}
>               },{projection: new OpenLayers.Projection("EPSG:4623")}
>    					  )
>  				);
> 
>             map.addLayers([gmap,gsat,ghyb,gphy,sites]);
>             map.addControl(new OpenLayers.Control.LayerSwitcher());
>             map.addControl(new OpenLayers.Control.ScaleLine);
>             map.addControl(new OpenLayers.Control.MousePosition());
>            if (!map.getCenter()) {map.zoomToMaxExtent()}
>         }
> 
>     function changezoom(x,y,z)
>     {
>     map.setCenter(new OpenLayers.LonLat(x, y), z);
>     }
>     function showAddress(address) {
>        var geocoder = new GClientGeocoder();
>      if (geocoder) {
>        geocoder.getLatLng(
>          address,
>          function(point) {
>            if (!point) {alert(address + " not found");}
>            else {map.setCenter(new OpenLayers.LonLat(point.x,point.y),15);}});}}
>   </script>
> 
> </head>
> <body onload="init()">
>   <div id="header">
>     <h1 id="title">Test OpenLayers</h1>
>     <form action="#" onsubmit="showAddress(this.address.value,
> this.countrycode.value); return false" >
>   		<p>Recherchez un adresse: <input type="text" size="60"
> id="address" value="" />
>     	&nbsp; <input type="submit"
> onclick="showAddress(document.getElementById('address').value); return
> false;" value="Go!" />
>     	</p>
> 
>     </form>
>   </div>
>   <div style="width:100%; height:85%" id="map"></div>
>   <div id="docs">
>  	</div>
> </body>
> </html>
> 
> And I don't know Wat to do...
> PLeeeeeeeeeeeeaaaaseeeeee help me!
> 
> Thanks a lot for your patience!

> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list