Re: [OpenLayers-Users] IE7 vector rendering error
On Tuesday, September 1, 2009, Jo Cook wrote: > > Dear All, > > I am using revision 9635 of openlayers (via the MapFish svn), and have just > created a single file library for openlayers to speed up this page: > http://mapdata.thehumanjourney.net/vgswandb_new.html > > In IE7 (either using IETab or genuinely using IE7) I get the error "Your > browser does not support vector rendering. Currently supported renderers > are: SVG VML Canvas". This error occurs when the page is originally loaded, > and when you try and select a feature (by dragging a box around it), nothing > happens instead of it being highlighted and showing feature information as > it is supposed to. > > Previously I have had this error when trying to use the library.cfg file to > create my single file library, and I fixed it by adding lots of additional > includes, but this time I went for the full.cfg file instead, and still > have the error. A search of the mailing lists suggests this problem used to > occur in earlier releases, but should now be fixed. > > I have tested this page with the original multi-file version of OpenLayers > and it does not occur. Hi. VML.js is most probably not included in the built file. Edit the built file and search for "OpenLayers.Renderer.VML = OpenLayers.Class" to check that. Cheers, > > Thanks > > Jo > > > -- > View this message in context: > http://n2.nabble.com/IE7-vector-rendering-error-tp3561507p3561507.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > ___ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] created a new SR-ORG id on spatialreference.org but now need to revise the definition
Hi All, I created a new SR-ORG id on spatialreference.org (http://www.spatialreference.org/ref/sr-org/6728/proj4js/) but now, I need to revise some of its definition (proj4js's +lat_ts=90 needs to be +lat_ts=60 ). Also, must one absolutely go through the WKT definition to define the SR-ORG id? Is it possible to define the SR-ORG id strictly from a proj4js definition? SP. Stephane Poirier, M.Sc. Optic Physics Remote Sensing Application Software Developer 3532 rue Sainte-Famille, Apt. 4 Montreal, QC, H2X 2L1, Canada stephane.pe.poir...@gmail.com Tel.: (514) 509-8833 Fax: (514) 509-8833 ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Can OpenLayers APIs merge line features
Kevin Yang wrote: > Hello everyone, > A problem troubled me for a long time. Can OpenLayers APIs merge line > features ?I use this function to solve the following problem: When I > calculate the shortest path, I get the WKTs of the LineStrings, but it is > not arranged in sequence.So I cannot use the marker' MoveTo method to > implement the effct of a little car picture going along the shortest path > in sequence from start-node to end-node. Thus I want to consult you that Can > OpenLayers APIs merge line features ,and how to do it, or is there other > ways to solve this problem properly? Thank you very much! > best regards, > Yang I had a similar problem and was using pgRouting. The way I solved it was to have my Ajax server the gets the results from pgRouting do some additional checking and flip the segments so they are all in the same direction along the path. Basically, the segments are returned in the order of first to last, but because you might traverse a segment in the opposite direction than that which it is stored in the database you get the segment in reverse order. Your segments are all stored with A as the start and B as the end. Then you might get results back like: 1 2 3 4 5 6 AB,AB,BA,AB,BA,BA,etc So you have to first see if the first segment needs to be flipped: if 1A == 2A or 1A == 2B then flip first segment, for i=2 through N { if (i-1)B == iB then flip segment i } now all the segments should be in the correct end to end order. and you can just chain them all together. I'm sure you can do the same in Javascript. -Steve W. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] Can OpenLayers APIs merge line features
Hello everyone, A problem troubled me for a long time. Can OpenLayers APIs merge line features ?I use this function to solve the following problem: When I calculate the shortest path, I get the WKTs of the LineStrings, but it is not arranged in sequence.So I cannot use the marker' MoveTo method to implement the effct of a little car picture going along the shortest path in sequence from start-node to end-node. Thus I want to consult you that Can OpenLayers APIs merge line features ,and how to do it, or is there other ways to solve this problem properly? Thank you very much! best regards, Yang -- View this message in context: http://n2.nabble.com/Can-OpenLayers-APIs-merge-line-features-tp3564159p3564159.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Create feature from sketch by imitating a bouble-click event
Andreas Hocevar wrote: > Hi Amit, > > why don't you just use a DrawFeature control with a Path handler on a > vector layer and listen to the layer's sketchmodified event, checking > for feature.geometry.components.length? > > var layer = new OpenLayers.Layer.Vector("result"); > var control = new OpenLayers.Control.DrawFeature(layer, > OpenLayers.Handler.Path); > layer.events.on({ > sketchmodified: function(evt) { > if(evt.feature.geometry.component.length == 2) { > The above line should read if(evt.feature.geometry.components.length == 2) { Regards, Andreas. > control.handler.finalize(); > } > } > ); > > You will then have the feature on your layer. Nothing else to do. > > Regards, > Andreas. > > Amit Andersen wrote: > >> Hi All >> >> I wonder if there is a good reason why my post is being ignored. >> Is it to hard or is the problem posted not clear enough? >> >> Mails with different problems have been streaming to my mailbox, and got an >> answer quite fast. Kan someone write back if my post is not answerable in >> some way.. :-) >> >> Thanks >> Amit >> >> >> Amit Andersen wrote: >> >> >>> Hi >>> >>> This should be a simple question. >>> I'm working on limiting a path to one single line. What I did was to fire >>> a function on "Point" event. A global var is counting the points created. >>> In this function when the global var is 2, I have an alert which pops up >>> fine. >>> >>> What I want to do instead of the alert, is create the feature from the >>> line sketch on second single-click. Basically imitate a double-click event >>> on the second single-click. >>> >>> This is my DrawFeature control: >>> >>> ... >>> line: new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.Path, >>> {callbacks: { "point": this.TwoClickPath.bind(this) }}), >>> ... >>> >>> And this is the function that is being fired: >>> >>> TwoClickPath: function(e) { >>> this.TwoClickPathCount++; >>> if (this.TwoClickPathCount == 2) { >>> /* >>> Here I want to create the a feature out of the sketch (which >>> is a single line) >>> */ >>> // alert(""); fires ok >>> controls.line.deactivate(); >>> this.TwoClickPathCount = 0; >>> } >>> }, >>> >>> Thanks in advance for any reply. >>> Amit >>> >>> >>> >> >> > > > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Create feature from sketch by imitating a bouble-click event
Hi Amit, why don't you just use a DrawFeature control with a Path handler on a vector layer and listen to the layer's sketchmodified event, checking for feature.geometry.components.length? var layer = new OpenLayers.Layer.Vector("result"); var control = new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path); layer.events.on({ sketchmodified: function(evt) { if(evt.feature.geometry.component.length == 2) { control.handler.finalize(); } } ); You will then have the feature on your layer. Nothing else to do. Regards, Andreas. Amit Andersen wrote: > Hi All > > I wonder if there is a good reason why my post is being ignored. > Is it to hard or is the problem posted not clear enough? > > Mails with different problems have been streaming to my mailbox, and got an > answer quite fast. Kan someone write back if my post is not answerable in > some way.. :-) > > Thanks > Amit > > > Amit Andersen wrote: > >> Hi >> >> This should be a simple question. >> I'm working on limiting a path to one single line. What I did was to fire >> a function on "Point" event. A global var is counting the points created. >> In this function when the global var is 2, I have an alert which pops up >> fine. >> >> What I want to do instead of the alert, is create the feature from the >> line sketch on second single-click. Basically imitate a double-click event >> on the second single-click. >> >> This is my DrawFeature control: >> >> ... >> line: new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.Path, >> {callbacks: { "point": this.TwoClickPath.bind(this) }}), >> ... >> >> And this is the function that is being fired: >> >> TwoClickPath: function(e) { >> this.TwoClickPathCount++; >> if (this.TwoClickPathCount == 2) { >> /* >> Here I want to create the a feature out of the sketch (which >> is a single line) >> */ >> // alert(""); fires ok >> controls.line.deactivate(); >> this.TwoClickPathCount = 0; >> } >> }, >> >> Thanks in advance for any reply. >> Amit >> >> > > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] problem selecting vector features with labels - Potential IE bug
:o must have missed it, I'll try to commit tomorrow, please feel free to go ahead and commit if you have the code ready to commit now. Cheers Paul On 2009-09-01, at 3:31 PM, Andreas Hocevar wrote: > Hey Paul, > > Paul Spencer wrote: >> perhaps http://trac.openlayers.org/ticket/2148 is relevant >> > > I marked this ticket "Commit" a long time ago, after adding a slightly > modified patch. Can you please commit? > > One thought though, after reading this thread: maybe labelSelect > should > be true by default. > > > Thanks > Andreas. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] How Do I Contribute to the User Examples?
Hey Bill- thanks for your efforts on cursors documentation. You could provide a user example (in http://openlayers.org/dev/examples/) and link to it from the wiki. To do so, please create a ticket and provide a patch (see http://trac.openlayers.org/wiki/HowToContribute). Another option would be to create a ticket and patch against http://svn.openlayers.org/trunk/doc/, which is the file structure that creates http://docs.openlayers.org. Unfortunately this would require to convert the wiki content that you already created to rst. Let me know if you have more questions or need further assistance. Regards, Andreas. Bill Thoen wrote: > I didn't get any response when I asked this last Sunday, so I thought > I'd try again on a week day when everybody's less busy. > > I've recently put together a map demonstration and a short tutorial that > explains a bit about creating and using custom and built-in cursors in > OpenLayers that I'd like to contribute to the community. I know how to > post the text part to the wiki, but how do I add the map that goes with > it? Is there a procedure for uploading working demos, or should I just > post the map code with the article? This demo map is styled after the > ones in the Examples (at http://openlayers.org/dev/examples/), so it > runs quick and takes up little space. So if someone could tell me how I > should add my two or three grains of knowledge to the documentation, I'd > appreciate it. > > Regards, > - Bill Thoen > > ___ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] problem selecting vector features with labels - Potential IE bug
Hey Paul, Paul Spencer wrote: > perhaps http://trac.openlayers.org/ticket/2148 is relevant > I marked this ticket "Commit" a long time ago, after adding a slightly modified patch. Can you please commit? One thought though, after reading this thread: maybe labelSelect should be true by default. Thanks Andreas. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] Show Icons only in Zoom 9 to 16
hallo ! is it possible to show Icons only in a define zoom-area (9-16) ? regards Jan :-) ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] WMSGetFeatureInfo doesnt seem to work
Hi guys, Currently I try to find my way in to OpenLayers. The problem, I'm currently facing, is that this code: function load () { var map = new OpenLayers.Map('map'); var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://labs.metacarta.com/wms/vmap0";, { layers: 'basic', //srs: 'EPSG:31467', format: 'image/gif' } ); var studiwohn = new OpenLayers.Layer.WMS( "Studentenwohnheime ", "http://localhost:8080/geoserver/wms";, { layers: 'topp:Studentenwohnheime', //srs: 'EPSG:31467', transparent: 'true', format: 'image/gif' } ); map.addLayers([wms, studiwohn]); map.zoomToMaxExtent(); var info = new OpenLayers.Control.WMSGetFeatureInfo({ url: 'http://localhost:8080/geoserver/wms', title: 'Identify features by clicking', queryVisible: true, eventListeners: { getfeatureinfo: function(event) { map.addPopup(new OpenLayers.Popup.FramedCloud( "chicken", map.getLonLatFromPixel(event.xy), null, event.text, null, true )); } } }); map.addControl(info); info.activate(); map.addControl(new OpenLayers.Control.LayerSwitcher()); } doesn't work very well, when I click on one of my features in the Layer "Studentenwohnheime", i can see that a query is submitted to the server, but no result is being sent back. Kind regards, Dominik -- View this message in context: http://n2.nabble.com/WMSGetFeatureInfo-doesnt-seem-to-work-tp3561729p3561729.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] IE7 vector rendering error
Dear All, I am using revision 9635 of openlayers (via the MapFish svn), and have just created a single file library for openlayers to speed up this page: http://mapdata.thehumanjourney.net/vgswandb_new.html In IE7 (either using IETab or genuinely using IE7) I get the error "Your browser does not support vector rendering. Currently supported renderers are: SVG VML Canvas". This error occurs when the page is originally loaded, and when you try and select a feature (by dragging a box around it), nothing happens instead of it being highlighted and showing feature information as it is supposed to. Previously I have had this error when trying to use the library.cfg file to create my single file library, and I fixed it by adding lots of additional includes, but this time I went for the full.cfg file instead, and still have the error. A search of the mailing lists suggests this problem used to occur in earlier releases, but should now be fixed. I have tested this page with the original multi-file version of OpenLayers and it does not occur. Thanks Jo -- View this message in context: http://n2.nabble.com/IE7-vector-rendering-error-tp3561507p3561507.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] How to call a function that sets attributes for features added by drawfeature-control
Hi Max, I'm not sure about what could be the best approach. My guess would be to define a stylemap with your default 'default' and 'select' styles for newly added features, then when your user choose a color for the feature, add a rule based on the feature id. Have you checked : http://trac.openlayers.org/wiki/Styles ? It could helps to learn more about this. Also, an example with unique rules : http://openlayers.org/dev/examples/styles-unique.html Regards, Alexandre Max Stephan wrote: > Hi Alexandre, > > I got it working now. The Problem was that in the function that was > triggered by the featureadded-event I tried something like feature.id and > not evt.feature.id. > I registered the event via > "drawFeatureControlName.events.register("featureadded", ' ' , function)". > > But, as always, one problem solved and another one evolves. As said before I > want to apply a user-customizable style to each feature added. I´ve done > this for example via "evt.feature.style = {fillcolor: "#FF9933", > pointRadius: 10, strokeColor: 'black'}" and after that I´m redrawing the > feature via "vectorLayer.drawFeature(evt.feature)". This works and the point > is symbolized in the planned way. But when I select one of those points on > the map the radius shrinks (I guess to the size of the default-style for > point-Vectorfeatures) and the stroke is gone. Even when I unselect the > feature it stays in this changed style. Now I tried to apply a stylemap with > default- and selectStyle to the feature but that didn´t have any effect (the > points stayed in their default-orange-style). > > Any idea how to solve this problem? Rulebased styling via a layerwide > stylemap is no option cause as said above the user should be able to choose > color etc. independently. > > Greets and thx for your help > Max Stephan > > Alexandre Dube wrote: > >> Hi Max, >> >> Here's an old demo that could help you for some of your needs : >> >> http://dev4.mapgears.com/bdga/bdgaWFS-T.html >> >> Simply click on a feature. This demonstrate a way to edit feature's >> attributes in a form. If your data is stored in a DB, you don't need to >> take care of the id manually. The DB will automatically generate one. >> >> The example is using WFS-T to TinyOWS connected to a PostGIS DB. >> >> Best of luck, >> >> Alexandre >> >> Max Stephan wrote: >> >>> Hi list, >>> >>> I´m actually implementing a drawfeature-control for my web-GIS. >>> Everything´s >>> working fine so far but now I want to add a little more functionality: >>> - the user should be able to specify the appearance of the features he´s >>> adding. This shall only have an effect on the features he´s adding after >>> specifying the style (so a change of the general vectorlayer-Style is not >>> useful) >>> - each feature should get a unique ID whose format I´d like to specify >>> and >>> which is generated by a script-wide counter for example >>> >>> For both of this cases I thought of the event featureadded. But I´m >>> having >>> some trouble with it. Here´s what I tried: >>> >>> 1. event-listener on the layer to which the features are added: >>> >>> example: vectorLayer.events.register('featureadded', vectorlayer, >>> testFunction); >>> >>> 2. event-listener on the handler for drawfeature-control (same as above >>> but >>> with vectorLayer being replaced by the drawfeature-control) >>> >>> 3. event-listener in this form: >>> >>> vectorLayer.events.on("featureadded": testFunction, ...); >>> >>> The testFunction is meant to specify the attributes like style, id etc. >>> on >>> the feature that was added. The function is executed (tested it with an >>> alert). >>> >>> The problem is that it´s not possible to select features on this layer >>> (the >>> other vectorlayers are still working) when using the >>> featureadded-listener. >>> But I need to be able to select features to modify it´s attributes later >>> on >>> or to clear them via a form. >>> >>> I also thought of using the create-callback of the point-handler but >>> don´t >>> know how to implement it. >>> >>> Any ideas and help is appreciated. >>> Thx in advance >>> Max Stephan >>> >>> >> -- >> Alexandre Dubé >> Mapgears >> www.mapgears.com >> >> ___ >> Users mailing list >> Users@openlayers.org >> http://openlayers.org/mailman/listinfo/users >> >> >> > > -- Alexandre Dubé Mapgears www.mapgears.com ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] Markers and IDs
Hello everybody, I'm setting up a map which uses markers, and when the user clicks the marker an information box is loaded with an ajax request. I need to identify the markers (the ID of the ddbb row for example) so I can retrieve the right information from the ddbb. Right now I'm using the text layer but I need to load a lot of information so this is not a valid approach. Could someone help me with this? Thank you very much. Adrián Ribao. signature.asc Description: This is a digitally signed message part. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Style WFS layer by attributes
Jerome Freyre wrote: > > Try to apply a stylemap to your vector layer. > Yes! It worked :D Thank you very much Jerome -- View this message in context: http://n2.nabble.com/Style-WFS-layer-by-attributes-tp3559456p3560917.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] How to call a function that sets attributes for features added by drawfeature-control
Hi Alexandre, I got it working now. The Problem was that in the function that was triggered by the featureadded-event I tried something like feature.id and not evt.feature.id. I registered the event via "drawFeatureControlName.events.register("featureadded", ' ' , function)". But, as always, one problem solved and another one evolves. As said before I want to apply a user-customizable style to each feature added. I´ve done this for example via "evt.feature.style = {fillcolor: "#FF9933", pointRadius: 10, strokeColor: 'black'}" and after that I´m redrawing the feature via "vectorLayer.drawFeature(evt.feature)". This works and the point is symbolized in the planned way. But when I select one of those points on the map the radius shrinks (I guess to the size of the default-style for point-Vectorfeatures) and the stroke is gone. Even when I unselect the feature it stays in this changed style. Now I tried to apply a stylemap with default- and selectStyle to the feature but that didn´t have any effect (the points stayed in their default-orange-style). Any idea how to solve this problem? Rulebased styling via a layerwide stylemap is no option cause as said above the user should be able to choose color etc. independently. Greets and thx for your help Max Stephan Alexandre Dube wrote: > > Hi Max, > > Here's an old demo that could help you for some of your needs : > > http://dev4.mapgears.com/bdga/bdgaWFS-T.html > > Simply click on a feature. This demonstrate a way to edit feature's > attributes in a form. If your data is stored in a DB, you don't need to > take care of the id manually. The DB will automatically generate one. > > The example is using WFS-T to TinyOWS connected to a PostGIS DB. > > Best of luck, > > Alexandre > > Max Stephan wrote: >> Hi list, >> >> I´m actually implementing a drawfeature-control for my web-GIS. >> Everything´s >> working fine so far but now I want to add a little more functionality: >> - the user should be able to specify the appearance of the features he´s >> adding. This shall only have an effect on the features he´s adding after >> specifying the style (so a change of the general vectorlayer-Style is not >> useful) >> - each feature should get a unique ID whose format I´d like to specify >> and >> which is generated by a script-wide counter for example >> >> For both of this cases I thought of the event featureadded. But I´m >> having >> some trouble with it. Here´s what I tried: >> >> 1. event-listener on the layer to which the features are added: >> >> example: vectorLayer.events.register('featureadded', vectorlayer, >> testFunction); >> >> 2. event-listener on the handler for drawfeature-control (same as above >> but >> with vectorLayer being replaced by the drawfeature-control) >> >> 3. event-listener in this form: >> >> vectorLayer.events.on("featureadded": testFunction, ...); >> >> The testFunction is meant to specify the attributes like style, id etc. >> on >> the feature that was added. The function is executed (tested it with an >> alert). >> >> The problem is that it´s not possible to select features on this layer >> (the >> other vectorlayers are still working) when using the >> featureadded-listener. >> But I need to be able to select features to modify it´s attributes later >> on >> or to clear them via a form. >> >> I also thought of using the create-callback of the point-handler but >> don´t >> know how to implement it. >> >> Any ideas and help is appreciated. >> Thx in advance >> Max Stephan >> > > > -- > Alexandre Dubé > Mapgears > www.mapgears.com > > ___ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > > -- View this message in context: http://n2.nabble.com/How-to-call-a-function-that-sets-attributes-for-features-added-by-drawfeature-control-tp3559596p3560721.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] How to replace country color with image ?
Jerome, I don't know anything about your application and the infrastructure that you are running it on. If you are using MapServer to serve WMS or WFS layers to your OpenLayers app, I have a different approach that could work for you. Instead of using an OpenLayers vector layer, you could use a WMS layer, where the styling is done on the server. MapServer can use an image to color the fill of a polygon. There are examples here (near the bottom of the document): http://mapserver.org/mapfile/symbology/construction.html?highlight=symbols David. On Tue, Sep 1, 2009 at 1:06 AM, Jerome Freyre wrote: > Hi Jan, > I search for a solution but without success... I tried some scripts but it > was the same result... nothing! > I think it is not possible to define a background picture for a polygon but > only for features like points... > And unfortunately, I have no other options for now ... > Best regards, > Jérome > > Le 31 août 09 à 14:37, Jan.Sørensen (via Nabble) a écrit : > > Hi Jerome, > > Thanks for the reply. > I tried using the externalGraphic, but without much success. > The code is as follows: > > var stylemap = new OpenLayers.StyleMap({externalGraphic: > '/images/country.jpg'}); > > in my _buildStyle function where I define theme and rules respectively. > > The problem is that when I define colors for onSelect event its ok: > > var stylemap = new OpenLayers.StyleMap({'default':theme, 'select': > {'strokeColor': '#59bce6', 'fillColor': '#59bce6', 'strokeWidth': 1}}); > > I read this sample: http://docs.openlayers.org/library/feature_styling.html > and the only difference is that I am using GML instead of vectors. > > Could that be the problem ? > > Cheers, > js > > Jerome Freyre wrote: > Hi Jan, > > maybe you can use the property > > externalGraphic : myStaticImage > > in the style definition > > Sincerly, > Jérome > > > Jan.Sørensen wrote: > Hi, > > I'm pretty new to Open Layers, so probably I'm looking for something obvious > :) > > I want to fill country with instead of a color with a static image > Up to now I have a default style that upon mouse over I successfully changes > color of the country that mouse cursor is currently on. > > Anyone can give me a shot ? > > Cheers, > JS > > > > View this message in context: Re: [OpenLayers-Users] How to replace country > color with image ? > Sent from the OpenLayers Users mailing list archive at Nabble.com. > > ___ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > > ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Style WFS layer by attributes
Try to apply a stylemap to your vector layer. // Creation of a stylemap myStyles = new OpenLayers.StyleMap({ "default": new OpenLayers.Style({ strokeColor: "${getFillColor}", fillColor: "${getFillColor}", strokeWidth: 2, strokeOpacity: 1, fillOpacity: 0.7, pointRadius: 5 },{ context: { getFillColor:function(feature) { if (feature.attributes.state == true) return '#00FF00'; else if (feature.attributes.state == false) return '#FF'; } } }) ,"select": new OpenLayers.Style({ fillColor: "#0FF", strokeColor: "#FF", pointRadius: 6 }), "hover": new OpenLayers.Style({ fillColor: "#CC", strokeColor: "#99", pointRadius: 6 }) }); // Create a vector layer and give it your style map. var points = new OpenLayers.Layer.Vector( 'Points', {styleMap: myStyles} ); if you still have problems, please send you script, i'll try to debug Jérome Le 1 sept. 09 à 15:48, AlessioDL (via Nabble) a écrit : > Hi Jerome, > > probably I don't understood exactly how to apply your suggestion... > > If I use "new OpenLayers.Style" I can't apply any style to my > features. > The only way to style them appear to be: > OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']) > > So I need to do something like > > //Vector layer style > var area_style = OpenLayers.Util.extend({}, > OpenLayers.Feature.Vector.style['default']); > > if (feature.attributes.myattribute == 'myvalue') { > area_style.strokeWidth = 1.5; > area_style.strokeColor = "#ff"; > area_style.fillOpacity = 0.75; > } else { > ... > } > > but it does not work (feature is undefined)... > > View message @ > http://n2.nabble.com/Style-WFS-layer-by-attributes-tp3559456p3560624.html > To unsubscribe from Re: Style WFS layer by attributes, click here. > -- View this message in context: http://n2.nabble.com/Style-WFS-layer-by-attributes-tp3559456p3560660.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Style WFS layer by attributes
Hi Jerome, probably I don't understood exactly how to apply your suggestion... If I use "new OpenLayers.Style" I can't apply any style to my features. The only way to style them appear to be: OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']) So I need to do something like //Vector layer style var area_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); if (feature.attributes.myattribute == 'myvalue') { area_style.strokeWidth = 1.5; area_style.strokeColor = "#ff"; area_style.fillOpacity = 0.75; } else { ... } but it does not work (feature is undefined)... -- View this message in context: http://n2.nabble.com/Style-WFS-layer-by-attributes-tp3559456p3560624.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] How to call a function that sets attributes for features added by drawfeature-control
Hi Max, Here's an old demo that could help you for some of your needs : http://dev4.mapgears.com/bdga/bdgaWFS-T.html Simply click on a feature. This demonstrate a way to edit feature's attributes in a form. If your data is stored in a DB, you don't need to take care of the id manually. The DB will automatically generate one. The example is using WFS-T to TinyOWS connected to a PostGIS DB. Best of luck, Alexandre Max Stephan wrote: > Hi list, > > I´m actually implementing a drawfeature-control for my web-GIS. Everything´s > working fine so far but now I want to add a little more functionality: > - the user should be able to specify the appearance of the features he´s > adding. This shall only have an effect on the features he´s adding after > specifying the style (so a change of the general vectorlayer-Style is not > useful) > - each feature should get a unique ID whose format I´d like to specify and > which is generated by a script-wide counter for example > > For both of this cases I thought of the event featureadded. But I´m having > some trouble with it. Here´s what I tried: > > 1. event-listener on the layer to which the features are added: > > example: vectorLayer.events.register('featureadded', vectorlayer, > testFunction); > > 2. event-listener on the handler for drawfeature-control (same as above but > with vectorLayer being replaced by the drawfeature-control) > > 3. event-listener in this form: > > vectorLayer.events.on("featureadded": testFunction, ...); > > The testFunction is meant to specify the attributes like style, id etc. on > the feature that was added. The function is executed (tested it with an > alert). > > The problem is that it´s not possible to select features on this layer (the > other vectorlayers are still working) when using the featureadded-listener. > But I need to be able to select features to modify it´s attributes later on > or to clear them via a form. > > I also thought of using the create-callback of the point-handler but don´t > know how to implement it. > > Any ideas and help is appreciated. > Thx in advance > Max Stephan > -- Alexandre Dubé Mapgears www.mapgears.com ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Where to get map servers that can be used by openlayers
Hi, I think you have to look at www.openstreetmap.org Else, you have to googlise "public wms" and the first result seems to be useful http://www.skylab-mobilesystems.com/en/wms_serverlist.html ;) Best Regards, Jérome balachandra maddina wrote: > > Hi There, > > Im pretty new to maps(gis systems) and openlayers. i looked at some of > the > examples provided in openlayes documentation and saw few real time > deployments using openlayers im trying to get a similar view like google > maps but i dont want to use commercial data to display a map. i hard there > are open servers available providing map data. bu im not sure where these > are located. could any one point me to any such list please. > > any help would be appreciated. > > Thank you, > bala. > > ___ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > > -- View this message in context: http://n2.nabble.com/Where-to-get-map-servers-that-can-be-used-by-openlayers-tp3554802p3560077.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Style WFS layer by attributes
Hi Alessio, You can define a style and, depending a context, assign different value. Here is an example that change the fillcolor of feature depending on the attribute "state" of each feature. Note that the context is automatically applied to features. Nothing to activate ;) new OpenLayers.Style({ strokeColor: "${getFillColor}", fillColor: "${getFillColor}", strokeWidth: 2, strokeOpacity: 1, fillOpacity: 0.7, pointRadius: 5 },{ context: { getFillColor:function(feature) { // Green if state is true if (feature.attributes.state == true) return '#00FF00'; // Red if state is false else if (feature.attributes.state == false) return '#FF'; } } }) AlessioDL wrote: > > Hi, > > I have this WFS layer from my UMN-Mapserver > > //Vector layer style > var area_style = OpenLayers.Util.extend({}, > OpenLayers.Feature.Vector.style['default']); > area_style.strokeWidth = 1.5; > area_style.strokeColor = "#ff"; > area_style.fillOpacity = 0.75; > > > //Layer definition > qAreas = new OpenLayers.Layer.Vector("WFS", > { > strategies: [new OpenLayers.Strategy.BBOX()], > filter: propertyFilter, > style:area_style, > protocol: new OpenLayers.Protocol.WFS({ > url: wfsURL, > extractAttributes:true, > featureType: "QueryAreas", > geometryName:"the_geom" > }) > }); > > > I'd like to use an attribute value to style things differently > (for example, if the value of the attribute named type is "A" the > corresponding polygons bacame red and if it is "B" they became blue) > > Can you help me? :-) > > -- View this message in context: http://n2.nabble.com/Style-WFS-layer-by-attributes-tp3559456p3559667.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] How to call a function that sets attributes for features added by drawfeature-control
Hi list, I´m actually implementing a drawfeature-control for my web-GIS. Everything´s working fine so far but now I want to add a little more functionality: - the user should be able to specify the appearance of the features he´s adding. This shall only have an effect on the features he´s adding after specifying the style (so a change of the general vectorlayer-Style is not useful) - each feature should get a unique ID whose format I´d like to specify and which is generated by a script-wide counter for example For both of this cases I thought of the event featureadded. But I´m having some trouble with it. Here´s what I tried: 1. event-listener on the layer to which the features are added: example: vectorLayer.events.register('featureadded', vectorlayer, testFunction); 2. event-listener on the handler for drawfeature-control (same as above but with vectorLayer being replaced by the drawfeature-control) 3. event-listener in this form: vectorLayer.events.on("featureadded": testFunction, ...); The testFunction is meant to specify the attributes like style, id etc. on the feature that was added. The function is executed (tested it with an alert). The problem is that it´s not possible to select features on this layer (the other vectorlayers are still working) when using the featureadded-listener. But I need to be able to select features to modify it´s attributes later on or to clear them via a form. I also thought of using the create-callback of the point-handler but don´t know how to implement it. Any ideas and help is appreciated. Thx in advance Max Stephan -- View this message in context: http://n2.nabble.com/How-to-call-a-function-that-sets-attributes-for-features-added-by-drawfeature-control-tp3559596p3559596.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] Style WFS layer by attributes
Hi, I have this WFS layer from my UMN-Mapserver //Vector layer style var area_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); area_style.strokeWidth = 1.5; area_style.strokeColor = "#ff"; area_style.fillOpacity = 0.75; //Layer definition qAreas = new OpenLayers.Layer.Vector("WFS", { strategies: [new OpenLayers.Strategy.BBOX()], filter: propertyFilter, style:area_style, protocol: new OpenLayers.Protocol.WFS({ url: wfsURL, extractAttributes:true, featureType: "QueryAreas", geometryName:"the_geom" }) }); I'd like to use an attribute value to style things differently (for example, if the value of the attribute named type is "A" the corresponding polygons bacame red and if it is "B" they became blue) Can you help me? :-) -- View this message in context: http://n2.nabble.com/Style-WFS-layer-by-attributes-tp3559456p3559456.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] File KML generated does not contains any style information
Hi, your question was already answered yesterday, can you please stop reposting this question? TIA. http://openlayers.org/pipermail/users/2009-August/013525.html Best regards, Bart > Hi all, > I'm trying to export kml using 'write' function. The kml file is generated > but it doesn't contains any style information (color, image etc.) and it's > represented on Google Earth as a white line. > How can I put the style information in the file? > > > > Here is just a part of my code: > > var gml3 = new OpenLayers.Format.GML.v2(gmlOptionsIn4); > > var provaLayerFeatures = new OpenLayers.Layer.Vector("provaLayerFeatures", > { > isBaseLayer: false > }); > > featuresExpKml = gml3.read(unescape(g.geometry)); > > for (var t=0; t > featuresExpKml[t].geometry.transform(srcProj, > destProj); > > > provaLayerFeatures.addFeatures(featuresExpKml); > > g.geometryKml = escape(kmlout.write(provaLayerFeatures.features)); > > > > > > Thanks for your help, > Mario > > ___ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > > > ___ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] File KML generated does not contains any style information
Hi all, I'm trying to export kml using 'write' function. The kml file is generated but it doesn't contains any style information (color, image etc.) and it's represented on Google Earth as a white line. How can I put the style information in the file? Here is just a part of my code: var gml3 = new OpenLayers.Format.GML.v2(gmlOptionsIn4); var provaLayerFeatures = new OpenLayers.Layer.Vector("provaLayerFeatures", { isBaseLayer: false }); featuresExpKml = gml3.read(unescape(g.geometry)); for (var t=0; thttp://openlayers.org/mailman/listinfo/users ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] maxResolution for a WMS layer
Eric Lemoine a écrit : > On Monday, August 31, 2009, Guillaume Sueur > wrote: >> Setting maxResolution after adding layer to the map did the trick. > > Setting maxResolution in the config object passed to the constructor it does not > should work. If it does not, I guess the problem should be reported. I guess I should build a clean test case so. > > Hope you're well too. I am ! Cheers, Guillaume > > > > > ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users