Erik Uzureau | 1 Aug 2008 03:42
Picon
Gravatar

[OpenLayers-Users] Z-ordering, Y-ordering, Markers with shadows!

Just a small note to notify people of some really cool new features that just got in to OpenLayers.
 
The related ticket is:
 
The patch was conceived and developed by Tim Coulter (funkyc) and allows you to do z-indexing
of elements in the vector layers... sweet! Furthermore, it includes code to handle "y-ordering" which
brings elements which are futher "down" (lower y value) on the map "in front" (higher zindex) of those
above. This is great for a cool pseudo-3d view. Cooler yet, all elements can now also have a background
graphic, conveniently designed to allow for drop shadows, making things even *more* 3d.
 
Kudos to Tim for a really great patch... check it out!
 
The examples to see it immediately are here:
 
 
This is one of the exciting new features that will be part of the 2.7 release,
so we are really keen to have people check it out and maybe play around
with it on their own sites, give us some feedback... enjoy!
 
 
_______________________________________________
Users mailing list
Users@...
http://openlayers.org/mailman/listinfo/users
Alan Boudreault | 1 Aug 2008 04:04
Gravatar

Re: [OpenLayers-Users] Fwd: Refresh html without losing, what I've done

You recreate a layer. You should not do that, you must redraw the same 
layer that is already added/draw on your map. (use javascript global 
variable)

Please, post your email on the mailing-list only.

Thanks,
Alan

David Calle wrote:
> Yeah, I try it.... check this please
> What's wrong...?
>
> ......
>             map.addLayers([ruta22, ruta8, manzanas, paradas8, 
> paradas22, recorridos]);
>             if (!map.getCenter()) map.zoomToMaxExtent();
>
>         redrawLayers(true);
>         setTimeout("redrawLayers(true)",10*1000);
> }
>
> function redrawLayers()
> {
>         var recorridos = new OpenLayers.Layer.MapServer.Untiled( 
> "Unidad()", "../../cgi-bin/mapserv",
>             {map:'C:/data/publicacion.map',
>             layers: 'recorrido',transparent: "true", map_imagetype: 
> 'png'});
>
>     recorridos.redraw(true);
> }
>
>            
>   </script>
>   </head>
>   <body onLoad="init()">
>     <table>
>       <tr>
>         <td align="left"><div id="map"></div></td>
>       </tr>
>   </table>
>   </body>
> </html>
>
>
> ......
>
>

--

-- 
Alan Boudreault
Mapgears
http://www.mapgears.com/ 
Jose A. C. | 1 Aug 2008 08:39
Picon

[OpenLayers-Users] Not change the size o polygons with zoom change

Hi!!

 

I'm making a map, and I need to create polygons on it that don´t change its size when the zoom of the map change. I don´t use a mark because I need to rotate it.

 

Has someone any idea about how I can do it?

 

I have another problem:  I draw different layers with different units and when it is draw the size of the figure is the same in spite of  having different measures unit (Km and inches). The code is:

 

vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", {style: layer_style});

            vectorLayer.units="mi";

            map.addLayer(vectorLayer);

           

            vectorLayer2 = new OpenLayers.Layer.Vector("Simple Geometry 2", {style: layer_style});

            vectorLayer2.units="km";

            map.addLayer(vectorLayer2);

 

var poligonoTriangulo = OpenLayers.Geometry.Polygon.createRegularPolygon(new OpenLayers.Geometry.Point(-20,40),5,3,0);

var triangulo = new OpenLayers.Feature.Vector(poligonoTriangulo,null,style_triangulo);

vectorLayer.addFeatures(triangulo);

   

var poligonoTriangulo2 = OpenLayers.Geometry.Polygon.createRegularPolygon(new OpenLayers.Geometry.Point(-0,40),5,3,0);

var triangulo2 = new OpenLayers.Feature.Vector(poligonoTriangulo2,null,style_triangulo);

