[OpenLayers-Users] pb with map.getZoom

christian bleau christian.bleau at gmail.com
Wed Jun 20 09:25:37 PDT 2012


no change   ..... (((((((((((((



Le 20 juin 2012 à 18:11, Olivier Terral-3 [via OSGeo.org] a écrit :

> Define your style variable like this:
> 
> var style = new OpenLayers.Style({ 
>  	externalGraphic: 'http://pofableau.com/openlayer/a_img/travauxorange.png', 
>  	graphicHeight: "${size}", 
>  	graphicWidth: "${size}" 
>  }, {
>  		context: { 
>  			size: function() { 
>  				return 60*18/map.getZoom(); 
>  			} 
>  		}
> 	}
> );
> 
> 
> Le 20 juin 2012 à 15:01, christian bleau a écrit :
> 
>> Hi Olivier and Steve, I try to follow your way but it din't work  It's sure I have forgot something ... http://pofableau.com/openlayer/multicouche.html the overlay code is ok for depart and calque but without possibility to scaling with panZoom. It's the pb exposed in the beginning of this topic. the overlay départ2 who use your recommandation isn't visible on the map I use this code :
>>  
>>   var style = new OpenLayers.Style(
>>   		OpenLayers.Util.applyDefaults(
>>        		{fillColor: "green", fillOpacity: 1, strokeColor: "black"},
>>   		  { 
>>   		   rules: [
>>         		new OpenLayers.Rule({
>> 			maxScaleDenominator: 200000000,
>> 			minScaleDenominator: 100000000,
>> 			symbolizer: { 
>> 			externalGraphic: 'a_img/travauxorange.png', 
>> 			graphicHeight: 60*18/10 , 
>> 			graphicWidth: 65*18/10
>> 			}
>> 		}),
>> 			new OpenLayers.Rule({
>> 			maxScaleDenominator: 100000000,
>> 			symbolizer: { 
>> 			externalGraphic: 'a_img/travauxorange.png', 
>> 			graphicHeight: 60*18/5, 
>> 			graphicWidth: 65*18/5
>> 			}
>> 		})										  	
>>     	   ]
>>     }));    					 		 				
>>   		
>>   	var depart = new OpenLayers.Layer.Vector("Depart", {
>>     	styleMap: new OpenLayers.StyleMap(style) });
>>     	
>>     	map.addLayer(depart);
>> Steve I wrote the following code for depart and calque but there is no change for scale the Image as you can see. May be It's necessary to have a time out for the script ?
>> var z= map.getScale();
>>  
>> var graphicWidth = 55;
>> var graphicHeight = 50;
>>  
>> var scaleFactorWidth =  graphicWidth * z;
>> var scaleFactorHeight = graphicHeight * z;
>>   
>>   		var depart2 = new OpenLayers.Layer.Vector("Départ2");
>> 		var feature = new OpenLayers.Feature.Vector(
>>  		new OpenLayers.Geometry.Point(2.534000,48.387000).transform(
>>           new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
>>           new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
>>         ),
>>  		{some:'data'},
>>  		{externalGraphic: 'a_img/travauxorange.png', graphicHeight: graphicHeight, graphicWidth: scaleFactorWidth});
>> 		depart2.addFeatures(feature);
>> 
>> Thank a lot for your help. Christian 
>> View this message in context: Re: pb with map.getZoom
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 
> Olivier Terral
> 
> 
>  
> GEOMATIC Ingénierie SA
> Société du groupe Ringier
> Chemin des Croisettes 26
> 1066 Epalinges
> www.geomatic.ch
> www.thevirtualcity.ch
> Tél:: +41 (21) 651 30 00
> Fax: +41 (21) 651 30 09
> 
> 
> 
> 
> 
> _______________________________________________ 
> Users mailing list 
> [hidden email] 
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://osgeo-org.1560.n6.nabble.com/pb-with-map-getZoom-tp4982396p4982774.html
> To unsubscribe from pb with map.getZoom, click here.
> NAML

Christian

Pof at Bleau









--
View this message in context: http://osgeo-org.1560.n6.nabble.com/pb-with-map-getZoom-tp4982396p4982777.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120620/28a12a3f/attachment.html>


More information about the Users mailing list