vectorLayer2.addFeatures(triangulo2);

 

The units are km and mi, but the size of the figures on the map is the same.

 

 

Thanks!!!

_______________________________________________
Users mailing list
Users@...
http://openlayers.org/mailman/listinfo/users
Alexandre Dube | 1 Aug 2008 14:59

Re: [OpenLayers-Users] wfs stylemap example?

It worked for me, thanks Arnd.

I used this : 
OpenLayers.Feature.Vector.style['default']['cursor'] = 'crosshair';

Try 'default' instead of 'select'

Alexandre

Arnd Wippermann wrote:
> Instead of "select" try "crosshair". 
>
> I init my cursor for select with
> OpenLayers.Feature.Vector.style['select']['cursor'] = 'crosshair';, but it
> doesn't work. But when i select and then unselect a feature, then the cursor
> will change, when I hover over the feature.
>
> Perhaps it is bug. When I look in my application at the generated svg in
> firebug, there is no attribute "cursor". But after a select the attribute is
> added.
>
> Arnd Wippermann
>
>
> -----Ursprüngliche Nachricht-----
> Von: adube@...
[mailto:adube@...] 
> Gesendet: Donnerstag, 31. Juli 2008 15:44
> An: Christopher Schmidt
> Cc: Arnd Wippermann; users@...
> Betreff: Re: [OpenLayers-Users] wfs stylemap example?
>
> Christopher Schmidt wrote:
>   
>> Alternatively, set your strokeWidth to a larger number (I always use 3).
>>   
>>     
> Wow !  Haven't though about that but it's a simple and clever solution
> :)  Thanks.
>   
>> You can't change the color when hovering, but you can change the cursor:
>> set OpenLaeyrs.Feature.Vector['default'].cursor = "select"; and it 
>> will change the cursor when it is over a feature.
>>
>>   
>>     
> I think it's more like : 
> OpenLayers.Feature.Vector.style['default'].cursor = "select";  but it's not
> working.  The value "" of the cursor IS changed to "select", but that does
> nothing when my mouse is over a feature.
>
> In OpenLayers.Features, I have Vector and WFS.  I assumed that because my
> layer is WFS I had to change my cursor there but it has no style.
>
> Any ideas ?
>   
>> No real way to do that with the current code. Specifically, the reason 
>> is becasue the event is determined based on the browser saying "Here 
>> is the element that was under the mouse when the event triggered." But 
>> making the feature bigger will help.
>>
>>   
>>     
> I will try to think of something.
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
>   

--

-- 
Alexandre Dubé
Mapgears
www.mapgears.com
Christopher Schmidt | 1 Aug 2008 15:15

Re: [OpenLayers-Users] wfs stylemap example?

On Thu, Jul 31, 2008 at 10:44:51PM +0200, Arnd Wippermann wrote:
> Instead of "select" try "crosshair". 
> 
> I init my cursor for select with
> OpenLayers.Feature.Vector.style['select']['cursor'] = 'crosshair';, but it
> doesn't work. But when i select and then unselect a feature, then the cursor
> will change, when I hover over the feature.

Right, this is why I suggested setting it on 'default', not 'select':
setting it on select means that it will only happen after you've
selected it.

> Perhaps it is bug. When I look in my application at the generated svg in
> firebug, there is no attribute "cursor". But after a select the attribute is
> added.

Yep, it's a bug. Since the default cursor is '', when the code loops
through, it sets style properties back to defaults if they evaluate to
true, and '' evaluates to false, so it's never overridden. 

> Arnd Wippermann
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: adube@...
[mailto:adube@...] 
> Gesendet: Donnerstag, 31. Juli 2008 15:44
> An: Christopher Schmidt
> Cc: Arnd Wippermann; users@...
> Betreff: Re: [OpenLayers-Users] wfs stylemap example?
> 
> Christopher Schmidt wrote:
> >
> > Alternatively, set your strokeWidth to a larger number (I always use 3).
> >   
> Wow !  Haven't though about that but it's a simple and clever solution
> :)  Thanks.
> > You can't change the color when hovering, but you can change the cursor:
> > set OpenLaeyrs.Feature.Vector['default'].cursor = "select"; and it 
> > will change the cursor when it is over a feature.
> >
> >   
> I think it's more like : 
> OpenLayers.Feature.Vector.style['default'].cursor = "select";  but it's not
> working.  The value "" of the cursor IS changed to "select", but that does
> nothing when my mouse is over a feature.
> 
> In OpenLayers.Features, I have Vector and WFS.  I assumed that because my
> layer is WFS I had to change my cursor there but it has no style.
> 
> Any ideas ?
> > No real way to do that with the current code. Specifically, the reason 
> > is becasue the event is determined based on the browser saying "Here 
> > is the element that was under the mouse when the event triggered." But 
> > making the feature bigger will help.
> >
> >   
> I will try to think of something.
> 
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
> 
> _______________________________________________
> Users mailing list
> Users@...
> http://openlayers.org/mailman/listinfo/users

--

-- 
Christopher Schmidt
MetaCarta
Christopher Schmidt | 1 Aug 2008 15:21

Re: [OpenLayers-Users] Not change the size o polygons with zoom change

On Fri, Aug 01, 2008 at 08:39:54AM +0200, Jose A. C. wrote:
> I'm making a map, and I need to create polygons on it that don´t change its
> size when the zoom of the map change. I don´t use a mark because I need to
> rotate it.

Sounds like you want this:

http://openlayers.org/dev/examples/graphic-name.html 

There's a set of constants in OpenLayers.Renderer.symbol  in
OpenLayers.Renderer.Elements which you could extend.

> I have another problem:  I draw different layers with different units and
> when it is draw the size of the figure is the same in spite of  having
> different measures unit (Km and inches). The code is:

The units of the layer have no control over anything. Your units you are
providing are *map* units -- and the *name* you give to those units is
irrelevant. What you want to do is change the size of the units. If you
want to create something that's a different size, you need to provide
the correct size in current map units. (Your map is probably in
degrees.)

Regards,
--

-- 
Christopher Schmidt
MetaCarta
Alexandre Dube | 1 Aug 2008 15:48

[OpenLayers-Users] How does a renderer draw features ?

Hi list,

    I was wondering something : when we select a feature using a select 
or modify control, the feature changes its color...  In fact, I saw that 
it the renderer that draws a feature ( which draw geometry ) using a 
given style.

    My question is : does the renderer actually draw a new feature over 
the original one or it really changes the color ?  The renderer does not 
contain any feature, but it can draw features ?

    I'm trying to figure out how it works because I am able to "change" 
color when my mouse is over a feature without selecting it, but I'm 
trying to undo the changes as soon as the mouse isn't over anymore and 
it's not working.

    Here's a code snippet :

    var drawnGeometry = null;

    var styleBlue = OpenLayers.Util.extend(
        {},
        OpenLayers.Feature.Vector.style['default']);
    styleBlue.strokeColor = "blue";
    styleBlue.strokeWidth = 4;

function changeColorOnOverFeature(e){
    // if no feature is selected, then we want to change the color of a
    // feature when over it
    if (!getSelectedFeature(this)){
        if (drawnGeometry != null){
            this.renderer.eraseGeometry(drawnGeometry);  // I'm pretty 
sure this is wrong
            drawnGeometry = null;
        }
        else {
            oFeature = this.getFeatureFromEvent(e);
            if(oFeature){
                this.renderer.drawFeature(oFeature, styleBlue);
                drawnGeometry = oFeature.geometry;
            }
        }
    }
}

// inside my init()
oMap.events.register("mousemove", olWFSRoads, changeColorOnOverFeature);

Erasing the geometry makes the feature disappear, but it's still in the 
layer features, with no changes of its geometry and all...  I'm quite 
sure this is not the best way to do it.  Any clues ?

--

-- 
Alexandre Dubé
Mapgears
www.mapgears.com
lorkyo | 1 Aug 2008 17:00
Favicon

[OpenLayers-Users] WFS can't be shown. Can any one help me?

I wrote a page to show wms and  wfs, at the same time, but I can't get the WFS data show. the codes are listed below.It can only show the WMS data , I exchange the place of "topp:tasmania_water_bodies" and "topp:tasmania_state_boundaries", then it can only show the "topp:tasmania_state_boundaries"(WMS). I have check  the checkbox of the layerswitch,and these two layers is the of the same place and have the same SRS, I have used udig to open them:
 
var map, layer;
map = new OpenLayers.Map('map', {controls:[], 'projection': 'EPSG:4326', 'units':'degrees'});
  OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
         
          var bounds = new OpenLayers.Bounds(143.60260815000004,-43.851764249999995,148.71135685000002,-39.370182750000005)
  // setup untiled layer
          untiled = new OpenLayers.Layer.WMS.Untiled(
            "", "http://192.168.6.140:8080/geoserver/wms",
            {
              layers: 'topp:tasmania_water_bodies',
              styles: '',
              height: '382',
              width: '800',
              srs: 'EPSG:4326',
              format: 'image/png'
            },
               {maxExtent: bounds, maxResolution: 0.019956049609374915, projection: "EPSG:4326"}
          );
          untiled.ratio=1;
          untiled.setVisibility(false, false);
       map.addLayer(untiled);
       var roads = new OpenLayers.Layer.WFS(
                "Roads (WFS)",
                "http://192.168.6.140:8080/geoserver/wfs?",
                {  
               layers: 'topp:tasmania_state_boundaries',
                request: 'GetFeature',
                    maxfeatures: 100, visibility:true
                  },
 {maxExtent: bounds, maxResolution: 0.019956049609374915, projection: "EPSG:4326"});
       map.addControl(new OpenLayers.ControlPanZoomBar({div:$('nav')}));
          map.addControl(new OpenLayers.Control.MouseDefaults());
          map.addControl(new OpenLayers.Control.Scale($('scale')));
          map.addControl(new OpenLayers.Control.MousePosition({element: $('position')}));
          map.addControl(new OpenLayers.Control.LayerSwitcher());
          map.addControl(new OpenLayers.Control.OverviewMap());
          map.zoomToExtent(bounds);
         
                                                                                  lorkyo
 


22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多
_______________________________________________
Users mailing list
Users@...
http://openlayers.org/mailman/listinfo/users
David Calle | 1 Aug 2008 17:26
Picon

[OpenLayers-Users] Refresh an indepent Layer... every n seconds...

Hi List,

I have a map published with MapServer and OpenLayers, I need to refresh only of them,  every 10 seconds for example,  to simulate a GPS.
Apparently I could usage "redraw" but does not work ... o
I hope your help .. this is part of my publication... the layer is recorridos...

Or if there are another way tell me please...

<html>
  <head>
    <style type="text/css">
        #map {
            width: 900px;
            height: 600px;
        }
     </style>
    <title>Sistema de Trasporte Urbano  - Cuenca Ecuador </title>
    <script src="OpenLayers.js"></script>
    <script type="text/javascript">

        function init()
        {
            var mapOptions = {
            maxExtent: new OpenLayers.Bounds(713620.5057, 9673754.1986, 732936.3635, 9687405.8116),
            maxResolution: 'auto',
            projection:"EPSG:32717",
            units: "m"};

            var map = new OpenLayers.Map('map', mapOptions);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            var panel = new OpenLayers.Control.NavToolbar();
            map.addControl(panel);
             map.addControl(new OpenLayers.Control.MousePosition({'div':OpenLayers.Util.getElement('coords')}));

        var manzanas = new OpenLayers.Layer.MapServer.Untiled( "manzanas", "../../cgi-bin/mapserv",
            {map:'C:/data/publicacion.map',
            layers: 'manzanas',map_imagetype: 'png'}, {'displayInLayerSwitcher':false});

        var ruta22 = new OpenLayers.Layer.MapServer.Untiled( "Ruta 22", "../../cgi-bin/mapserv",
            {map:'C:/data/publicacion.map', transparent: "true",
            layers: 'ruta22_ida',map_imagetype: 'png'},{'isBaseLayer': false}, {'displayInLayerSwitcher':false});

        var recorridos = new OpenLayers.Layer.MapServer.Untiled( "Unidad()", "../../cgi-bin/mapserv",
            {map:'C:/data/publicacion.map',
            layers: 'recorrido',transparent: "true", map_imagetype: 'png'});
              ruta22.setVisibility(false);

            map.addLayers([ruta22, manzanas, recorridos]);
            if (!map.getCenter()) map.zoomToMaxExtent();
            setTimeout("Layer_redraw()",10*1000);
}

function Layer_redraw() {

    var name = 'Test Layer';
    var url = "../../cgi-bin/mapserv";
    var params = { map: 'C:/data/publicacion.map', 
               layers: 'recorrido',
               transparent: "true",
               map_imagetype: 'png'};

  
    var layer = new OpenLayers.Layer.WMS(name, url, params);
    var map = new OpenLayers.Map('map');
    map.addLayer(layer);
    layer.redraw(true);
}
  </script>
  </head>
  <body onLoad="init()">
    <table>
      <tr>
        <td align="left"><div id="map"></div></td>
      </tr>
  </table>
  </body>
</html>

Thanks for all...
_______________________________________________
Users mailing list
Users@...
http://openlayers.org/mailman/listinfo/users
Eric Lemoine | 1 Aug 2008 17:27
Picon

Re: [OpenLayers-Users] How does a renderer draw features ?

On Fri, Aug 1, 2008 at 3:48 PM, Alexandre Dube <adube@...> wrote:
> Hi list,
>
>    I was wondering something : when we select a feature using a select
> or modify control, the feature changes its color...  In fact, I saw that
> it the renderer that draws a feature ( which draw geometry ) using a
> given style.
>
>    My question is : does the renderer actually draw a new feature over
> the original one or it really changes the color ?

It changes its color.

> The renderer does not
> contain any feature, but it can draw features ?

Yes.

>    I'm trying to figure out how it works because I am able to "change"
> color when my mouse is over a feature without selecting it, but I'm
> trying to undo the changes as soon as the mouse isn't over anymore and
> it's not working.
>
>    Here's a code snippet :
>
>    var drawnGeometry = null;
>
>    var styleBlue = OpenLayers.Util.extend(
>        {},
>        OpenLayers.Feature.Vector.style['default']);
>    styleBlue.strokeColor = "blue";
>    styleBlue.strokeWidth = 4;
>
> function changeColorOnOverFeature(e){
>    // if no feature is selected, then we want to change the color of a
>    // feature when over it
>    if (!getSelectedFeature(this)){
>        if (drawnGeometry != null){
>            this.renderer.eraseGeometry(drawnGeometry);  // I'm pretty
> sure this is wrong
>            drawnGeometry = null;
>        }
>        else {
>            oFeature = this.getFeatureFromEvent(e);
>            if(oFeature){
>                this.renderer.drawFeature(oFeature, styleBlue);
>                drawnGeometry = oFeature.geometry;
>            }
>        }
>    }
> }
>
> // inside my init()
> oMap.events.register("mousemove", olWFSRoads, changeColorOnOverFeature);
>
>
> Erasing the geometry makes the feature disappear, but it's still in the
> layer features, with no changes of its geometry and all...  I'm quite
> sure this is not the best way to do it.  Any clues ?

You should use a feature handler (Handler.Feature) to detect
mouseover/mouseout on features. Look at the select feature control to
understand how to use it.

--
Eric

Gmane