Re: [OpenLayers-Users] 'undefined' at vertices while editingvectorlayer
Hi, The features have no values = undefined, but a status of undefined. So your comparison can not work. The only idea I have, is to set i.e an attribute show=yes for features, that should be labeled. And add the below rule: var PolygonSymbolizer = { fillColor: ${color}, fillOpacity: 0.5, strokeColor: ${color}, strokeOpacity: 0.8, strokeWidth: 4, pointRadius: 6 }; var TextSymbolizer = { label: ${name}, fontColor: #00, fontSize: 24px, fontFamily: Courier New, monospace, fontWeight: bold }; var Symbolizer = { Polygon : PolygonSymbolizer, Text : TextSymbolizer}; var rules = [ new OpenLayers.Rule({ filter: new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.EQUAL_TO, property: show, value: yes, }), symbolizer: Symbolizer, elseFilter: false }), new OpenLayers.Rule({ symbolizer: {Text:{ label: }}, elseFilter: true }) ]; _aktLayer.styleMap.styles[default].addRules(rules); _aktLayer.redraw(); The other way are to patch OpenLayers.Control.ModifyFeature.collectVertices (row 634), that an other style will used for the vertices instead of the default style. Original line : vertex = new OpenLayers.Feature.Vector(component); Patched line : vertex = new OpenLayers.Feature.Vector(component, null, OpenLayers.Feature.Vector.style['select']); But I'm not sure, if there are other and better ways to accomplish the task. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Alex Dean Gesendet: Dienstag, 31. August 2010 16:10 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] 'undefined' at vertices while editingvectorlayer Thanks for the help. I see that the 'default' style is being used to render the vertices, but I still don't understand how to prevent 'undefined' labels from being applied to them. I did look at the code for OpenLayers.Control.ModifyFeature.collectVertices, but I'm not sure what to do with it. It doesn't appear that styling is applied at this point, except in the case of virtual vertices (which have the control's virtualStyle applied). Could you explain a little more what you mean here? I've also been trying to apply a rule like this: new OpenLayers.Rule({ filter: new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.EQUAL_TO, property: name, value: undefined, }), symbolizer: { label: } }); What do you think of this approach? It seems like this might solve my problem, but I'm having some difficulties getting it applied properly. thanks, alex On Aug 30, 2010, at 11:55 AM, Arnd Wippermann wrote: Hi, Most likely it's the label, what's undefined. OpenLayers use the default style for rendering the vertices and in this context the attribute 'name' isn't defined. Were your color undefined, then the renderer would use black to render the features, but doesn't display a text message. If you want to change this behaviour, then look at the function OpenLayers.Control.ModifyFeature.collectVertices Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users- boun...@openlayers.org] Im Auftrag von Alex Dean Gesendet: Montag, 30. August 2010 16:10 An: users@openlayers.org Betreff: [OpenLayers-Users] 'undefined' at vertices while editing vectorlayer When I define my own styling for a vector layer, I see 'undefined' at the vertices while editing a feature. Screenshot of feature when I'm not editing it : http://skitch.com/alexdean/dwe1i/without-editing Screenshot of feature while editing: http://skitch.com/alexdean/dwe14/with-editing Using Firebug/Firefox, I can see the following SVG for one vertex. circle id=OpenLayers.Geometry.Point_146 cx=827.666759318 cy=79.09283407817736 r=6 fill=undefined fill-opacity=0.5 stroke=undefined stroke-opacity=0.8 stroke-width=4 stroke- linecap=round stroke-linejoin=round stroke-dasharray=none/ I see 'undefined' is the value use for 'fill' and 'stroke', so I imagine one of these may be the problem. I can't figure out what keys I need to define in my style objects to resolve this problem. Can someone help? This is how I've defined the layer: wfs = new OpenLayers.Layer.Vector(Regions, { styleMap: new OpenLayers.StyleMap( { 'default':{ label: ${name}, fillColor: ${color}, fillOpacity: 0.5, strokeColor: ${color}, strokeOpacity: 0.8, strokeWidth: 4, pointRadius: 6
Re: [OpenLayers-Users] 'undefined' at vertices while editing vectorlayer
Hi, Most likely it's the label, what's undefined. OpenLayers use the default style for rendering the vertices and in this context the attribute 'name' isn't defined. Were your color undefined, then the renderer would use black to render the features, but doesn't display a text message. If you want to change this behaviour, then look at the function OpenLayers.Control.ModifyFeature.collectVertices Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Alex Dean Gesendet: Montag, 30. August 2010 16:10 An: users@openlayers.org Betreff: [OpenLayers-Users] 'undefined' at vertices while editing vectorlayer When I define my own styling for a vector layer, I see 'undefined' at the vertices while editing a feature. Screenshot of feature when I'm not editing it : http://skitch.com/alexdean/dwe1i/without-editing Screenshot of feature while editing: http://skitch.com/alexdean/dwe14/with-editing Using Firebug/Firefox, I can see the following SVG for one vertex. circle id=OpenLayers.Geometry.Point_146 cx=827.666759318 cy=79.09283407817736 r=6 fill=undefined fill-opacity=0.5 stroke=undefined stroke-opacity=0.8 stroke-width=4 stroke- linecap=round stroke-linejoin=round stroke-dasharray=none/ I see 'undefined' is the value use for 'fill' and 'stroke', so I imagine one of these may be the problem. I can't figure out what keys I need to define in my style objects to resolve this problem. Can someone help? This is how I've defined the layer: wfs = new OpenLayers.Layer.Vector(Regions, { styleMap: new OpenLayers.StyleMap( { 'default':{ label: ${name}, fillColor: ${color}, fillOpacity: 0.5, strokeColor: ${color}, strokeOpacity: 0.8, strokeWidth: 4, pointRadius: 6, fontColor: #00, fontSize: 24px, fontFamily: Courier New, monospace, fontWeight: bold } }) }); The edit control is defined as follows: var edit = new OpenLayers.Control.ModifyFeature(wfs, { title: Edit Existing Region, displayClass: olControlModifyFeature }); As you can see in the screenshots, the 'color' attribute (eg $ {color}) has been set for the feature in question and is rendered correctly when I'm not editing the feature. The 'undefined' text only appears when I edit the feature using an instance of OpenLayers.Control.ModifyFeature. thanks, alex ___ 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] Why is my WFS layer not showing up?
Hi, First: the point in the snippet you have posted, lies if the projection is right, south-east of Mallorca. If you take the projection EPSG:23031, then it should be in Barcelona. Second: When I use your wfs server with EPSG:23031, then the points will display in Barcelona. But only for the layer cloud2. The gml for the layers named by numbers are not valid. ms:4 seems to be no correct tag. You can test this by saving the response from firebug as xml and then you should be able by doubleclick to load it in your Internet browser. It will raise an error. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Gregor at HostGIS Gesendet: Samstag, 21. August 2010 00:26 An: users@openlayers.org Betreff: [OpenLayers-Users] Why is my WFS layer not showing up? Why is my WFS layer not showing up? I cribbed off the current WFS demos from the OL examples, but for some reason it's just not appearing. The URL of my app. Of course, view the source as needed. http://eixos.planol.info/cluster/example.html Firebug is showing what loooks to be correct WFS activity. It is POSTing to the correct URL (yes, DATE is required for our purposes): http://eixos.planol.info/cgi-bin/mapserv?map=/maps/eixos/wms/mapfile.mapDAT E=2010-08-15 It is getting back GML, including plenty of gml:featureMember blocks like this one. The coords are correct for this area in EPSG:900913. gml:featureMember ms:cloud2 fid=cloud2.2103 gml:boundedBy gml:Box srsName=EPSG:900913 gml:coordinates434243.81,4586616.63 434243.81,4586616.63/gml:coordinates /gml:Box /gml:boundedBy ms:msGeometry gml:Point srsName=EPSG:900913 gml:coordinates434243.81,4586616.63/gml:coordinates /gml:Point /ms:msGeometry ms:ID2103/ms:ID ms:TITLERestaurant La Deliciosa/ms:TITLE ms:ADDRESS CR MATARO/ms:ADDRESS ms:LAST_VISIT2009-03-05/ms:LAST_VISIT ms:NEXT_VISIT2009-06-05/ms:NEXT_VISIT ms:STARTDATE2008-07-24/ms:STARTDATE ms:ENDDATE/ms:ENDDATE ms:LATITUDE41.4276977467/ms:LATITUDE ms:LONGITUDE2.2130631058/ms:LONGITUDE /ms:cloud2 /gml:featureMember And yet, no features (points) are drawn. I'm not sure what I'm missing on this one. I'll be specifying a Style later, but I know that WFS has a default Style which would be fine for these first steps. -- HostGIS, Open Source solutions for the global GIS community Greg Allensworth - SysAdmin, Programmer, GIS Person, Security Network+ Server+ A+ Security+ Linux+ PHP PostgreSQL MySQL DHTML/JavaScript/AJAX No one cares if you can back up only if you can recover. ___ 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] Looping through the features of a WMS layer
Hi, if you use WMS you have no access to any features. You get only a picture. For a certain point you can request GetFeatureInfo. If you want features, you have to use WFS. But keep in mind. You get only that from the servers, what they want to publish (i.e attributes of GetFeatureInfo). Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Frank Gesendet: Donnerstag, 19. August 2010 02:11 An: users@openlayers.org Betreff: [OpenLayers-Users] Looping through the features of a WMS layer Hi, I want to get the map of Canada then loop through all provinces, in order to color them differently (I'm going to create a new Vector layer for each province and apply its own styleMap) : var wmsLayer = new OpenLayers.Layer.WMS(Canada, http://www2.dmsolutions.ca/cgi-bin/mswms_gmap;, { layers: bathymetry,land_fn,park,drain_fn,drainage, + prov_bound,fedlimit,rail,road,popplace, transparent: true, format: image/png }); So the question is how to loop through the WMS layer features or prov_bound to retrieve each province's geometry. Thanks! Francois ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Looping through the features of a WMS layer
if you interested to have your own dataset, then this is a good resource: http://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-1-s tates-provinces/ Arnd _ Von: Frank [mailto:eucl...@gmail.com] Gesendet: Freitag, 20. August 2010 18:02 An: Arnd Wippermann Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] Looping through the features of a WMS layer Thanks! I see, WMS are just images. If I ever succeed getting the Canadien provinces geometry/features, I'll post the recipe. Francois On Fri, Aug 20, 2010 at 8:13 AM, Arnd Wippermann arnd.wipperm...@web.de wrote: Hi, if you use WMS you have no access to any features. You get only a picture. For a certain point you can request GetFeatureInfo. If you want features, you have to use WFS. But keep in mind. You get only that from the servers, what they want to publish (i.e attributes of GetFeatureInfo). Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Frank Gesendet: Donnerstag, 19. August 2010 02:11 An: users@openlayers.org Betreff: [OpenLayers-Users] Looping through the features of a WMS layer Hi, I want to get the map of Canada then loop through all provinces, in order to color them differently (I'm going to create a new Vector layer for each province and apply its own styleMap) : var wmsLayer = new OpenLayers.Layer.WMS(Canada, http://www2.dmsolutions.ca/cgi-bin/mswms_gmap;, { layers: bathymetry,land_fn,park,drain_fn,drainage, + prov_bound,fedlimit,rail,road,popplace, transparent: true, format: image/png }); So the question is how to loop through the WMS layer features or prov_bound to retrieve each province's geometry. Thanks! Francois ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] edit points in Geometry of a vector?
Hi, Below a function I use to snap the points of my features (point, line, polygon) programatically to a rounded value, so that the points lie all on a grid with a raster i.e 1000x1000 (SnapRadius=1000). Arnd function ctrlDragFeature_SnapPoint(feature) { if(SnapRadius0) { var objF = feature; geomType = objF.geometry.CLASS_NAME.replace(/OpenLayers.Geometry./,); if(geomType==Point) { objF.geometry.x = Math.round(objF.geometry.x/SnapRadius)*SnapRadius; objF.geometry.y = Math.round(objF.geometry.y/SnapRadius)*SnapRadius; } else if(geomType==LineString) { for(var j=0;jobjF.geometry.components.length;j++) { objF.geometry.components[j].x = Math.round(objF.geometry.components[j].x/SnapRadius)*SnapRadius; objF.geometry.components[j].y = Math.round(objF.geometry.components[j].y/SnapRadius)*SnapRadius; } } else if(geomType==Polygon) { var objFpt = objF.geometry.components[0].components; for(var i=0;iobjFpt.length;i++) { objFpt[i].x = Math.round(objFpt[i].x/SnapRadius)*SnapRadius; objFpt[i].y = Math.round(objFpt[i].y/SnapRadius)*SnapRadius; } objFpt[i-1].x = objFpt[0].x; } objF.layer.drawFeature(feature); } } -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von ulao Gesendet: Montag, 16. August 2010 14:11 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] edit points in Geometry of a vector? I'd like to do this programatically . -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/edit-points-in-Geometry-of-a-vector-t p5417230p5427609.html 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] SLD over WMS
As far as I know from MapServer, you can't use a relative url. example from http://mapserver.org/ogc/sld.html http://www2.dmsolutions.ca/cgi-bin/mswms_world?SERVICE=WMS http://www2.dmsolutions.ca/cgi-bin/mswms_world?SERVICE=WMSVERSION=1.1.1Re quest=GetMapLAYERS=WorldGen_OutlineSLD=http://www2.dmsolutions.ca/msapps/w orld_testdata/tests/sld_tests/sld_line_simple.xml VERSION=1.1.1Request=GetMap LAYERS=WorldGen_OutlineSLD=http://www2.dmsolutions.ca/msapps/world_testdat a/tests /sld_tests/sld_line_simple.xml Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Fernando Ribeiro Gesendet: Donnerstag, 12. August 2010 10:27 An: users@openlayers.org Betreff: [OpenLayers-Users] SLD over WMS Hi list, I am trying to change the default style of a WMS layer, with a new SLD style. So far I tried the SLD:, direcly on layer options, and layer.mergeNewParams, without much success. Here's the layer I want to change: var fires_24h = new OpenLayers.Layer.WMS( Fires 24h, http://firefly.geog.umd.edu/wms/wms?;, { layers: 'fires24', sld: './SLD/fires.sld', srs: 'EPSG:4326', format: 'image/png', tiled: 'true', transparent: true }, {isBaseLayer: false} ); Can anyone try and help me? Thank you! -- Fernando ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Problem while adding a vector layer
Hi, Your maxExtent defines a little area about 1x1 sqm at 0,0 because you use spericalMercator. Extent in EPSG:900913 maxExtent:new OpenLayers.Bounds(9258442.0492536,1996037.9243878,9282932.3372281,2012982.98 40631) Or transform your coordinates maxExtent : new OpenLayers.Bounds(83.170,17.645,83.390,17.790).transform(new OpenLayers.Projection(EPSG:4326), new OpenLayers.Projection(map.projection)) Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von usha madhuri Gesendet: Donnerstag, 12. August 2010 12:38 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Problem while adding a vector layer Hi, I have used SphericalMercator and my code is as below, function load() { map = new OpenLayers.Map(document.getElementById(map)); OpenLayers.ProxyHost=/proxy/?url=; var options = { projection: new OpenLayers.Projection(EPSG:900913), displayProjection: new OpenLayers.Projection(EPSG:4326), units: m, numZoomLevels: 18, maxResolution: 156543.0339, maxExtent: new OpenLayers.Bounds(83.170,17.645,83.390,17.790) }; map = new OpenLayers.Map('map', options); google = new OpenLayers.Layer.Google( Google Streets, {'sphericalMercator': true} ); map.addLayer(google); using this I am not able to pan the map. Please tell me where have I gone wrong. Regards, Madhuri -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Problem-while-adding-a-vector-layer-t p4869632p5415604.html 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] OpenLayers.Filter.Comparison.LIKE and singleChar
Hi Eric, thanks for the reply and the hint. It's a more complex situation. It's not a problem with the filter, but with OpenLayers.Format.SLD().read: I create a SLD and apply it to a vector layer var formatSLD = new OpenLayers.Format.SLD(); var sld = formatSLD.read(theSLD_BODY); ... It works perfect, but only the LIKE-filter with . works not. The filterpart from theSLD_BODY for this case looks like ogc:Filter xmlns:ogc=http://www.opengis.net/ogc; ogc:PropertyIsLike wildCard=* singleChar=. escape=! ogc:PropertyNameindice/ogc:PropertyName ogc:Literal.2/ogc:Literal /ogc:PropertyIsLike /ogc:Filter The .2 enters the function OpenLayers.Filter.Comparison.value2regex as 0.2 as number (typeof this.value - number ?!) and causes the error this.value.replace is not a function. if I overwrite the function by adding this.value=this.value.toString(), then the error vanishes, but the applied rule to the vector layer doesn't result in a correct style. Appling the same SLD to the WMS layer, shows the correct style. It seems, the SLD is correct. I remember a case with labels like 02.09, that change to 2.09. Perhaps the same issue. If you have any hint, where to further look? The little testcode from you was a great help for me to get to the right error. And this is still the same: Also I don't understand, why '*2' finds items like 21, 23, 24. What would you expect? From the Filter Encoding specs: The wildCard character matches zero or more characters. I would expect '2' or 'adadas2', but not '2klkölk' Many thanks Arnd -Ursprüngliche Nachricht- Von: Eric Lemoine [mailto:eric.lemo...@camptocamp.com] Gesendet: Donnerstag, 5. August 2010 09:20 An: Arnd Wippermann Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar On Wed, Aug 4, 2010 at 12:28 PM, Arnd Wippermann arnd.wipperm...@web.de wrote: Hi Why is it not possible to use '.' (point for singleChar) in a OpenLayers.Filter.Comparison.LIKE? What do you mean exactly? The Comparision filter 'like' seems not to work as expected. It's not possible to use an expression only with a point for a single char (.2) or a static string (22). Again, I don't understand what you mean. f = new OpenLayers.Filter.Comparison({type: OpenLayers.Filter.Comparison.LIKE, property: foo, value: .2}); f.evaluate({foo: 1}) false f.evaluate({foo: 22}) true f.evaluate({foo: 12}) true f.evaluate({foo: 2}) false It looks good to me. It causes an error 'this.value.replace is not a function'. It works only in conjunction with '*' (*.2, 22*). Could you please provide an example. Also I don't understand, why '*2' finds items like 21, 23, 24. What would you expect? From the Filter Encoding specs: The wildCard character matches zero or more characters. Cheers, -- 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
Re: [OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar
Hi, The patch resolves the problem in parts. ogc:Filter xmlns:ogc=http://www.opengis.net/ogc; ogc:PropertyIsLike wildCard=* singleChar=. escape=! ogc:PropertyNameindice/ogc:PropertyName ogc:Literal.2/ogc:Literal /ogc:PropertyIsLike /ogc:Filter The SLD will be created and the WFS GetFeature request, which use this filter, responses with the correct features. But the SLD will not style the features in the correct way. OpenLayers use the ElseFilter instead of the Rule with the above filter. There seems to be still a bug. I have to use '*.2' to get the right style for the features, what also works for the WFS. That's what I do to apply the SLD to the vectorlayer var formatSLD = new OpenLayers.Format.SLD(); var sld = formatSLD.read(theSLD_BODY); layerSelect[styleMap][styles][default] = sld.namedLayers[featureType].userStyles[0]; Online example, where you can see this behaviour: http://gis.ibbeck.de/ginfo/apps/OLExamples/OL29/SLDShow/ApplySLDwfs.asp?Mapf ile=LettersSHP.map Thanks for the patch Arnd ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar
Hi, As I understand, the patch solves the problem, that the SLD will be created. Therefor I can use it for request WFS GetFeature. But as the SLD reader use the filter to interpret the rule, it will use 0.2 instead of .2 and causes to use the ElseFilter and styles the features in the wrong way? The OGC filters are an interesting subject. Not only OpenLayers fails. Also with MapServer there are some issues. Arnd -Ursprüngliche Nachricht- Von: Andreas Hocevar [mailto:ahoce...@opengeo.org] Gesendet: Donnerstag, 5. August 2010 17:38 An: Eric Lemoine Cc: Arnd Wippermann; users@openlayers.org Betreff: Re: [OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar Hi, Eric's patch won't solve the problem, because the input to the filter will then be 0.2 instead of .2. Arnd, can you please create a ticket? This behavior was introduced by http://trac.openlayers.org/changeset/8927, and I think it would be better to cast in filter.evaluate rather than in format readers. Regards, Andreas. On Aug 5, 2010, at 17:31 , Eric Lemoine wrote: On Thu, Aug 5, 2010 at 2:28 PM, Arnd Wippermann arnd.wipperm...@web.de wrote: Hi Eric, thanks for the reply and the hint. It's a more complex situation. It's not a problem with the filter, but with OpenLayers.Format.SLD().read: I create a SLD and apply it to a vector layer var formatSLD = new OpenLayers.Format.SLD(); var sld = formatSLD.read(theSLD_BODY); ... It works perfect, but only the LIKE-filter with . works not. The filterpart from theSLD_BODY for this case looks like ogc:Filter xmlns:ogc=http://www.opengis.net/ogc; ogc:PropertyIsLike wildCard=* singleChar=. escape=! ogc:PropertyNameindice/ogc:PropertyName ogc:Literal.2/ogc:Literal /ogc:PropertyIsLike /ogc:Filter The .2 enters the function OpenLayers.Filter.Comparison.value2regex as 0.2 as number (typeof this.value - number ?!) and causes the error this.value.replace is not a function. if I overwrite the function by adding this.value=this.value.toString(), then the error vanishes, but the applied rule to the vector layer doesn't result in a correct style. Appling the same SLD to the WMS layer, shows the correct style. It seems, the SLD is correct. I remember a case with labels like 02.09, that change to 2.09. Perhaps the same issue. If you have any hint, where to further look? Does the attached patch solve the problem? -- 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 patch___ 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] OpenLayers.Filter.Comparison.LIKE and singleChar
Thanks Ian, I have tried this, to test, if the SLD reader principal works. But I wouldn't like this approach, because you have to remember, that you changed the value for singleChar. Arnd -Ursprüngliche Nachricht- Von: Ian Turton [mailto:ijtur...@gmail.com] Gesendet: Donnerstag, 5. August 2010 18:53 An: Arnd Wippermann Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar Another solution is to use a character other than . for the single character wildcard so that it no longer looks like a number to the parser. Try ogc:Filter xmlns:ogc=http://www.opengis.net/ogc; ogc:PropertyIsLike wildCard=* singleChar=# escape=! ogc:PropertyNameindice/ogc:PropertyName ogc:Literal#2/ogc:Literal /ogc:PropertyIsLike /ogc:Filter Ian -- Ian Turton ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar
Hi Ian, Andreas Ian's suggestion is an excellent one though, at least if you can control how the SLD that OpenLayers consumes looks. I have thought, I could control it with OpenLayers. I take function createFilterComparision(type, theField, theValue) { var filter = new OpenLayers.Filter.Comparison({ type: type, property: theField, value: theValue }); filter.value2regex(%, _); //translation back to '*' and '.' return(filter); } to use other values for the wildCard and singleChar, in hope they get in the SLD. But OpenLayers translate them back to '*' an '.'. The SLD I create with OpenLayers hold '*' and '.' and reading this SLD to style my features ends up with the issue, that '.' fails. If i change manuel the singleChar in the created SLD and apply it to the layer, then OpenLayers interprets it correctly. But that's not what I want. Nevertheless the Format.SLD and Filter is great. Arnd -Ursprüngliche Nachricht- Von: Andreas Hocevar [mailto:ahoce...@opengeo.org] Gesendet: Donnerstag, 5. August 2010 19:43 An: Arnd Wippermann Cc: 'Ian Turton'; users@openlayers.org Betreff: Re: [OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar Ian's suggestion is an excellent one though, at least if you can control how the SLD that OpenLayers consumes looks. Regards, Andreas. On Aug 5, 2010, at 19:08 , Arnd Wippermann wrote: Thanks Ian, I have tried this, to test, if the SLD reader principal works. But I wouldn't like this approach, because you have to remember, that you changed the value for singleChar. Arnd -Ursprüngliche Nachricht- Von: Ian Turton [mailto:ijtur...@gmail.com] Gesendet: Donnerstag, 5. August 2010 18:53 An: Arnd Wippermann Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar Another solution is to use a character other than . for the single character wildcard so that it no longer looks like a number to the parser. Try ogc:Filter xmlns:ogc=http://www.opengis.net/ogc; ogc:PropertyIsLike wildCard=* singleChar=# escape=! ogc:PropertyNameindice/ogc:PropertyName ogc:Literal#2/ogc:Literal /ogc:PropertyIsLike /ogc:Filter Ian -- Ian Turton ___ 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] Current Map Bounds Width, Height
Hi, you mean this? var winWidth = map.getSize().w; var winHeight = map.getSize().h; http://dev.openlayers.org/releases/OpenLayers-2.9.1/doc/apidocs/files/OpenLa yers/Map-js.html Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Kalyan Kamepalli Gesendet: Mittwoch, 4. August 2010 08:39 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Current Map Bounds Width, Height Sorry. used getExtent on wrong instance. I used it on Layer not on map. Now used on map instance and It worked. But, I could not find any functions to get the width and height values of current map. Any suggestions and help are much appreciated. Thanks, Kalyan. On Wed, Aug 4, 2010 at 4:28 PM, Kalyan Kamepalli kalyan.kamepa...@gmail.com wrote: Hi, How to get the current map bounds given that I have map object handle. The map API says getExtent returns the current view port bounds in lat lon. But, When I used this function , I get undefined. Is there any other options to get current map bounds and height , width values ?? ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar
Hi Why is it not possible to use '.' (point for singleChar) in a OpenLayers.Filter.Comparison.LIKE? The Comparision filter 'like' seems not to work as expected. It's not possible to use an expression only with a point for a single char (.2) or a static string (22). It causes an error 'this.value.replace is not a function'. It works only in conjunction with '*' (*.2, 22*). Also I don't understand, why '*2' finds items like 21, 23, 24. example : http://gis.ibbeck.de/ginfo/apps/OLExamples/OL29/SLDShow/ApplySLD.asp Looking at the code, I have no idea, where to look to change the behavior. Some hints would help. Arnd ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Untiled WMS on top of Google Maps doesn't alwaysshow up
Hi, Set ratio:1, then the layer should displayed {'opacity': 0.9, 'isBaseLayer': false, 'visibility': true, 'singleTile' : true, ratio:1} Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Arjen de Korte Gesendet: Dienstag, 3. August 2010 16:38 An: users@openlayers.org Betreff: [OpenLayers-Users] Untiled WMS on top of Google Maps doesn't alwaysshow up Dear all, I'm trying to show an untiled WMS layer on top of a Google Map in OpenLayers, but under certain conditions (esp. zoomlevel 2) the overlay is not displayed. I have this problem with our own WMS layers but also with the default MetaCarta WMS layer, both in Firefox 3.6 and IE8, using Openlayers 2.9.1. The code below (init function is called on page load) will load Google Maps as the base layer and overlay it with the default MetaCarta WMS as an untiled WMS layer. The WMS layer is set to display by default but it is not shown in the browser in the default extent. When you zoom in it does show up. Note that this only applies to untiled WMS, for tiled WMS (singleTile = false) it works fine. Also note that the WMS layer is actually loaded correctly (as can be shown by e.g. Firebug), it just isn't displayed for some reason. I'd be grateful for any hints or suggestions to solve this problem! Kind regards, Arjen. var map, layer; function init(){ var options = { projection: new OpenLayers.Projection(EPSG:900913), displayProjection: new OpenLayers.Projection(EPSG:4326), units: m, numZoomLevels: 18, maxResolution: 156543.0339, maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34) }; map = new OpenLayers.Map('map', options); var gmap = new OpenLayers.Layer.Google( Google Maps, {'sphericalMercator': true} ); map.addLayer(gmap); var wmslayer = new OpenLayers.Layer.WMS(OpenLayers WMS,http://labs.metacarta.com/wms/vmap0?;, {'layers': 'basic', 'format':'image/png', 'transparent':'true'}, {'opacity': 0.9, 'isBaseLayer': false, 'visibility': true, 'singleTile' : true} ); map.addLayer(wmslayer); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.MousePosition()); var point = new OpenLayers.LonLat(-20, 50); point.transform(new OpenLayers.Projection(EPSG:4326), map.getProjectionObject()); map.setCenter(point, 2); } ___ 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] Howto extract documentattributes(name/description) from KML Layer
register 'loadend' for your layer and declare there your function brewpub_layer.events.register(loadend, brewpub_layer, function (e) { var fts = this.features; for(var i=0;ifts.length;i++) { theHTML = fts[i].attributes.name + , + fts[i].attributes.description + br; } }); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Sven Geggus Gesendet: Montag, 2. August 2010 11:21 Betreff: Re: [OpenLayers-Users] Howto extract documentattributes(name/description) from KML Layer Arnd Wippermann arnd.wipperm...@web.de wrote: As you have set extractAttributes to true you can do something like this: var fts = brewpub_layer.features; var theHTML = ; for(var i=0;ifts.length;i++) { theHTML = fts[i].attributes.name + , + fts[i].attributes.description + br; } Hm fts seems to be of zero length here. So when do I have to run this code? Looks like the kml is not been read immediately after layer generation. Sven -- If you don't make lower-resolution mapping data publicly available, there will be people with their cars and GPS devices, driving around with their laptops (Tim Berners-Lee) /me is gig...@ircnet, http://sven.gegg.us/ on the Web ___ 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] moving panzoombar?
Try this map.addControl( new OpenLayers.Control.PanZoomBar(), new OpenLayers.Pixel(300,0) ); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Imran Rajjad Gesendet: Montag, 2. August 2010 11:56 An: users@openlayers.org Betreff: [OpenLayers-Users] moving panzoombar? Hi list, I have been looking around in user discusion list and cannot find a way to repoistion the pan zoom bar, I`m trying to align it with the right side of map instead of left. Now i did this through firebug by changing the style. but those variables seem to be coming out of some js file instead of css class. is there anyway to overwrite the hardcoded position? regards, Imran -- I.R ___ 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] Howto extract document attributes(name/description) from KML Layer
As you have set extractAttributes to true you can do something like this: var fts = brewpub_layer.features; var theHTML = ; for(var i=0;ifts.length;i++) { theHTML = fts[i].attributes.name + , + fts[i].attributes.description + br; } ... Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Sven Geggus Gesendet: Sonntag, 1. August 2010 22:32 An: users@openlayers.org Betreff: [OpenLayers-Users] Howto extract document attributes(name/description) from KML Layer Hello, I'm using a KML layer like this: var brewpub_layer = new OpenLayers.Layer.GML(KML, path/to/my.kml, { format: OpenLayers.Format.KML, projection: map.displayProjection, formatOptions: { extractStyles: true, extractAttributes: true } }); This works fine as far as the features are concerned. But I would also like to extract a few other attributes from the kml file to display them beside the map. Currently I'm talking about name and description attributes only. How can this be done? Sven -- The term any key does not refer to a particular key on the keyboard. It simply means to strike any one of the keys on your keyboard or handheld screen. (Compaq FAQ Entry 2859) /me is gig...@ircnet, http://sven.gegg.us/ on the Web ___ 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] wms coordinates
If it's your service, then you are responsible for the response of the GetFeatureInfo request. With MapServer I know, that you can get the geometry of matched features [shpminx], [shpminy], [shpmaxx], [shpmaxy] Minimum / maximum X or Y coordinate of shape extent. Available only when processing query results. http://mapserver.org/mapfile/template.html But what about a WFS request? Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von sasamil Gesendet: Freitag, 30. Juli 2010 12:25 An: users@openlayers.org Betreff: [OpenLayers-Users] wms coordinates Hello! Supposing that we have a wms service which converts some vector data (i.e. gml data about road-network) into raster images, is it possible to get coordinates of a certain feature (road) using the standard wms function GetFeatureInfo? Regards! -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/wms-coordinates-tp5354461p5354461.htm l 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] HOW TO USE LOGICAL FILTERS
So should it work create filterComparison1 for attribute1 create filterComparison2 for attribute2 create filterLogical with above filters add filterLogical as filter to the rule var filterComparison1 = new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.GREATER_THAN, property: attribute1, value: 5 }); var filterComparison2 = new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.LESS_THAN, property: attribute2, value: 2 }); var filterLogical=new OpenLayers.Filter.Logical({ type: OpenLayers.Filter.Logical.AND, filters:[filterComparison1, filterComparison2] }); var rule = new OpenLayers.Rule({ name:Rule 1, filter: filterLogical }), symbolizer: {graphicName:circle, pointRadius: 7} }); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von s.williams Gesendet: Mittwoch, 28. Juli 2010 16:34 An: users@openlayers.org Betreff: [OpenLayers-Users] HOW TO USE LOGICAL FILTERS I want to combine two separate filters using a logical filter, the objective is to use a comparison filter to set the point radius of a marker from feature attribute1 and use another filter to set the color of that marker from attribute2. Thanks for the help Here's what I have var rule = new OpenLayers.Rule({ filter: new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.GREATER_THAN, property: attribute1, value: 5 }), symbolizer: {graphicName:circle, pointRadius: 7 } }); var rule1 = var rule = new OpenLayers.Rule({ filter: new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.LESS_THAN, property: attribute2, value: 2 }), symbolizer: {graphicName:circle, strokeColor: '#00', strokeWidth: 1, fillColor: #FF } }); var rules = new OpenLayers.Filter.Logical({ filters: [rule1,rule2], type: OpenLayers.Filter.Logical.AND}) These are just some code snippets I have written, any help on how to put them together would be great -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/HOW-TO-USE-LOGICAL-FILTERS-tp5345691p 5345691.html 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] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113
Hi, That way you have to set the SRS in the params and the projection in the options. I would think, it's better, the params get the projection from the map and if you want to overwrite the SRS use projection or projectionAlias in the options. That way you have only one change not two. Also I think, it's better, that one could only overwrite WMS params, which OpenLayers couldn't set by itself like version, layers etc. Arnd -Ursprüngliche Nachricht- Von: Andreas Hocevar [mailto:ahoce...@opengeo.org] Gesendet: Dienstag, 27. Juli 2010 09:05 An: Arnd Wippermann Cc: 'Anne Blankert'; users@openlayers.org Betreff: Re: [OpenLayers-Users] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113 Please have a look at http://trac.openlayers.org/ticket/2756 and provide feedback. Regards, Andreas. On Jul 26, 2010, at 14:13 , Arnd Wippermann wrote: Hi Anne, I agree, something like 'projectionAlias' is better to understand than projection. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Anne Blankert Gesendet: Montag, 26. Juli 2010 00:02 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113 Hello Arnd, An option named sphericalmercatoralias is indeed very specific to sphericalmercator. Maybe, an option named projection is not specific enough. Users could think that such an option would somehow magically allow reprojecting the overlay projection to the map projection. Things would get mixed up, when sending bounding box coordinates using the wrong projection. So maybe an option named projectionalias would be a better name than sphericalmercatoralias or projection? projectionalias stresses the fact that the projection itself should not be different, just the code that is being used for the projection. Anne -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/SphericalMercator-and-SRS-alias es-eps g-900913-epsg-3857-epsg-3785-epsg-102113-tp5311417p5336039.html 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 -- 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] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113
Ok. Then it's regardless, which way to use. I would prefer 'projectionAlias' in the options. Arnd -Ursprüngliche Nachricht- Von: Andreas Hocevar [mailto:ahoce...@opengeo.org] Gesendet: Dienstag, 27. Juli 2010 14:30 An: Arnd Wippermann Cc: users@openlayers.org Betreff: Re: AW: [OpenLayers-Users] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113 On Jul 27, 2010, at 14:25 , Arnd Wippermann wrote: Hi, That way you have to set the SRS in the params and the projection in the options. If you have set a projection in the map options, you don't have to set it again on the layer. Regards, Andreas. I would think, it's better, the params get the projection from the map and if you want to overwrite the SRS use projection or projectionAlias in the options. That way you have only one change not two. Also I think, it's better, that one could only overwrite WMS params, which OpenLayers couldn't set by itself like version, layers etc. Arnd -Ursprüngliche Nachricht- Von: Andreas Hocevar [mailto:ahoce...@opengeo.org] Gesendet: Dienstag, 27. Juli 2010 09:05 An: Arnd Wippermann Cc: 'Anne Blankert'; users@openlayers.org Betreff: Re: [OpenLayers-Users] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113 Please have a look at http://trac.openlayers.org/ticket/2756 and provide feedback. Regards, Andreas. On Jul 26, 2010, at 14:13 , Arnd Wippermann wrote: Hi Anne, I agree, something like 'projectionAlias' is better to understand than projection. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Anne Blankert Gesendet: Montag, 26. Juli 2010 00:02 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113 Hello Arnd, An option named sphericalmercatoralias is indeed very specific to sphericalmercator. Maybe, an option named projection is not specific enough. Users could think that such an option would somehow magically allow reprojecting the overlay projection to the map projection. Things would get mixed up, when sending bounding box coordinates using the wrong projection. So maybe an option named projectionalias would be a better name than sphericalmercatoralias or projection? projectionalias stresses the fact that the projection itself should not be different, just the code that is being used for the projection. Anne -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/SphericalMercator-and-SRS-alia s es-eps g-900913-epsg-3857-epsg-3785-epsg-102113-tp5311417p5336039.html 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 -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. -- 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] externalGraphic anchoring points?
I have always thought the anchorpoint is left-top. But your nice example suggest it's the center of the externalGraphic. Looking at the code, it seems to be a bit complexer. SVG.js, similiar for VML.js var xOffset = (style.graphicXOffset != undefined) ? style.graphicXOffset : -(0.5 * width); var yOffset = (style.graphicYOffset != undefined) ? style.graphicYOffset : -(0.5 * height); If you declare the properties graphicXOffset and graphicYOffset in your style, then these values are taken for drawing. If you omit these properties, then an offset of half the width or height are taken. Because I use always the properties graphicXOffset=0 and graphicYOffset=0 in conjunction with externalGraphic, I have the anchorpoint always at left-top. If you want to use an offset to move the image, then you have to calculate from left-top and not from the center as your example seems to show. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von MostlyBaldEagle Gesendet: Dienstag, 27. Juli 2010 20:03 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] externalGraphic anchoring points? It's the center of the image. Easy to see if you connect two images with a line :-) Make sure the line feature is added to the layer before the two images(point features), then the line will usually show up on top. See example: http://osgeo-org.1803224.n2.nabble.com/file/n5343347/test_2_8.htm test_2_8.htm -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/externalGraphic-anchoring-points-tp53 42684p5343347.html 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] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113
Hi Anne, I agree, something like 'projectionAlias' is better to understand than projection. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Anne Blankert Gesendet: Montag, 26. Juli 2010 00:02 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113 Hello Arnd, An option named sphericalmercatoralias is indeed very specific to sphericalmercator. Maybe, an option named projection is not specific enough. Users could think that such an option would somehow magically allow reprojecting the overlay projection to the map projection. Things would get mixed up, when sending bounding box coordinates using the wrong projection. So maybe an option named projectionalias would be a better name than sphericalmercatoralias or projection? projectionalias stresses the fact that the projection itself should not be different, just the code that is being used for the projection. Anne -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/SphericalMercator-and-SRS-aliases-eps g-900913-epsg-3857-epsg-3785-epsg-102113-tp5311417p5336039.html 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] Adding radiobuttons to LayerSwitcher
Hi, I wouldn't take code from that example. It's a terrible hack by me to get the functionality of set the active layer. I have only replaced the code of the OpenLayers.LayerSwitcher without the right understanding what's going on. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Mehmet Sirin Gesendet: Montag, 26. Juli 2010 12:07 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Adding radiobuttons to LayerSwitcher hi, that's exactly what I need! But I want use it with the layer-group function . So now I have layer-grouping via : http://www.cnblogs.com/iswszheng/archive/2009/12/15/1625069.html and additional radiobuttons via http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/javascript/LayerSwi tcherRadioReg.js (http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels_radiobtn.ht ml). Is there someone, who has time to merge these both functions (because I'm not able of developing OL source code), so that every layer in the layerswitcher with group functionality has a radiobutton ? ...would be awesome :) 2010/7/26 C. Mark | Geo-bit m...@geo-bit.de Hi, I know this example, maybe that is what you want. http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels_radiobtn.htm l Am 26.07.2010 00:07, schrieb Mehmet Sirin: Hi, when adding a layer to the map, it is displayed with a checkbox in the layerswitcher. Now I want to add radiobuttons right to the layernames in layerswitcher. And then, when selecting one of them, a event should occur. Yes I know there is Geoext for stuff like this, but after I looked at the LayerTree example and didn't understand a thing... I want to stay with OpenLayers. which possibilities are there to realize this with OL? I hope you have any ideas.. regards ___ 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] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113
Hi, I wouldn't restrict it to sphericalmercatoralias. I use a similiar approach to add WMS Server, which use a different EPSG code than my map, but describe the same projection. Why not use options.projection to request the WMS in this projection? OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams,altUrl) { try{ var projectionCode = typeof this.options.projection == 'undefined' ? this.map.getProjection() : this.options.projection; }catch(err){ var projectionCode=this.map.getProjection(); } var value = (projectionCode == none) ? null : projectionCode if (parseFloat(this.params.VERSION) = 1.3) { this.params.CRS = value; } else { this.params.SRS = value; } return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this, arguments); }, Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Anne Blankert Gesendet: Sonntag, 25. Juli 2010 13:54 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113 Hmm, I didn't test my code properly, (layers without option sphericalmercator stopped working). The following code should do better (Version = 1.3 not yet tested): // override OpenLayers.WMS.getFullRequestString class member function OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams, altUrl) { var projectionCode = this.map.getProjection(); var value = (projectionCode == none) ? null : projectionCode if (this.options.sphericalmercatoralias) { if(value == 'EPSG:900913' || value == 'EPSG:102113' || value == 'EPSG:3857') { value = this.options.sphericalmercatoralias; } } if (parseFloat(this.params.VERSION) = 1.3) { this.params.CRS = value; } else { this.params.SRS = value; } return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this, arguments); } After this override, you can set a new layeroption 'sphericalmercatoralias' to tell OpenLayers to use that instead of the default as follows: layer = new OpenLayers.Layer.WMS(title, url, {layers: layernames}, {sphericalmercatoralias: EPSG:102113}); -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/SphericalMercator-and-SRS-aliases-eps g-900913-epsg-3857-epsg-3785-epsg-102113-tp5311417p5334827.html 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] Zoom to dinamic WMS Layer
Hi, OpenLayers have no possibilties to get the extent from the WMS. You can try to get the extent by WMS GetFeatureInfo (if you have a point, that indicates the state) or by WFS using the stateId for filter the WFS GetFeature. and then map.zoomToExtent(Bounds); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Gilberto Ramos Gesendet: Freitag, 23. Juli 2010 15:20 An: users@openlayers.org Betreff: [OpenLayers-Users] Zoom to dinamic WMS Layer Hi people, how are you doing? I'm having troubles to find the way to zoom to a polygon WMS layer that is dinamically filtered.. Let's put this on an example: You have the USA states map and you have an ID for each state; you define your WMS layer to something like this: var stateID = funcToGetFromURLParam(stateID); states = new OpenLayers.Layer.WMS( States, http://server:8080/geoserver/wms;, { transparent: 'true', layers: 'Workspace:states', srs: 'EPSG:4326', format: 'image/png', filter: FilterPropertyIsEqualToPropertyNameID/PropertyNameLiteral+stateI D+/Literal/PropertyIsEqualTo/Filter }); map.addLayer(states); How would you zoom to this layer (to it's maximum extension, to it's bounderies.. got what I tried to say?) after is filtered and loaded? I tried in so many ways but I could not. :S Thanks for your time folks! Best regards, Gilberto Ramos - For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. For God sent not his Son into the world to condemn the world; but that the world through him might be saved. He that believeth on him is not condemned: but he that believeth not is condemned already, because he hath not believed in the name of the only begotten Son of God. John 3:16-18 -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Zoom-to-dinamic-WMS-Layer-tp5329527p5 329527.html 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] Manually 'select' feature
Hi, you can use the OpenLayers.Control.SelectFeature. There is a function select with a feature to select as argument. ctrlSelectFeatures = new OpenLayers.Control.SelectFeature(...); function radioSelectFeature(idx) { var vlyr = map.layers[1]; try{ ctrlSelectFeatures.unselect(vlyr.selectedFeatures[0]); }catch(err){document.getElementById(featDesc).innerHTML='error'}; ctrlSelectFeatures.select(vlyr.features[idx]); } from http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/select-feature-with -function.html Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Alex Brandsen Gesendet: Freitag, 23. Juli 2010 18:18 An: emmexx Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] Manually 'select' feature Thanks for replying! getFeatureById() and OpenLayers.Layer.Vector.selectedFeatures both return feature(s), I don't see how I can use these functions to select features? Alex. On Thu, Jul 22, 2010 at 2:56 PM, emmexx emm...@tiscalinet.it wrote: Il 22/07/2010 15:24, Alex Brandsen scrisse: Hi all, I was wondering if there is a way to manually select a feature, i.e. when a feature is clicked, I want to select a feature next to it as well. I can't seem to find any documentation on this, unfortunately. You can use: OpenLayers.Layer.Vector.getFeatureById() or the undocumented/private/I can't find it in the api docs OpenLayers.Layer.Vector.selectedFeatures array. bye maxx ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Trying to troubleshoot a map: redrawing layerwith SLD style
Hi, that's the way I write the SLD from a style: function SLDwrite(namedLayer) { var styleObj = map.layers[map.aktLayer][styleMap][styles][default]; var sld = {}; sld[namedLayers] = {}; sld[namedLayers][namedLayer] = {}; sld[namedLayers][namedLayer][userStyles] = [styleObj]; sld[namedLayers][namedLayer][userStyles][0].layerName = namedLayer; sld[namedLayers][namedLayer][namedStyles] = []; sld[namedLayers][namedLayer][name] = namedLayer; sld[version] = 1.0.0; var formatSLD = new OpenLayers.Format.SLD(); return(formatSLD.write(sld).replace(/\n/g,)); } Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Dheeraj Chand Gesendet: Donnerstag, 15. Juli 2010 21:36 An: users@openlayers.org Betreff: [OpenLayers-Users] Trying to troubleshoot a map: redrawing layerwith SLD style Hi, everyone, I posted just the other day about a map that I'm building. The idea has been changed to a simpler one. Through a form, the user constructs a variable that represents the attribute to be considered, then a style is built and attached to the layer in question and the layer is redrawn. It should be fairly simple, but my newness to JS and OpenLayers is getting in the way. I seem to have all kinds of problems with this map,1) For some reason, battlegroundData is rendering as a base layer, not an overlay, 2) I think that something is wrong with the projection and 3) I'm not sure whether I read the documentation correctly for writing the style SLD and then attaching it. Mind helping a brother meet his deadline? http://gulfcoaststrategicservices.com/maps/lrp/index.html Thanks, Dheeraj ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Proportional Symbols from GMLattributes/OpenLayers
Hi, Use for your gml layer the option extractAttributes: true to get features with attributes. Use a styleMap for your layer, where your pointRadius is set by an attribute : var template = { strokeColor: #FF, ... pointRadius: ${yourAttribute} }; styleMapRotation = new OpenLayers.StyleMap(new OpenLayers.Style(template)); or you use a styleMap with context, if you want calculate the radius by other conditions : function set_styleMapRotation() { var context = { getPointRadius : function(ft){ var zoomOffset = map.projection == EPSG:4326 ? 1 : 8; var fktr=1; var diffZ = map.getZoom() - zoomOffset; return diffZ 0 ? 7 + 3*diffZ*fktr : 8; } }; var template = { strokeColor: #FF, ... pointRadius: ${getPointRadius} }; styleMapRotation = new OpenLayers.StyleMap(new OpenLayers.Style(template, {context:context}) ); } set_styleMapRotation(); Example with pointRadius set by the attribute for the population of cities and label size by zoomLevel http://gis.ibbeck.de/OLClient/OLClient.asp?KARTE=k1 Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von geotech Gesendet: Mittwoch, 14. Juli 2010 03:58 An: users@openlayers.org Betreff: [OpenLayers-Users] Proportional Symbols from GMLattributes/OpenLayers I know there is an easy solution to this problem just haven't found what I'm looking for. This is my situation, I'm using FeatureServer to load my overlay points from shapefiles to .gml . I'm using an OSM baselayer with a reprojection from UTM to lat/lon. What I want to do is display point symbols using a ratio to the attribute value aka proportional symbols.Is there an Openlayers.get.attribute or something along those lines that I can pull an attribute value from the gml or is this a matter of hacking JavaScript to get the results I'm looking for. -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Proportional-Symbols-from-GML-attribu tes-OpenLayers-tp5290622p5290622.html 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] Function to get visible layers on a map?
Hi, Use the property 'visibility' of the layer var Msg = ; for(var i=0;imap.layers.length;i++) {Msg += map.layers[i].name + :: + map.layers[i].visibility + \r\n; } alert(Msg); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Robert Hicks Gesendet: Freitag, 2. Juli 2010 21:40 An: users@openlayers.org Betreff: [OpenLayers-Users] Function to get visible layers on a map? Hey all, is there a function or some easy way to find which layers are set to visible on a map? -- web http://www.hyxspace.com aim hyx1138 ___ 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] Zoom to point given feature ID by GET
Hi, Below some code to get the idea //http://yourServer/someSide/page.html?CENTER=100,120ZOOM=8 function init() { var CENTER = [2627000, 5685625]; var ZOOM = 0; objParams = OpenLayers.Util.getParameters(); var CENTER = objParams.CENTER ? objParams.CENTER.split(,) : CENTER; var ZOOM = objParams.ZOOM ? parseInt(objParams.ZOOM) : ZOOM; var theID = objParams.ID ? objParams.ID : null; ... ... map.setCenter(new OpenLayers.LonLat(CENTER[0], CENTER[1]), ZOOM); if(theID != null) { vectorLayer.events.register(loadend, vectorLayer, function (e) { var objFs = this.features; for(var i=0;iobjFs.length;i++) { if(objFs[i].ID = theID; { var objBounds = objFs[i].geometry.getBounds(); var x = (objBounds.left+objBounds.right )/2; var y = (objBounds.top +objBounds.bottom)/2; CENTER = [x, y]; break; } } }); map.setCenter(new OpenLayers.LonLat(CENTER[0], CENTER[1]), ZOOM); } } To center your map by a feature of a vector layer you have to be sure, that your features are loaded. I would center my map to default values, register a loadend for the vector layer, and then would parse for the feature by id and then set the center by the new value. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von giraam Gesendet: Mittwoch, 30. Juni 2010 15:15 An: users@openlayers.org Betreff: [OpenLayers-Users] Zoom to point given feature ID by GET Hi folks! I want to know if it's possible to zoom to a point, I mean, i.e.: setCenter(point, 2) but having the feature ID at the URL... This is just on the first load..! Any idea? Thanks! - just another web developer -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Zoom-to-point-given-feature-ID-by-GET -tp5237659p5237659.html 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] parsing a GML file into different layers
Hi Alex, that's how I would do it. Use an Ajax request to get the GML-file and then parse it and add every feature to an new vector layer. If your GML-file residents on the same server (use relative path to the gml), then you don't need a proxy script. If have tested the below code locally with the example spherical-mercator.html. var formats = { wkt: new OpenLayers.Format.WKT(), geojson: new OpenLayers.Format.GeoJSON(), georss: new OpenLayers.Format.GeoRSS(), gml: new OpenLayers.Format.GML(), kml: new OpenLayers.Format.KML() }; function getGML() { theUrl = /OLClient/some.gml; var myAjax = new OpenLayers.Ajax.Request( theUrl, { method: 'get', onComplete: showResponse, onFailure: showResponseFailure }); } var arr = []; function showResponse(response) { var theParser = formats[gml]; theParser.internalProjection = null; theParser.externalProjection = null; theParser.extractStyles = false; theParser.extractAttributes = true; var features = theParser.read(response.responseText); if(features) { if(features.constructor != Array) features = [features]; //iterate the features and put them on a vector layer for(var i=0;ifeatures.length;i++) { //get the feature type var ftType = features[i].geometry.CLASS_NAME.replace(/OpenLayers.Geometry./,); //count the feature of a type arr[ftType] = arr[ftType] + 1; var ftLyr = new OpenLayers.Layer.Vector(ftType + + arr[ftType]); map.addLayer(ftLyr); ftLyr.addFeatures(features[i]); } //to zoom to the features var bounds = features[0].geometry.getBounds().clone(); for(var i=1;ifeatures.length;i++) bounds.extend(features[i].geometry.getBounds()); map.zoomToExtent(bounds,false); } else alert('Bad input ' + type); } function showResponseFailure(response) { alert(response); } getGML(); Arnd Von: Alex Brandsen [mailto:alex.brand...@gmail.com] Gesendet: Dienstag, 29. Juni 2010 12:23 An: Arnd Wippermann Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] parsing a GML file into different layers Hi Arnd, thanks for your reply, this seems like it should work. I've been trying it out, but can't get it to work.. What should go in the brackets after 'GML', and where does 'response' come from? Sorry if these are really basic questions, but I don't have much experience in JS or OL... Thanks again, Alex. On Sun, Jun 27, 2010 at 2:44 PM, Arnd Wippermann arnd.wipperm...@web.de wrote: Hi, something like this should work: var features = new OpenLayers.Format.GML().read(response); if(features) { if(features.constructor != Array) features = [features]; for(var i=0;ifeatures.length;i++) { var ftLyr = new OpenLayers.Layer.Vector(Feature + i); addLayer(ftLyr); ftLyr.addFeatures(features[i]); } } Arnd Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Alex Brandsen Gesendet: Sonntag, 27. Juni 2010 14:43 An: Eric Lemoine Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] parsing a GML file into different layers Hi Eric, thanks for your reply. I probably need to use OpenLayers. Format.GML.read() , but how do I then split the array it returns into different layers? Thanks, Alex. On Sat, Jun 26, 2010 at 7:12 AM, Eric Lemoine eric.lemo...@camptocamp.com wrote: On Friday, June 25, 2010, Alex Brandsen alex.brand...@gmail.com wrote: Hi all, I'm building a map of a medieval wallpainting, and the graffiti inscribed in this wall, which can be found on www.thomasav.com/DurhamGraffiti/ (still quite buggy though!). I was wondering if there is a way for OpenLayers to dynamically turn features from a single GML file into seperate layers, by providing an array of feature id's. I've been looking through the documentation and been googling around, but I can't seem to find anything useful. Perhaps OpenLayers. Filter. FeatureId could do something like this, but the documentation on this is quite sparse.. Ofcourse, I could just write a php script that would pre-parse the gml into seperate, temporary gml files, but I think using OpenLayers itself would be preferable. If anyone has any ideas, I would be very grateful
Re: [OpenLayers-Users] parsing a GML file into different layers
Hi, something like this should work: var features = new OpenLayers.Format.GML().read(response); if(features) { if(features.constructor != Array) features = [features]; for(var i=0;ifeatures.length;i++) { var ftLyr = new OpenLayers.Layer.Vector(Feature + i); addLayer(ftLyr); ftLyr.addFeatures(features[i]); } } Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Alex Brandsen Gesendet: Sonntag, 27. Juni 2010 14:43 An: Eric Lemoine Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] parsing a GML file into different layers Hi Eric, thanks for your reply. I probably need to use OpenLayers. Format.GML.read() , but how do I then split the array it returns into different layers? Thanks, Alex. On Sat, Jun 26, 2010 at 7:12 AM, Eric Lemoine eric.lemo...@camptocamp.com wrote: On Friday, June 25, 2010, Alex Brandsen alex.brand...@gmail.com wrote: Hi all, I'm building a map of a medieval wallpainting, and the graffiti inscribed in this wall, which can be found on www.thomasav.com/DurhamGraffiti/ (still quite buggy though!). I was wondering if there is a way for OpenLayers to dynamically turn features from a single GML file into seperate layers, by providing an array of feature id's. I've been looking through the documentation and been googling around, but I can't seem to find anything useful. Perhaps OpenLayers. Filter. FeatureId could do something like this, but the documentation on this is quite sparse.. Ofcourse, I could just write a php script that would pre-parse the gml into seperate, temporary gml files, but I think using OpenLayers itself would be preferable. If anyone has any ideas, I would be very grateful! Hi The protocol or format that you use will give you an array of features. You are then free to dispatch the features to separate vector layers, for example based on their ids. I hope it helps, -- 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
Re: [OpenLayers-Users] Why does OpenLayers.Layer.Vector not work atall?
Hi, If you mean by *nothing*, that you get nothing displayed, then I guess you use IE. There is a comma in your code, where it not should be. style: {strokeColor: green, strokeWidth: 5, strokeOpacity: 0.5}, -- The code you use, should work in FF. If the comma is the reason for the failing, then an OpenLayers throw wouldn't help. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Manuel Reimer Gesendet: Montag, 21. Juni 2010 16:34 An: users@openlayers.org Betreff: [OpenLayers-Users] Why does OpenLayers.Layer.Vector not work atall? Hello, the following code does *exactly* what I want: var layer = new OpenLayers.Layer.GML(Polygon, relation.osm, { format: OpenLayers.Format.OSM, style: {strokeColor: green, strokeWidth: 5, strokeOpacity: 0.5}, projection: new OpenLayers.Projection(EPSG:4326) }); map.addLayer(layer); And the following code does *nothing*: var layer = new OpenLayers.Layer.Vector(Polygon, { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: relation.osm, format: new OpenLayers.Format.OSM() }), projection: new OpenLayers.Projection(EPSG:4326), style: {strokeColor: green, strokeWidth: 5, strokeOpacity: 0.5}, }); map.addLayer(layer); Where is my mistake? I finally give up after *many* tries! IMHO it would help very much if OpenLayers would give more feedback. Why don't you have some calls to throw in your code to make it easier to debug... Thanks in advance Yours Manuel ___ 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] WFS Not Returning Coordinates
Hi Roald, Adding propertyNames (attributes of the feature) to the protocol solves the problem with the geometry for MapServer 5.6.1. First I thought it wouldn't work, because i added msgeometry instead of msGeometry. And I have to add srsName to the protocol, what for version 5.2 is not needed. thx Arnd -Ursprüngliche Nachricht- Von: Roald de Wit [mailto:l...@rdewit.net] Gesendet: Samstag, 29. Mai 2010 07:25 An: 'Blake Crosby' Cc: Arnd Wippermann; users@openlayers.org Betreff: Re: [OpenLayers-Users] WFS Not Returning Coordinates Hi Blake, You can work around this issue by providing the property names explicitly in the options of your protocol, including the name of the geometry. Example: propertyNames: 'year,seq,name,storm_start,storm_end,msGeometry'.split(',') Note that MapServer by default chooses 'msGeometry' as the name of the geometry attribute even though it might be called 'the_geom' or 'wkb_geometry' on the data source. In your case it's 'location' I presume. Regards, Roald On 28/05/10 03:26, Arnd Wippermann wrote: Hi, If you use Mapserver 5.6.x, then it's a bug. WFS Server - GetFeature POST request does not return geometry http://trac.osgeo.org/mapserver/ticket/3235 Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Blake Crosby Gesendet: Donnerstag, 27. Mai 2010 16:36 An: users@openlayers.org Betreff: [OpenLayers-Users] WFS Not Returning Coordinates Hello, I'm using WFS Protocol on a vector layer (as per the example) to plot data on the map from a wfs server: var geographic = new OpenLayers.Projection(EPSG:4326); var layer = new OpenLayers.Layer.Vector(WFS, { strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ url: http://mapserver.worldflightplanner.com/radar/;, featureType: flightrules, featureNS: http://mapserver.gis.umn.edu/mapserver;, featurePrefix: ms, version: 1.1.0, geometryName: location, srsName: EPSG:4326, extractAttribute: true }),projection: geographic }); This works fine, however, the returned GML from the WFS does not contain any coordinates, just the metadata. Is this something wrong with my Mapserver configuration, or my OL call? You can see the request, and the returned data here: http://pastebin.org/284683 Thanks, Blake ___ 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
Re: [OpenLayers-Users] WFS Not Returning Coordinates
Hi, If you use Mapserver 5.6.x, then it's a bug. WFS Server - GetFeature POST request does not return geometry http://trac.osgeo.org/mapserver/ticket/3235 Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Blake Crosby Gesendet: Donnerstag, 27. Mai 2010 16:36 An: users@openlayers.org Betreff: [OpenLayers-Users] WFS Not Returning Coordinates Hello, I'm using WFS Protocol on a vector layer (as per the example) to plot data on the map from a wfs server: var geographic = new OpenLayers.Projection(EPSG:4326); var layer = new OpenLayers.Layer.Vector(WFS, { strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ url: http://mapserver.worldflightplanner.com/radar/;, featureType: flightrules, featureNS: http://mapserver.gis.umn.edu/mapserver;, featurePrefix: ms, version: 1.1.0, geometryName: location, srsName: EPSG:4326, extractAttribute: true }),projection: geographic }); This works fine, however, the returned GML from the WFS does not contain any coordinates, just the metadata. Is this something wrong with my Mapserver configuration, or my OL call? You can see the request, and the returned data here: http://pastebin.org/284683 Thanks, Blake ___ 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] GetFeatureInfo returns attribute nameonly(Mapserver Openlayers)
Hi, It's an issue with MapServer. If the returned html shows only [NAME] as in the template, then it means, that MapServer couldn't resolve the tag. Perhaps you have no column NAME in your data or it's an issue with upper and lowercase. Try 'wms_feature_info_mime_type' 'text/plain' 'wms_include_items' 'all' To get the result with all attributes, that are availible. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von simi Gesendet: Montag, 24. Mai 2010 10:14 An: users@openlayers.org Betreff: [OpenLayers-Users] GetFeatureInfo returns attribute nameonly(Mapserver Openlayers) I have been trying for a long time(since february 2010) to use GetFeatureInfo to display the attributes of a clicked polygon feature . The map is displayed in OpenLayers 2.8 which uses a mapserver 5.6.1 for the mapfile whose data source is a shapefile. When i click on a polygon feature, i only get the attribute name [NAME] (as it appears on the html body template file) AND not the atrribute values. Please help.Here is the openlayers file contents; html headtitleOpenLayers project/title style type=text/css #map { width: 800px; height: 600px; border: 1px solid black; } /style script src=http://openlayers.org/api/OpenLayers.js;/script script type=text/javascript function init() { var map = new OpenLayers.Map('map'); var dcs = new OpenLayers.Layer.WMS( 'Admin Districts', 'http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/cgi-bin/Districts2. map', {layers: 'Botswana_Admin_Districts'} ); map.addLayer(dcs); map.setCenter(new OpenLayers.LonLat(25,-24),6); // Tie click event to WMS GetFeatureInfo call map.events.register('click', map, function (e) { var url = http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/cgi-bin/Districts2. map + ?REQUEST=GetFeatureInfo + EXCEPTIONS=application/vnd.ogc.se_xml + BBOX= + map.getExtent().toBBOX() + X= + e.xy.x + Y= + e.xy.y + INFO_FORMAT=text/html + QUERY_LAYERS=Botswana_Admin_Districts + LAYERS=Botswana_Admin_Districts + FEATURE_COUNT=5 + SRS=EPSG:4326 + STYLES= + WIDTH= + map.size.w + HEIGHT= + map.size.h; window.open(url, GetFeatureInfo, location=0,status=0,scrollbars=1,width=600,height=150 ); }); } /script /head body onload=init() h2OpenLayers Example/h2 div id='map'/div /body /html and the mapfile; MAP NAME Districts2 # Map image size SIZE 400 400 UNITS dd EXTENT 15.807570 -27.131403 33.564789 -17.550001 SHAPEPATH 'C:\ms4w\PSI_Shapefiles\' #FONTSET './fonts/fonts.txt' SYMBOLSET 'C:\ms4w\Apache\cgi-bin\Symbols.sym' PROJECTION 'proj=longlat' 'ellps=WGS84' 'datum=WGS84' 'no_defs' END # Background color for the map canvas -- change as desired IMAGECOLOR 255 255 255 IMAGEQUALITY 95 IMAGETYPE agg OUTPUTFORMAT NAME agg DRIVER AGG/PNG IMAGEMODE RGB END # Legend LEGEND IMAGECOLOR 255 255 255 STATUS ON KEYSIZE 18 12 LABEL TYPE BITMAP SIZE MEDIUM COLOR 0 0 89 END END # Web interface definition. Only the template parameter # is required to display a map. See MapServer documentation WEB # Set IMAGEPATH to the path where MapServer should # write its output. IMAGEPATH 'C:\ms4w\tmp\' # Set IMAGEURL to the url that points to IMAGEPATH # as defined in your web server configuration IMAGEURL '\tmp\' # WMS server settings METADATA wms_title 'QGIS-MAP' wms_onlineresource 'http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/cgi-bin/Districts2. map' wms_srs 'EPSG:4326' wms_server_version '1.1.1' wms_feature_info_mime_type 'text/html' END #Scale range at which web interface will operate # Template and header/footer settings # Only the template parameter is required to display a map. See MapServer documentation HEADER 'http://localhost/Header.html' TEMPLATE 'http://localhost/Body.html' FOOTER 'http://localhost/Footer.html' END LAYER NAME 'Botswana_Admin_Districts' TYPE POLYGON TOLERANCE 10 TOLERANCEUNITS pixels DUMP true HEADER 'http://localhost/Header.html' FOOTER 'http://localhost/Footer.html' EXTENT 15.807570 -27.131403 33.564789 -17.550001 DATA Botswana_Admin_Districts METADATA wms_title 'Botswana_Admin_Districts' wms_srs 'EPSG:4326' gml_include_items 'NAME' wms_include_items 'NAME' wms_server_version '1.1.1' wms_name 'Botswana_Admin_Districts' wms_feature_info_mime_type 'text/html' gml_featureid 'OBJECTID' END STATUS ON TRANSPARENCY 100 PROJECTION 'proj=longlat' 'ellps=WGS84' 'datum=WGS84' 'no_defs'
Re: [OpenLayers-Users] Layer from raster images...
Hi As a workaround you could try with a point vectorlayer and externalGraphic. With small images it works. Problem is, when the insert point is outside the viewport, then the externalGraphic will not displayed. Example with nine images http://gis.ibbeck.de/ginfo/apps/OLExamples/OL29/ExternalGraphicTilesLayer/Ex ternalGraphicTilesLayer.asp Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von paweluz Gesendet: Montag, 24. Mai 2010 22:52 An: users@openlayers.org Betreff: [OpenLayers-Users] Layer from raster images... Hi! It has been a while since I got any problems with OL but this time has unfortunately come... Actually I am just looking for some solution for my task... I got some images that shows the city of New York with the streets hotels and some other objects. All this data are stored as jpg files. I have images of N.Y. in different scales e.g. 1:1000, 1:5000 and so on... So for example I got 9 images of N.Y in scale 1:1000, 9 images in scale 1:2000 etc... I have also got the center point of each picture. My task is to use them all in openlayers. But I have to: - presents not one picture on map but many pictures in some order. I mean like this: 1.jpg 2.jpg 3.jpg 4.jpg 5.jpg 6.jpg 7.jpg 8.jpg 9.jpg I have to glue them together using openlayers to preset the hole map of N.Y. - I have to change all the images when someone changes the scale (zoom) I was thinking about using the Image layer, but as far I know, one Image layer does not allow to present many pictures... in url you define just the string to url, and not the e.g table of images... I know it is not standard question but maybe someone has any ideas... or thoughts on this... Any help would be appreciated Regards Poul -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Layer-from-raster-images-tp5095731p50 95731.html 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] how to get layers in a layer
Hi, yourWMS.params.LAYERS The params of the wms layer are in uppercase. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Ryan Williams Gesendet: Montag, 17. Mai 2010 18:26 An: users@openlayers.org Betreff: [OpenLayers-Users] how to get layers in a layer Hi all, I've searched around on google for a while on this and haven't found an answer yet: Can anyone show me an example of how to get the layers in a openlayers wms.layer? Here's an example: cities = new OpenLayers.Layer.WMS(US Cities, wms_path, {layers: 'Public:US_Cities'} ); I'm able to read items like the layer name (which would be US Cities in the above example, with: layer.get(layer).name but haven't had luck with getting the layers listed in the paramaters ( { layers: }) I want to know how to get the value 'Public:US_Cities' Thanks, Ryan -- Ryan Williams, GISP GIS Analyst / Programmer PAQ Interactive Inc. 107 S State St., Suite 300 Monticello, IL 61856-1968 Office: (217) 762-7955 Mobile: (217) 722-2794 rwilli...@paqinteractive.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] How to use Gauss Krueger JPEG with Open Layer?
Hi, If the size of the images are reasonable, then the easiest way is to use an OpenLayers.Layer.Image. Set the map with your Gauss-Krüger projection, add a baselayer and then your image layers (with yourImgLayer.isBaseLayer=false). Or take the image layers as baselayers. http://openlayers.org/dev/examples/image-layer.html Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Marcel Ruff Gesendet: Freitag, 14. Mai 2010 11:08 An: users@openlayers.org Betreff: [OpenLayers-Users] How to use Gauss Krueger JPEG with Open Layer? Hi, I have some jpegs with Gauß Krüger projection. How can I use those with Open Layers? Thank you Marcel ___ 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] How to use Gauss Krueger JPEG with Open Layer?
Hello, not that I'm aware. But images could be really large. 8000 x 4000 is no problem. You have to wait a moment until the image is loaded, but afterwards pan and zoom works lovely. Regards, Arnd _ Von: Nicholas Efremov-Kendall [mailto:n.e.kend...@gmail.com] Gesendet: Freitag, 14. Mai 2010 15:21 An: Arnd Wippermann Cc: Marcel Ruff; users@openlayers.org Betreff: Re: [OpenLayers-Users] How to use Gauss Krueger JPEG with Open Layer? Just for reference, is there a max size/resolution that can be used optimally with the layer.image? On Fri, May 14, 2010 at 4:14 PM, Arnd Wippermann arnd.wipperm...@web.de wrote: Hi, If the size of the images are reasonable, then the easiest way is to use an OpenLayers.Layer.Image. Set the map with your Gauss-Krüger projection, add a baselayer and then your image layers (with yourImgLayer.isBaseLayer=false). Or take the image layers as baselayers. http://openlayers.org/dev/examples/image-layer.html Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Marcel Ruff Gesendet: Freitag, 14. Mai 2010 11:08 An: users@openlayers.org Betreff: [OpenLayers-Users] How to use Gauss Krueger JPEG with Open Layer? Hi, I have some jpegs with Gauß Krüger projection. How can I use those with Open Layers? Thank you Marcel ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users -- Nicholas Efremov-Kendall Fulbright Student 2009-2010, Ukraine nefre...@artsci.wustl.edu c/o Halyna Yerko Balzaka 92a, Kv 27 02232 Kyiv, Ukraine (mob) +380963576524 ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] List features in WMS
Hi, That's not the intention of WMS. WMS does not allow to request all features from a server. If the serverside wants to deliver all the data, then they have to setup a wfs. Or if it's your own server and you use MapServer, then it could be possible with a MapServer CGI-request. Regards, Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von sasamil Gesendet: Donnerstag, 13. Mai 2010 09:49 An: users@openlayers.org Betreff: [OpenLayers-Users] List features in WMS Hello friends! How can one list all the features (for example, road-lines with the attributes) in a wms layer? It is easy (more or less) to perform it in wfs; but, how can we do that in wms? (GetFeatureInfo returns information about features located on the clicked point but it doesn't answer to my wishes. I need ALL the features in a layer) Regards! -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/List-features-in-WMS-tp5045091p504509 1.html 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] IE 8 this.size.w is null or not an object -OL 2.9
Hi, I'm not sure, if it solves your problem. But i had the same error with my application and I could solve it by adding to the map div style width:100%; height:100%; #map{ width:100%; height:100%; } With FF i hadn't a problem. And with OL 2.8 this wasn't needed. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Dash Gesendet: Donnerstag, 6. Mai 2010 21:40 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] IE 8 this.size.w is null or not an object -OL 2.9 Hello again, I was excited to hear there was a fix but when I downloaded and tried 2.9.1 I still received the same error message within Internet Explorer when I click on a point and try to obtain the popup box: this.size.w is null or not an object. I am totally at a loss . I've attached some of my code in hopes that someone will be able to point out the issue (if there is one). function findLayerClick(event) { mouseLoc = map.getLonLatFromPixel(event.xy); var url = prox.getFullRequestString({ REQUEST: GetFeatureInfo, EXCEPTIONS: application/vnd.ogc.se_xml, BBOX: map.getExtent().toBBOX(), X: event.xy.x, Y: event.xy.y, INFO_FORMAT: 'gml', LAYERS: map.layers[6].params.LAYERS + , + map.layers[7].params.LAYERS, QUERY_LAYERS: map.layers[6].params.LAYERS + , + map.layers[7].params.LAYERS, FEATURE_COUNT: 1, WIDTH: map.size.w, HEIGHT: map.size.h, STYLE: ''}, http://ain'tnothinglikeachickenwing?); OpenLayers.loadURL(url, '', this, setHTML); Event.stop(event); } function setHTML(response) { var xmlFormat = new OpenLayers.Format.XML(); var xmlResponse = xmlFormat.read(response.responseText); var featureType = xmlResponse.getElementsByTagName(feature)[0]; var lyrName = featureType.textContent; switch(lyrName) { case adt: //alert(Layer name: + lyrName); var adt1995 = xmlResponse.getElementsByTagName(adt1995)[0]; var value1995 = adt1995.textContent; var adt1997 = xmlResponse.getElementsByTagName(adt1997)[0]; var value1997 = adt1997.textContent; var adt2000 = xmlResponse.getElementsByTagName(adt2000)[0]; var value2000 = adt2000.textContent; var adt2002 = xmlResponse.getElementsByTagName(adt2002)[0]; var value2002 = adt2002.textContent; var adt2005 = xmlResponse.getElementsByTagName(adt2005)[0]; var value2005 = adt2005.textContent; var adt2008 = xmlResponse.getElementsByTagName(adt2008)[0]; var value2008 = adt2008.textContent; // Create popup box var popup_info = Average Daily Traffic Countsbr / + ADT 1995: + value1995 + br / + ADT 1997: + value1997 + br / + ADT 2000: + value2000 + br / + ADT 2002: + value2002 + br / + ADT 2005: + value2005 + br / + ADT 2008: + value2008 + ; break; case turnmove: //alert(Layer name: + lyrName); var interSecTag = xmlResponse.getElementsByTagName(addr)[0]; var intersection = interSecTag.textContent; var pdfLinkTag = xmlResponse.getElementsByTagName(link)[0]; var pdfLink = pdfLinkTag.textContent; var popup_info = Turning Movementbr / + Intersection: + intersection + br / + PDF Image: + pdfLink + Total Vehicle Summary ; break; defualt: alert(No layer selected.); } if (popup != null) { popup.destroy(); popup = null; } popup = new OpenLayers.Popup.FramedCloud(Traffic, mouseLoc, new OpenLayers.Size(250,120), popup_info, null, true); map.addPopup(popup); popup.events.register(click, map, popupDestroy); } -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/IE-8-this-size-w-is-null-or-not-an-ob ject-OL-2-9-tp5006221p5016099.html Sent from the OpenLayers Users mailing list archive at Nabble.com. ___ Users mailing list Users@openlayers.org
Re: [OpenLayers-Users] kml-files doesn't shown correct
Hi, It seems to be a projection error. Your data come in EPSG:4326 (-180 - 180, -90 - 90), that's in sphericalMercator equal 0,0 near Africa. I would think, that you use map.projection sphericalMercator and for map.displayProjection also sphericalMercator. Set in the layer declaration projection: EPSG:4326 and your data should be at the right place. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Dirk Wimmer Gesendet: Mittwoch, 5. Mai 2010 23:45 An: users@openlayers.org Betreff: [OpenLayers-Users] kml-files doesn't shown correct Hello, I have problem to use this kml file with openlayers: http://www.dav-felsinfo.de/export/cliffs_kml.php?1=22 E.g. I use this example http://www.openlayers.org/dev/examples/sundials.html and change only a little bit: var sundials = new OpenLayers.Layer.Vector(KML, { projection: map.displayProjection, strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: http://www.dav-felsinfo.de/export/cliffs_kml.php?1=22;, format: new OpenLayers.Format.KML({ extractStyles: true, extractAttributes: true }) }) Then I see only one icon in the sea nearby Africa and not in Germany. :-( But the result should looks like that: http://maps.google.de/maps?f=qhl=deq=http://www.dav-felsinfo.de/export/cli ffs_kml.php?1=22 I try some other kml files and it works. Could it be that this kml file is incorrect? Any ideas? thanks, Dirk ___ 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] HELP!!! How implement Filter in WMS Layer
Hi Paul, SLD_BODY is a request parameter of a wms. If you can get from your grid a reference to your OpenLayers WMS layer, then you can use yourWMSlayer.mergeNewParams('SLD_BODY' : ). if your wms have only one layer (in the eample below POLYGONS) to request, you can use something like this StyledLayerDescriptor version=1.0.0 xmlns=http://www.opengis.net/sld; xmlns:gml=http://www.opengis.net/gml; xmlns:ogc=http://www.opengis.net/ogc; xmlns:xlink=http://www.w3.org/1999/xlink; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd; NamedLayer NameCOUNTRY/Name UserStyle FeatureTypeStyle Rule PolygonSymbolizer Fill CssParameter name=fill#f0f0f0/CssParameter CssParameter name=fill-opacity1.00/CssParameter /Fill Stroke CssParameter name=stroke#646464/CssParameter /Stroke /PolygonSymbolizer /Rule /FeatureTypeStyle /UserStyle /NamedLayer /StyledLayerDescriptor as SLD_BODY to highlight the the features of the layer. Attention! You have to delete the line feeds for the request. Zooming to the extent of the wms layer is not so easy, perhaps inpossible. You can request the WMS GetCapabilities and hope that there the correct extent are described for the layer. Or if the layer is also requestable as WFS you can perhaps on that way get the extent of the layer. But I'm not sure. If you are the holder of the WMS server, I would suggest, that you calculate the extent on other ways and adds it as array to your application. Arnd _ Von: Paul james [mailto:paulj...@gmail.com] Gesendet: Montag, 3. Mai 2010 16:39 An: Arnd Wippermann Cc: fsalas; users@openlayers.org Betreff: Re: [OpenLayers-Users] HELP!!! How implement Filter in WMS Layer Hi Arnd... I have some questions about that... First I have a geo app using Openlayers/Mapserver WMS with SDE layers My application has a treeview with all layers, and a radiobox for each layer... When I click in a layer´s radiobox a window with a GRID containing all layer´s data is opened... In that GRID, When I select a line (layer´s data), the Map should : 1-) Highlight it 2-) Zoom in data selected Can I develope that using SLD and SLD_BODY ? Do you have any tip to how do that? Thanks ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] show only specific objects, wms
Hi, You can do it on runtime with layerWMS.mergeNewParams({ SLD_BODY : ...sld_body... }); I use this way to highlight a choosen country http://gis.ibbeck.de/OLClient/examples/wms_sld_world.asp Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von t...@f!t Gesendet: Freitag, 30. April 2010 17:47 An: users@openlayers.org Betreff: [OpenLayers-Users] show only specific objects, wms Hy all, I use GeoServer with OpenLayers. I have a WMS Layer with many kinds types of objects. How can I show only for example object whose attribut has a special value? I know I can create SLD so that it shows what I need. But the problem ist that I have about 1000 different attribut values. And I can't create 1000 SLD documents... I hope you understood my problem... Is this possible with a WMS Layer? Or is there a way I can change the SLD on runtime? cheers David -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/show-only-specific-objects-wms-tp4986 382p4986382.html 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] KML over VirtualEarth Map doesn't display or hasa shift
Hi, I think, you have add 'sphericalMercator' to your layer. var vehyb = new OpenLayers.Layer.VirtualEarth( Virtual Earth Hybrid, {'type': VEMapStyle.Hybrid, 'sphericalMercator': true} ); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Stefan Keller Gesendet: Freitag, 30. April 2010 19:47 An: users@openlayers.org Betreff: [OpenLayers-Users] KML over VirtualEarth Map doesn't display or hasa shift Hi! I'm trying to lay an KML over VirtualEarth Map in OpenLayers, but it either does'nt display anything or KML points have a shift of 100m. I guess it has to be something with the projection. Map: var options = { controls: [ new OpenLayers.Control.KeyboardDefaults(), new OpenLayers.Control.MouseDefaults(), new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.LayerSwitcher() ], maxExtent: new OpenLayers.Bounds( -20, -20, 20, 20), numZoomLevels: 19, units: 'm', projection: new OpenLayers.Projection(EPSG:900913), displayProjection: new OpenLayers.Projection(EPSG:4326), sphericalMercator: true }; map = new OpenLayers.Map(map, options); var binghybrid = new OpenLayers.Layer.VirtualEarth(Hybrid, { type: VEMapStyle.Hybrid }); KML: var animals = new OpenLayers.Layer.Vector(Animals, { projection: new OpenLayers.Projection(EPSG:4326), strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: kml/animals.kml, format: new OpenLayers.Format.KML({ extractStyles: true, extractAttributes: true }) }) }); Anybody?! ___ 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] unselect did not work
Hi Sarah, the example shows how to retrieve features from a wms layer. But you have a vector layer (wfs layer). So you can link the SelectFeatureControl to that layer. ctrlSelectFeatureOptions = { clickout: true, toggle: true, multiple: false, hover: false, toggleKey: ctrlKey, multipleKey: none, box: false }; ctrlSelectFeature = new OpenLayers.Control.SelectFeature(layerWFS, ctrlSelectFeatureOptions); //optional ctrlSelectFeature.onSelect= function (ft) { }; ctrlSelectFeature.onUnselect = function (ft) { }; ctrlSelectFeature.activate(); If you now click on a feature from your wfs it will be selected. If you do not add a own styleMap to your wfs layer, the default styleMap is used to display the features for the different modes (unselected, selected or temporarily). If you want use your own styleMap, you have to declare the styles for the different modes (at last 'default' for unselected features and 'select' for selected features) to see that you have select a feature. Arnd _ Von: Sarah Schuessler [mailto:sarah_f...@yahoo.de] Gesendet: Dienstag, 27. April 2010 09:57 An: Arnd Wippermann Cc: users@openlayers.org Betreff: AW: [OpenLayers-Users] unselect did not work Hi Arnd, thanks for your answer! Please read below. _ Hi, i'm not sure, why you need a layer for your selected feature. Why not use the selectFeatureControl on the wfs layer. I use my Control.SelectFeature with my wfs layer(wfs2)- or don`t I use the event right? (event.register instead of events.on). I get along with this example: http://dev.openlayers.org/releases/OpenLayers-2.9/examples/getfeature-wfs.ht ml to get back a visual selecting for the user and get back some information about the selected feature. About your question. The problem is the feature object. You add not a new feature to a new layer. Instead it seems, that you move the selected feature from the wfs layer to the new layer. That means wfs.event.on(unselected) cann't work, because your selectFeatureControl works only for the wfs layer. Yes I thought something like that, but could not manage to solve this. Thanks for your example! Use a clone of the feature and remove the only feature on your select layer. layerWFS.events.on({'featureselected': function(feature){ selectLayer.addFeatures([feature.feature.clone()]); //selectLayer.addFeatures([feature.feature]); alert(this.selectedFeatures.length); }, 'featureunselected': function(feature){ selectLayer.removeFeatures([selectLayer.features[0]]); //selectLayer.removeFeatures([feature.feature]); alert(this.selectedFeatures.length + - unselected); }, }); A bit confusing is also the style you add as default style to the select layer. It looks like you select a feature on the wfs layer, but it's really the not selected feature on the select layer. So I have to register a select style to my wfs layer and cancel select layer, am I right? best regards Sarah Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Sarah Schuessler Gesendet: Montag, 26. April 2010 10:28 An: users@openlayers.org Betreff: [OpenLayers-Users] unselect did not work Hi list, I try to use Control.SelectFeature but I can`t unselect (selection layer does not get removed). Here is my code: var selectFeature = new OpenLayers.Control.SelectFeature(wfs2, {clickout: true, multiple: false, hover: false, toggle:false, toggleKey: shiftKey, box: true, multipleKey: ctrlKey}); var wfs2 = new OpenLayers.Layer.Vector(WFS_Waldschutz, { styleMap: styleMap, strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.WFS({ url: http://myserver:81/geoserver/wfs?service=wfs;, featureNS: http://mycomp.org;, featureType: mylayer, geometryName: SHAPE, srsName: EPSG:4326, version: 1.1.0 }), projection: new OpenLayers.Projection(EPSG:4326) }); wfs2.events.on({'featureselected': function(feature){ select.addFeatures([feature.feature]); alert(this.selectedFeatures.length); }, 'featureunselected': function(feature){ select.removeFeatures([feature.feature]); alert(this.selectedFeatures.length); alert(unselected); }, }); var select = new OpenLayers.Layer.Vector(Selection, { styleMap: new OpenLayers.Style(OpenLayers.Feature.Vector.style[select]), displayInLayerSwitcher: true
Re: [OpenLayers-Users] unselect did not work
Hi, i'm not sure, why you need a layer for your selected feature. Why not use the selectFeatureControl on the wfs layer. About your question. The problem is the feature object. You add not a new feature to a new layer. Instead it seems, that you move the selected feature from the wfs layer to the new layer. That means wfs.event.on(unselected) cann't work, because your selectFeatureControl works only for the wfs layer. Use a clone of the feature and remove the only feature on your select layer. layerWFS.events.on({'featureselected': function(feature){ selectLayer.addFeatures([feature.feature.clone()]); //selectLayer.addFeatures([feature.feature]); alert(this.selectedFeatures.length); }, 'featureunselected': function(feature){ selectLayer.removeFeatures([selectLayer.features[0]]); //selectLayer.removeFeatures([feature.feature]); alert(this.selectedFeatures.length + - unselected); }, }); A bit confusing is also the style you add as default style to the select layer. It looks like you select a feature on the wfs layer, but it's really the not selected feature on the select layer. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Sarah Schuessler Gesendet: Montag, 26. April 2010 10:28 An: users@openlayers.org Betreff: [OpenLayers-Users] unselect did not work Hi list, I try to use Control.SelectFeature but I can`t unselect (selection layer does not get removed). Here is my code: var selectFeature = new OpenLayers.Control.SelectFeature(wfs2, {clickout: true, multiple: false, hover: false, toggle:false, toggleKey: shiftKey, box: true, multipleKey: ctrlKey}); var wfs2 = new OpenLayers.Layer.Vector(WFS_Waldschutz, { styleMap: styleMap, strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.WFS({ url: http://myserver:81/geoserver/wfs?service=wfs;, featureNS: http://mycomp.org;, featureType: mylayer, geometryName: SHAPE, srsName: EPSG:4326, version: 1.1.0 }), projection: new OpenLayers.Projection(EPSG:4326) }); wfs2.events.on({'featureselected': function(feature){ select.addFeatures([feature.feature]); alert(this.selectedFeatures.length); }, 'featureunselected': function(feature){ select.removeFeatures([feature.feature]); alert(this.selectedFeatures.length); alert(unselected); }, }); var select = new OpenLayers.Layer.Vector(Selection, { styleMap: new OpenLayers.Style(OpenLayers.Feature.Vector.style[select]), displayInLayerSwitcher: true, visibility: true}); featureselected works (at firebug I can see that my app does not get to this break point). What`s wrong? Thank you for any hints. best regards Sarah ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Simple vector problem
Hi, var map = new OpenLayers.Map('map'); without declare any map options, means, that OpenLayers takes the default for the map options. That means EPSG:4326 with maxExtent = [-180, -90, 180, 90]. As your data is in an other projection, OpenLayers tries to reproject the vector data. But I think, you don't use the proj4js library, so OpenLayers fails to reproject the data. And the unprojected data do not fall into maxExtent for EPSG:4326; Try something like this: map = new OpenLayers.Map('map', { maxExtent: new OpenLayers.Bounds(31789.1658, 790194.4183, 337250.8970, 961865.1338), //from http://spatialreference.org/ref/epsg/26986/ numZoomLevels: 16, maxResolution: auto, units: 'm', projection: new OpenLayers.Projection(EPSG:26986), controls:[] }); Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von shaun.ander...@verizon.net Gesendet: Samstag, 24. April 2010 17:22 An: users@openlayers.org Betreff: [OpenLayers-Users] Simple vector problem Hi All, I am very new to OpenLayers. I am doing some testing and trying to use a GML file for a basemap. I have the code below, but it doesn't seem to work. I don't know if there is an error in my code, or if it's my projection. The GML is in Massachusetts stateplane meters NAD83. So I've tried to set the projection to that. When the page loads I get the default OpenLayers pan and zoom controls. And when I shift+drag I get the rectangle, but there is no vector data displayed. please help thanks html head titleOpen Layers Test/title script type=text/javascript src=OpenLayers/OpenLayers.js /script /head body div style=width:100%; height:100% id=map/div script defer=defer type=text/javascript var map = new OpenLayers.Map('map'); var layer = new OpenLayers.Layer.Vector(GML, { isBaseLayer: true, projection: new OpenLayers.Projection(EPSG:26986), protocol: new OpenLayers.Protocol.HTTP({ url: BikeTrails.gml, format: new OpenLayers.Format.GML() }) }); map.addLayer(layer); map.zoomToMaxExtent(); /script /body /html ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Place Point at x% y% to an no geographicLayer.TileCache possible?
Hi, i cann't help you with your problem, but perhaps the below gives you some idea how to resolve it. In OL a map has always a projection. If you not declare a projection, then OL choose by default EPSG:4326 with maxExtent [-180, -90, 180, 90]. In your case you want only a mathematical xy plane. I use in this case EPSG:900913 as projection for the map. So I have a large xy plane to work on. map = new OpenLayers.Map('map', { maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), numZoomLevels: 22, //maxResolution: 156543.0399, maxResolution: 20.0, units: 'm', projection: new OpenLayers.Projection(EPSG:900913), theme : theme/default/style.css, controls:[] }); The above map options are from http://gis.ibbeck.de/ginfo/apps/pentominoes/pentominoes.html. As you can see, this has nothing to do with projection. Nevertheless you have one to choose, when you use OL for your project. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Jimmy Aumard Gesendet: Freitag, 23. April 2010 15:29 An: users Betreff: [OpenLayers-Users] Place Point at x% y% to an no geographicLayer.TileCache possible? Hello, I have no geographic tiles show with OpenLayers.Layer.TileCache and I would like to put a Point(feature) at 50% x and 50% y for example I have test this : var zoom = map.getZoom(); var size = zoomDim[zoom]; // Size of my big image by zoom var x = 50 * size[1] / 100; // give me the x pixel from my image var y = 50 * size[0] / 100; //give me the y pixel from my image var pixel = map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(x,y)); // I have try this to get a correct pixel var coord = map.getLonLatFromPixel(pixel); vector.removeFeatures(vector.features); var point = new OpenLayers.Geometry.Point(coord.lon, coord.lat); vector.addFeatures( [ new OpenLayers.Feature.Vector(point.clone()) ]); It's not work my Point is not on the image. I don't know how can I find a lonlat corresponding to my pixel or more simply how can use openlayers with no projection with just pixel because my data is not geographic Thanks Cheers -- Aumard Jimmy Développeur KINAXIA c/o CICA / PacaEst 2229 Route des Crêtes F-06560 Sophia Antipolis Tél.: +33 (0)4 8973 0242 Mob.: +33 (0)6 6017 2827 Fax : +33 (0)4 8307 6583 http://www.kinaxia.fr ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] OpenLayer OSM, how do i rotate a picture? (and a good way to position it)
Hi, You can add your image as a point feature on a vector layer using externalGraphic. http://gis.ibbeck.de/ginfo/apps/OLExamples/OL27/examples/ExternalGraphicOver lay/ExternalGraphicOverlay.asp The tricky part is to calculate the position and extent of the image if you zoom in or out. But that can be solved by using a styleMap with context. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Atl Gesendet: Montag, 12. April 2010 15:32 An: users@openlayers.org Betreff: [OpenLayers-Users] OpenLayer OSM, how do i rotate a picture? (and a good way to position it) Hey Im trying to place a picture (floorplan of a building) on top of OSM, but i run into some problems. - I need to rotate the picture - Find a good way to position the picture on top of the map. (im currently just placing the picture at a given coordinate). I think of something like upper left of picture has coordinates 0,0 (the start) and placed at 10.1, 10.11212 and rotated 34 deg. But i dont find a good way to implement it this way. Or am i approaching the problem all wrong? Any tips, hints, hacks, code or reference is much welcome. thanks //Atl -- View this message in context: http://n2.nabble.com/OpenLayer-OSM-how-do-i-rotate-a-picture-and-a-good-way- to-position-it-tp4890040p4890040.html 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] Vector labels at different zoom levels
Hi Jeff, that's the styleMap I use to get the effect. Still in IE the labels with the font-size = 0px will drawn in very small letters?! Labels are a function of the zoomlevel (context) and the features are a function of the attribute popClass (UniqueValueRules). var styleMapCapitols; function setStyleMapCapitols() { var context = { getFontSize : function(ft){ var diffZ = map.getZoom() - 4; var popclass = parseInt(ft.attributes.popclass); if(popclass 10 map.getZoom() 1) return(map.getZoom() + 7 + px); else if(diffZ 0 popclass9) return (10 + 1*diffZ +px) else if(diffZ 0) return (8 + 1*diffZ +px) else return(0px); }, getName : function (ft){ return ft.attributes.name; } }; var template = { strokeColor: #FF, strokeOpacity: 1, strokeWidth: 3, fillColor: #00AAFF, fillOpacity: 1, pointRadius: 5, pointerEvents: visiblePainted, label : ${getName}, labelOffsetX: 10, labelOffsetY: -10, fontColor: red, fontSize: ${getFontSize}, fontFamily: Arial, fontWeight: bold, labelAlign: lt }; styleMapCapitols = new OpenLayers.StyleMap(new OpenLayers.Style(template, {context:context}) ); var tata = {fillColor: '#FFAADD', pointRadius: 5, label : ${getName},labelOffsetX: 10,labelOffsetY: 20,fontColor: yellow,fontSize: ${getFontSize},fontFamily: Arial,fontWeight: bold,labelAlign: lt} var popArrO = [0.5 , 0.5 , 0.5 , 0.5 , 0.5 , 0.5 , 0.5 , 0.5 , 0.75 , 0.75 , 0.75]; var popArrW = [1, 1, 1, 1, 1, 1 , 2, 2, 2, 2, 2 ]; var popArrR = [2, 2, 3, 3, 4, 4 , 5, 5, 6, 7, 10]; var popArrC = ['#00', '#00FF00', '#AA00FF', '#FF', '#FF8800', '#FF', '#FF', '#AAFFAA', '#FF', '#FF00FF', '#FF00AA']; var lookup = {}; //popclass beginnt mit 1! for(var i=0;i11;i++) lookup[i+1]= new OpenLayers.Util.applyDefaults({pointRadius: popArrR[i], fillColor: popArrC[i], fillOpacity: popArrO[i], strokeWidth: popArrW[i], strokeColor: popArrC[i]}, tata); styleMapCapitols.addUniqueValueRules(default, popclass, lookup); } setStyleMapCapitols(); an example: http://gis.ibbeck.de/OLClient/OLClient.asp?KARTE=k1 Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Jeff Dege Gesendet: Montag, 12. April 2010 22:19 An: users@openlayers.org Betreff: [OpenLayers-Users] Vector labels at different zoom levels I'm adding some attributes to the GML data I'm using to draw a vector layer, and have set the label member of the style object to display those attributes. It works fine, except that it looks lousy when I zoom out. The labels are still drawn the same, even though the features may be nearly invisible. How do I turn off the rendering of labels, when the scale exceeds some threshold? (Note - I still want to draw the features, I simply don't want the labels.) I've tried adding a listener to map.movestart, that changes the value of layer.styleMap.styles['default'.defaultStyle.label, but that only affects future renderings of the map, it has no effect on the current zoom. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] How to get position of feature from DrawFeature?
Hello, It seems, that there is no place, where one can retrieve the radius and center of the regular polygon. As a workaround this could be a (dirty) solution: Overwite of OpenLayers.Handler.RegularPolygon.prototype.createGeometry = function() { this.angle = Math.PI * ((1/this.sides) - (1/2)); if(this.snapAngle) { this.angle += this.snapAngle * (Math.PI / 180); } this.feature.geometry = OpenLayers.Geometry.Polygon.createRegularPolygon( this.origin, this.radius, this.sides, this.snapAngle ); /* doesn't work. wahrscheinlich wird nur die Geometrie zurückgegeben und das Feature daraus erstellt. this.feature.origin = this.origin; this.feature.radius = this.radius; */ this.feature.geometry.origin = this.origin; this.feature.geometry.radius = this.radius; //console.log(create: + this.origin + , radius: + this.radius); }; OpenLayers.Handler.RegularPolygon.prototype.modifyGeometry = function() { //console.log(modify: + this.origin + , radius: + this.radius); var angle, dx, dy, point; var ring = this.feature.geometry.components[0]; // if the number of sides ever changes, create a new geometry if(ring.components.length != (this.sides + 1)) { this.createGeometry(); ring = this.feature.geometry.components[0]; } for(var i=0; ithis.sides; ++i) { point = ring.components[i]; angle = this.angle + (i * 2 * Math.PI / this.sides); point.x = this.origin.x + (this.radius * Math.cos(angle)); point.y = this.origin.y + (this.radius * Math.sin(angle)); point.clearBounds(); } /* doesn't work. wahrscheinlich wird nur die Geometrie zurückgegeben und das Feature daraus erstellt. this.feature.origin = this.origin; this.feature.radius = this.radius; */ this.feature.geometry.origin = this.origin; this.feature.geometry.radius = this.radius; }; The radius and center will added to the features geometry object (certainly bad programming style) and it is now a part of the feature. alert(yourLayer.features[0].geometry.origin + , + yourLayer.features[0].geometry.radius); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von gtg287y Gesendet: Mittwoch, 7. April 2010 20:39 An: users@openlayers.org Betreff: [OpenLayers-Users] How to get position of feature from DrawFeature? I am using the Draw Feature Control to draw polygons (namely circles) on a Vector Layer. I want to be able to save the center of the circle to a variable, as well as the radius of the circle. I'm not seeing any native way to do this. When I draw a feature, I'm assuming it's a Vector Feature, which has geometry and attributes. When I look at the geometry, I get a bunch of points (I'm assuming 40, since that's how many sides I told my polygon to have). My choices are to figure out some complicated way to turn that array of points into a center and a radius, or (my preference) to manually save the position the mouse is clicked down, and the position the mouse is let up (down is center, the distance from up and down is the radius). However, I'm having difficulties doing that as well: There doesn't seem to be any way to get a mousedown even from a Vector Layer? At least, I'm not seeing any response when I do things like: polygonLayer.events.register(mousedown, feature, function(evt){ console.log(Mouse Down); }); Which implies to me that Vector Layer doesn't inherit from anythign with a mouse down? Doing : document.captureEvents(Event.MOUSEDOWN); document.onmousedown=function(event) { alert(event.type) // mousedown } works fine...everywhere but my map and layer...which doesn't help me much, and (I'm unfamiliar with javascript still), polygonLayer.captureEvents(Event.MOUSEDOWN) doesn't work either (firebug says the function captureEvents doesn't exist for VectorLayer. I must be missing something obvious due to my inexperience: How can I find out where a user's mouse is when the click down, then let up? -Jenny p.s. (Still haven't figured out my polygon refresh issue) -- View this message in context: http://n2.nabble.com/How-to-get-position-of-feature-from-DrawFeature-tp48667 10p4866710.html 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] VectorLayer destroyFeatures doesn't workproperly?
Hi, It seems, that 'beforefeatureadded' not works as one would expect. I would think, that the feature is already in the layers features array, but still drawn on a temporary layer. Deleting the feature(s) works, but obvious do not clear the temporary layer. function clearCircles(){ console.log(Clearing existing circles); console.log(polygonLayer.features.length); polygonLayer.destroyFeatures(polygonLayer.features); polygonLayer.redraw(); }//end clearCircles You have to control, if there are more then one feature in the layer array. Then you can delete the first. polygonLayer.events.register(beforefeatureadded, polygonLayer, function(evt){ if(polygonLayer.features.length1) { console.log(B: + polygonLayer.features.length); polygonLayer.removeFeatures(polygonLayer.features[0]); console.log(--Clearing existing circles--); console.log(C: + polygonLayer.features.length); } console.log(A: + polygonLayer.features.length); });//end attempt at events registration As an better solution I would suggest to delete the previous feature, when the drawing starts. polygonLayer.events.on({ sketchstarted: function(evt) { if(polygonLayer.features[0]) polygonLayer.removeFeatures(polygonLayer.features[0]); } }); http://gis.ibbeck.de/olclient/examples/sketchstarted.html Arnd ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Just another trasformation problem ;)
Hi beppe, the projection parameter is at the wrong place. That is the correct place: var isoline = new OpenLayers.Layer.Vector(isoline, { strategies: [new OpenLayers.Strategy.Fixed()], projection: epsg2498, protocol: new OpenLayers.Protocol.HTTP({ url: isoipse_2498.gml, format: new OpenLayers.Format.GML() }) }); and delete the line isoline = OpenLayers.Projection.transform(isoline, epsg2498, map.projection); that have no effect. you have write correctly a gml layer, but overseen as I, that the projection belongs not to the protocol. I have created a little example to show the projection on the fly with proj4js http://gis.ibbeck.de/OLClient/examples/armenia_900913.html The gml is in projection EPSG:2498 and map.projection is EPSG:900913. 2. if you want to edit vectors with OpenLayers and then save them, you have to use WFS-T (with GeoServer, FeatureServer). Or as a simple solution you can use a serverside script to save your vectors as gml (kml, ...) to your local drive. Only with strategy save it works not. Arnd _ Von: Giuseppe Naponiello [mailto:beppen...@gmail.com] Gesendet: Donnerstag, 8. April 2010 13:43 An: Arnd Wippermann Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] Just another trasformation problem ;) Thanks for suggestion but doesn't works yet!!! I found a solution using qgis plugin ogr2layer, maybe the problem was in the parameters used in transformation code: # isoline = OpenLayers.Projection.transform(isoline, epsg2498, map.projection); new code is: # map.addLayer(new OpenLayers.Layer.GML(isoipse_2498 GML,../aramus_data/vector/reproj/isoipse_2498.gml)); # var extent = new OpenLayers.Bounds(4970294.552162,4901870.266154,4971024.689123,4902439.54224 4).transform(new #OpenLayers.Projection(EPSG:2498), new OpenLayers.Projection(EPSG:900913)); and now works!!! Anyway, I would like understand how to write correctly a gml layer! Another question for you: the second step is to be able to modify the gml, is it possible with strategy save? -beppe- ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] [mapserver-users] record element in query header
Hi, you can try to use javascript in your template. Below an example (it's the whole template, nothing cut out) I use to get different colors for my table rows. script var idx = parseInt([lrn])%2; var myClass = tdBody + idx; //that should only be written for the first row if([lrn]==1) document.write([provincename]hr); document.write(tr class='tblBody'); document.write(td class=' + myClass + '[PROJEKTNUMMER]/td); document.write(td class=' + myClass + '[PROJEKTBEZEICHNUNG]/td); document.write(td class=' + myClass + '[ART][lrn]/td); document.write(td class=' + myClass + '[AGNR]/td); document.write(td class=' + myClass + '[AG]/td); document.write(/tr); /script Arnd _ Von: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] Im Auftrag von steve.tout...@inspq.qc.ca Gesendet: Mittwoch, 7. April 2010 21:15 An: Daniel Morissette Cc: mapserver-us...@lists.osgeo.org; mapserver-users-boun...@lists.osgeo.org Betreff: Re: [mapserver-users] record element in query header Thanks! Here is more details on what I need to do Suppose I have one layer which contains the province in canada and their cities. When the user hover or click on a province, I want this information in a popup or a div (the client is openlayers and I use OpenLayers.Control.WMSGetFeatureInfo) If the user click on the province of Quebec There are 2000 cities in Quebec 1: city name 1 2: city name 2 ... 2000: city name 2000 So In this case I think a field name should be supported in a header template Perhaps I misunderstood what should be managed by the client or the server?? thanks again Steve Daniel Morissette dmorisse...@mapgears.com@lists.osgeo.org Envoyé par : mapserver-users-boun...@lists.osgeo.org 07/04/2010 02:16 PM A mapserver-us...@lists.osgeo.org cc Objet Re: [mapserver-users] record element in query header steve.tout...@inspq.qc.ca wrote: If I put [provincename] in the template I got the value, per example In the Template [lrn]: [provincename] - [elementname]br The result is: 1: Québec - blabla 1 2: Québec - blabla 2 3: Québec - blabla 3 But I don't want to put it in the template since the same information will be repeated. thanks for your help! I'm not exactly sure if a field name should be supported in the header template, but based on a quick browse of the code there are two other ways you could possibly pass the information (depending on what you have on the client side): 1- You can use parameters from the URL in a template tag. e.g. if you pass myprov=Quebec in the URL then you should be able to use [myprov] in your template. 2- You can reference layer-level metadata in query templates using [metadata_...] (Those are untested hints based on a quick browse of the source) Daniel -- Daniel Morissette http://www.mapgears.com/ ___ mapserver-users mailing list mapserver-us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] please help us test OpenLayers 2.9RC1
Hi, I have applied the patch to my application and now changing the opacity of the Google layers works as expected. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Tim Schaub Gesendet: Dienstag, 6. April 2010 23:55 An: users user Betreff: Re: [OpenLayers-Users] please help us test OpenLayers 2.9RC1 Bart van den Eijnden wrote: Thanks Arnd, I've opened up a ticket (no solution as yet): http://trac.openlayers.org/ticket/2562 I've attached a patch for review to this ticket. Discussion about another RC on the dev list. Tim Andreas/Tim, any chance you can have a look at this, since you did most of the work on the Google Layer after 2.8? If not, let me know. TIA. Best regards, Bart On Apr 3, 2010, at 4:51 PM, Arnd Wippermann wrote: Hi Bart, setOpacity for Google layers doesn't work with 2.9. http://gis.ibbeck.de/OLClient/examples/spherical-mercator_29.html In the Google API key I call v=2.93. Wether it's an issue with the other commercial layers, i haven't tested. I don't use them. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Bart van den Eijnden Gesendet: Mittwoch, 31. März 2010 18:01 An: openlayers; users user Betreff: [OpenLayers-Users] please help us test OpenLayers 2.9RC1 This is a reminder to everyone that OpenLayers 2.9 RC1 is out (since last Friday), please help us test this release candidate by upgrading your applications to 2.9RC1 and reporting any issues to us. See also: http://trac.openlayers.org/wiki/Release/2.9/Announce/RC1 Thanks in advance! Best regards, Bart ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users -- Tim Schaub OpenGeo - http://opengeo.org Expert service straight from the developers. ___ 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] Just another trasformation problem ;)
Perhaps you do two times a transformation. I would think, that in your Vector layer the transformation takes place, so the second part isn't needed. var isoline = new OpenLayers.Layer.Vector(isoline, { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: ../aramus_data/vector/gml/isoipse_2498.gml, //1. projection: epsg2498, format: new OpenLayers.Format.GML() }) }); //2. isoline = OpenLayers.Projection.transform(isoline, epsg2498, map.projection); Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Giuseppe Naponiello Gesendet: Mittwoch, 7. April 2010 12:02 An: users@openlayers.org Betreff: [OpenLayers-Users] Just another trasformation problem ;) Hi all, I ought to display a map with osm layer as base and a gml file of a little part of Armenia. First step was convert my shapefile, with projection epsg:2498, in a gml format (ogr2ogr -f GML ...). Second step was set up my map. Within tag head of my html page, I' ve insert a link to these libraries: - OpenLayers-2.8/OpenLayers.js - http://www.openstreetmap.org/openlayers/OpenStreetMap.js - proj4js.js - proj4s/lib/defs/EPSG2498.js And this is a snippet of my map code [1]. The problem is that my gml is in the north of Africa instead of Armenia. I've tried with qgis and the layer is correctly positioned, so I suppose that the problem is in the code, but I' m not able to detect the bug!!! thanks -beppe - [1] function init() { var epsg2498= new OpenLayers.Projection(EPSG:2498); var epsg900913= new OpenLayers.Projection(EPSG:900913); var epsg4326= new OpenLayers.Projection(EPSG:4326); var bounds = new OpenLayers.Bounds(44.532, 40.144, 45.038, 40.423).transform(epsg4326, epsg900913); map = new OpenLayers.Map (map, { controls:[ new OpenLayers.Control.Navigation(), new OpenLayers.Control.LayerSwitcher({activeColor:#729aa1}), new OpenLayers.Control.MousePosition({div:document.getElementById(coord)}), new OpenLayers.Control.Attribution()], maxExtent: bounds, maxResolution: 156543.0399, numZoomLevels: 5, minZoomLevel: 3, maxZoomLevel: 8, units: 'm', projection: epsg900913, displayProjection: epsg2498 } ); var layerCycleMap = new OpenLayers.Layer.OSM.CycleMap(CycleMap); map.addLayer(layerCycleMap); var layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender(Osmarender); map.addLayer(layerTilesAtHome); var layerMapnik = new OpenLayers.Layer.OSM.Mapnik(Mapnik); map.addLayer(layerMapnik); var isoline = new OpenLayers.Layer.Vector(isoline, { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: ../aramus_data/vector/gml/isoipse_2498.gml, projection: epsg2498, format: new OpenLayers.Format.GML() }) }); isoline = OpenLayers.Projection.transform(isoline, epsg2498, map.projection); map.addLayer(isoline); -- -beppe- ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] please help us test OpenLayers 2.9RC1
Hi, Because in previous versions of OpenLayers the map options parameters center and zoom had not have an effect by the map construction, I have used them to store values, which I use after adding the layers to the map. I think now, it's bad programming to store own values in the options for a contructor. And I like the possibility in 2.9 to build a whole map only with the map construction. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Tim Schaub Gesendet: Samstag, 3. April 2010 07:02 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] please help us test OpenLayers 2.9RC1 bart...@osgis.nl wrote: Hi Arnd, thanks for your report. I've tracked that change down to: http://trac.openlayers.org/changeset/10044 Tim, are you able to comment on Arnd's suggestion (see below)? TIA. http://trac.openlayers.org/ticket/2561 Calling setCenter before adding layers has always failed. I considered it equivalent behavior to require layers in the constructor if a center was provided (and included a test to enforce this). Arnd, while things might be working for you at 2.8, I'd consider it somewhat risky to set map center (and zoom) in the options and then call setCenter again with the same values after adding layers. There are a number of checks that compare the current center/zoom to the values passed to setCenter. If things haven't changed, I think it is reasonable to assume that setCenter should do nothing. Not sure what others think, but I can imagine that at some point we'd forget this case and make it so setCenter had no effect if the passed values were already set on the map. Actually, it would probably be better to do whatever needs to be done in setCenter without failing when there are no layers. Anyway, the ticket is up for review. Tim Best regards, Bart Hi Bart, I use the center parameter of the map options to store the center of my map. After adding my layers to the map I use map.setCenter with this coordinate. With the OpenLayers 2.9 RC1 library, this raise an error maxExtent is null, because if center is set in the options, this.setCenter is called at the end of the initialize-function. But then I have not added any layer to the map. It seems, that this will only work, if the layers parameter is also set in the map options. http://gis.ibbeck.de/OLClient/examples/testMapCenter_29_RC1.html I would suggest, that the setCenter in the init function should only be called, if this.options.layers != null. // add any initial layers if (options options.layers) { this.addLayers(options.layers); } // set center (and optionally zoom) if (options options.layers options.center) { // zoom can be undefined here this.setCenter(options.center, options.zoom); } And I have noticed, that with exchange of the OpenLayers.js from 2.8 to 2.9, also the style.css have to be taken fom 2.9 with the css for the LayerSwitcher control. Otherwise it seems, that 2.9 works like 2.8. A great job from the OpenLayers developers. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Bart van den Eijnden Gesendet: Mittwoch, 31. März 2010 18:01 An: openlayers; users user Betreff: [OpenLayers-Users] please help us test OpenLayers 2.9RC1 This is a reminder to everyone that OpenLayers 2.9 RC1 is out (since last Friday), please help us test this release candidate by upgrading your applications to 2.9RC1 and reporting any issues to us. See also: http://trac.openlayers.org/wiki/Release/2.9/Announce/RC1 Thanks in advance! Best regards, Bart ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users -- Tim Schaub OpenGeo - http://opengeo.org Expert service straight from the developers. ___ 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] please help us test OpenLayers 2.9RC1
Hi Bart, setOpacity for Google layers doesn't work with 2.9. http://gis.ibbeck.de/OLClient/examples/spherical-mercator_29.html In the Google API key I call v=2.93. Wether it's an issue with the other commercial layers, i haven't tested. I don't use them. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Bart van den Eijnden Gesendet: Mittwoch, 31. März 2010 18:01 An: openlayers; users user Betreff: [OpenLayers-Users] please help us test OpenLayers 2.9RC1 This is a reminder to everyone that OpenLayers 2.9 RC1 is out (since last Friday), please help us test this release candidate by upgrading your applications to 2.9RC1 and reporting any issues to us. See also: http://trac.openlayers.org/wiki/Release/2.9/Announce/RC1 Thanks in advance! Best regards, Bart ___ 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] please help us test OpenLayers 2.9RC1
Hi Bart, I use the center parameter of the map options to store the center of my map. After adding my layers to the map I use map.setCenter with this coordinate. With the OpenLayers 2.9 RC1 library, this raise an error maxExtent is null, because if center is set in the options, this.setCenter is called at the end of the initialize-function. But then I have not added any layer to the map. It seems, that this will only work, if the layers parameter is also set in the map options. http://gis.ibbeck.de/OLClient/examples/testMapCenter_29_RC1.html I would suggest, that the setCenter in the init function should only be called, if this.options.layers != null. // add any initial layers if (options options.layers) { this.addLayers(options.layers); } // set center (and optionally zoom) if (options options.layers options.center) { // zoom can be undefined here this.setCenter(options.center, options.zoom); } And I have noticed, that with exchange of the OpenLayers.js from 2.8 to 2.9, also the style.css have to be taken fom 2.9 with the css for the LayerSwitcher control. Otherwise it seems, that 2.9 works like 2.8. A great job from the OpenLayers developers. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Bart van den Eijnden Gesendet: Mittwoch, 31. März 2010 18:01 An: openlayers; users user Betreff: [OpenLayers-Users] please help us test OpenLayers 2.9RC1 This is a reminder to everyone that OpenLayers 2.9 RC1 is out (since last Friday), please help us test this release candidate by upgrading your applications to 2.9RC1 and reporting any issues to us. See also: http://trac.openlayers.org/wiki/Release/2.9/Announce/RC1 Thanks in advance! Best regards, Bart ___ 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] seeking advice to orient image on layer
Hi, ${angle} will expand to aFeature.attributes.angle. Add this attribute to your features, then your styleMap should do the rest. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von David Hine Gesendet: Dienstag, 30. März 2010 15:11 An: users@openlayers.org Betreff: [OpenLayers-Users] seeking advice to orient image on layer Dear OL List I am seeking assistance to orient an arrow image on a layer using the latest wind direction record in a MySQL database. I have a php file printing the value of the direction and I reference it by its location but this is not successful. Your suggestions would be very welcome. Thanks David Hine Snip . vectors = new OpenLayers.Layer.Vector( Wind Direction, { styleMap: new OpenLayers.StyleMap({ default: { externalGraphic: img/windarrow.png, //graphicWidth: 17, graphicHeight: 67, graphicYOffset: -33, rotate: ${angle}, fillOpacity: 1 }, select: { cursor: crosshair, externalGraphic: img/marker.png } }) } ); map.addLayer(vectors); var features = []; var x = 145.85318; var y = -17.53748; var angle = {location: ./txtgen_wind_dir.php} rotate: ${angle}, origin = (x, y), features.push( new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(x, y), {angle: ${angle}, origin: (x, y) } ) ); vectors.addFeatures(features); snip . ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Feature label with leading zero is being trimmed
Hi, Look here http://openlayers.org/pipermail/users/2009-August/013462.html http://trac.openlayers.org/ticket/2252 Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Cliang Gesendet: Donnerstag, 25. März 2010 06:30 An: users@openlayers.org Betreff: [OpenLayers-Users] Feature label with leading zero is being trimmed I have some features of zip codes with labels with leading zeros that are being cut off when the text is being drawn. I've tracked it down to the OpenLayers.Style.createLiteral function where it does not consider the value as IsNaN and parses it as a float. Is this working as designed? -- View this message in context: http://n2.nabble.com/Feature-label-with-leading-zero-is-being-trimmed-tp4795 905p4795905.html 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] Set a layer visibility with a javascript function
Hello, that should it be var flag=true|false yourLayer.setVisibility(flag); Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Robert Hicks Gesendet: Montag, 22. März 2010 19:14 An: users@openlayers.org Betreff: [OpenLayers-Users] Set a layer visibility with a javascript function Hey all, is there a stored procedure in OpenLayers that lets you turn on and off a layer (just like you can in the Layer Switcher) that can be called? I saw OpenLayers.Layer.display(); which didn't seem to do anything and I was wondering if that is the right function I should be calling. Thanks! -- web http://www.hyxspace.com aim hyx1138 ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] getting Feature Info data directly from .shpfiles
Hi, LAYER NAME 'TEZG' TYPE POLYGON STATUS ON DATA 'a.shp' ... TEMPLATE 'template.html' METADATA ... 'wms_include_items' 'all' ... END END I'm not sure, if I understand your question. With info_format = text/plain you get all attributes of the shape as plain text. With text/html you can decide, what attributes and in which form you deliver a request. Perhaps gml as response is also possible. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von sunny74 Gesendet: Samstag, 20. März 2010 11:43 An: users@openlayers.org Betreff: [OpenLayers-Users] getting Feature Info data directly from .shpfiles Dear friends, I want to implement Feature Info Popup using Openlayers.But since there is no free WMS from where I can get data in the form of text I need to get the data from shape(.shp) files. Previously I was doing it by putting the .shp into DB. Now I need to get the data directly from .shp files.Is it possible to get the data directly from .shp using mapserver. If yes how to get it? Pls reply soon. Thanks. -- View this message in context: http://n2.nabble.com/getting-Feature-Info-data-directly-from-shp-files-tp476 7879p4767879.html 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] Vector text labels with offsets?
Hi, see http://trac.openlayers.org/changeset/9755 http://openlayers.org/dev/examples/vector-features-with-text.html Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Stephen Woodbridge Gesendet: Freitag, 12. März 2010 23:31 An: openlayers user list Betreff: [OpenLayers-Users] Vector text labels with offsets? Hi, Is it possible to give and offset to the text label position? I have point features display by 25x25 pixel image. and I would like to place a text label centered and above each image. I have tried: styleMap = new OpenLayers.StyleMap({ default: new OpenLayers.Style({ label: ${name}, fontColor: black, fontSize: 10px, fontFamily: Arial, labelAlign: cb, fillOpacity: 1, pointRadius: 15 }), ... and playing with labelAlign, but the label still passes through the image. It would be really great if you could do something like: labelOffset: new OpenLayers.Pixel(0,-10), and have it shift the label position in Y by -10 pixels. I looked through the code, but I'm not seeing a way to do that. Does anyone else think this would be useful? Is there a patch for this by any chance? -Steve ___ 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] Labels on WFS layers
Perhaps there is something wrong with the way you declare your style for your layer. The below code works on WFS layer. ADMIN_NAME is an attribute of the wfs. var styleMapLabelDS; function set_styleMapLabelDS() { var template = { strokeColor: #FF, strokeOpacity: 1, strokeWidth: 3, fillColor: #00AAFF, fillOpacity: 1, pointRadius: 5, pointerEvents: visiblePainted, label : ${ADMIN_NAME}, labelOffsetX: 10, labelOffsetY: -10, fontColor: red, fontSize: 10, fontFamily: Arial, fontWeight: bold, labelAlign: lt }; var templateB = { strokeColor: #FF00FF, strokeOpacity: 1, strokeWidth: 3, fillColor: #AA00FF, fillOpacity: 1, pointRadius: 5, pointerEvents: visiblePainted, label : ${ADMIN_NAME}, labelOffsetX: 10, labelOffsetY: -10, fontColor: blue, fontSize: 10, fontFamily: Arial, fontWeight: bold, labelAlign: lt }; styleMapLabelDS = new OpenLayers.StyleMap( { default : new OpenLayers.Style(template), select : new OpenLayers.Style(templateB) } ); } set_styleMapLabelDS(); myWFS[styleMap]=styleMapLabelDS; myWFS.redraw(); http://gis.ibbeck.de/OLClient/OLClient.asp?WMC=./data/WMC/wfs_germany_reproj ect_and_labels.wmc.xml Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Luís de Sousa Gesendet: Montag, 8. März 2010 21:16 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Labels on WFS layers Hello again, I can't get this to work in any way, no errors at runtime but no labels either. The label properties is listed in the vector style specification, among other that work perfectly: http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLaye rs/Feature/Vector-js.html It can also be found a great deal of discussion on this list and elsewhere about the development of this functionality, mostly from 2008. Has vector labeling been fully implemented in OpenLayers-2.8? If not, what other ways are there to get this to work? Thank you, Luís 2010/3/5 Luís de Sousa luis.a.de.so...@gmail.com Hello everyone, I'm trying to set labels on a point layer using code like this: wfs2.style = OpenLayers.Util.applyDefaults( { strokeColor: #008000, fillColor: #00, strokeWidth: 2.0, label: ${someAtribute}, fontColor: #FF } I don't get any errors at runtime, but no label appears. What am I missing? Thanks, Luís ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Openlayers not displaying mapserver wms
Hi, Your projection doesn't match with your extent. EXTENT 7265.775000 -2751868.817315 100851.225000 -2701372.182685 seems not to be EPSG:4326, what use OpenLayers as default. map.addLayers(wms) should be map.addLayers([wms]) or map.addLayer(wms); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von simi Gesendet: Sonntag, 7. März 2010 17:54 An: users@openlayers.org Betreff: [OpenLayers-Users] Openlayers not displaying mapserver wms Hi, i am newbie to openlayers and i am encountering a problem in displaying a layer served from a mapserver wms. I have checked my mapfile for wms getcapabilities and its generates the xml document indicating that it is ok. The mapfile was generated from QGIS and then edited. I am able to view a wms layer from my mapfile in QGIS and directly via mapserver CGI. However, i fail in Openlayers. Here is the mapfile and the openlayers file contents respectively, The mapfile # Map file created from QGIS project file C:/Documents and Settings/Kentlafetse/Desktop/Adverts.qgs # Edit this file to customize for your map interface # (Created with PyQgis MapServer Export plugin) MAP NAME Adverts # Map image size SIZE 400 400 UNITS meters EXTENT 7265.775000 -2751868.817315 100851.225000 -2701372.182685 PROJECTION 'proj=longlat' 'ellps=WGS84' 'datum=WGS84' 'no_defs' END # Background color for the map canvas -- change as desired IMAGECOLOR 255 255 255 IMAGEQUALITY 95 IMAGETYPE agg OUTPUTFORMAT NAME agg DRIVER AGG/PNG IMAGEMODE RGB END # Web interface definition. Only the template parameter # is required to display a map. See MapServer documentation WEB # Set IMAGEPATH to the path where MapServer should # write its output. IMAGEPATH '/tmp/' # Set IMAGEURL to the url that points to IMAGEPATH # as defined in your web server configuration IMAGEURL '/tmp/' # WMS server settings METADATA 'ows_title' 'Adverts' 'ows_onlineresource' 'http://localhost/cgi-bin/mapserv.exe?map=Adverts.map;' 'ows_srs' 'EPSG:4326' 'wms_feature_info_mime_type' text/html END #Scale range at which web interface will operate # Template and header/footer settings # Only the template parameter is required to display a map. See MapServer documentation TEMPLATE 'foo.html' END LAYER NAME 'adverts_pnts' TYPE POINT DUMP true TEMPLATE 'foo.html' EXTENT 7265.775000 -2751868.817315 100851.225000 -2701372.182685 CONNECTIONTYPE postgis CONNECTION user='#' password='***' dbname='postgis' port='5432' host='localhost' DATA the_geom FROM adverts_pnts METADATA 'ows_title' 'adverts_pnts' 'wms_feature_info_mime_type' text/html END STATUS DEFAULT TRANSPARENCY 100 PROJECTION 'proj=longlat' 'ellps=WGS84' 'datum=WGS84' 'no_defs' END CLASS NAME 'adverts_pnts' STYLE SIZE 10 OUTLINECOLOR 0 0 0 COLOR 255 255 255 END END END END The Openlayers html file html headtitleOpenLayers project/title script src=http://localhost/OpenLayers.js;/script script type=text/javascript function init() { var map = new OpenLayers.Map('map'); var wms = new OpenLayers.Layer.WMS( adverts_pnts, http://localhost/cgi-bin/mapserv.exe?map=Adverts.map;, {layers: adverts_pnts} ); map.addLayers(wms); map.zoomToMaxExtent(); } /script /head body onload=init(); h2OpenLayers Example/h2 div id='map'/div /body /html please help. i have tried a number of modifications to both the mapfile and the openlayers html file without sucess. -- View this message in context: http://n2.nabble.com/Openlayers-not-displaying-mapserver-wms-tp4690994p46909 94.html 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] Make vector layer from JSON
Hello Robert, I don't know ArcGis Server, but I would look, if you can get your data in gml or kml. Otherwise you have to write your own parser. Arnd _ Von: Robert Sanson [mailto:sans...@asurequality.com] Gesendet: Sonntag, 7. März 2010 21:09 An: 'Hugo'; Arnd Wippermann Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] Make vector layer from JSON I am wrestling with a similar problem. I am trying to read in data coming from an ArcGIS Server in JSON format. Unfortunately, ArcGIS Server doesn't serve GeoJSON. Here is a sample of what the data looks like: { results : [ { layerId : 0, layerName : Main_Gates, displayFieldName : road_name, foundFieldName : farm_id, value : AS00136, attributes : { point_location_id : 232495, farm_id : AS00136, rapid_no : 104, road_name : Winslow Willowby Rd, locality : Null, x_nztm : 1492934.61, y_nztm : 5131545.29, Shape : Point }, geometryType : esriGeometryPoint, geometry : { x : 1492934.61, y : 5131545.29, spatialReference : { wkid : 2193 } } } ] } Any ideas how to get OL to read this into a Vector layer? Thanks, Robert Arnd Wippermann arnd.wipperm...@web.de 7/03/2010 10:43 a.m. Hi, i would think, that you have to use geojson instead of json, to get the geometry for the features. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Hugo Gesendet: Samstag, 6. März 2010 19:14 An: openlayers Betreff: [OpenLayers-Users] Make vector layer from JSON Hello all, I'm trying to create a vector layer based on a php query (which includes the_geom) encoded in JSON. Until the moment i haven't been able to achieve this. Following, is the relevant part of the code: var connect = new Ext.data.Connection(); connect.request({ url: 'mfbase/geoquery.php', params: { species: species, datai: datai, dataf: dataf }, success: function(response){ var resp = response.responseText; var json = new OpenLayers.Format.JSON(); var data = json.read(resp); //console.log(data[0].the_geom); var querylayer1 = new OpenLayers.Layer.Vector( 'Query1', { isBaseLayer: false, projection: wgs, geometryName: 'the_geom', } ); querylayer1.addFeatures(data); map.addLayer(querylayer1); } }) Any suggestions are more than welcomed :) Thanks to you all! Cheers, -- Hugo Martins FMV-UTL CIISA-Epidemiologia e Saúde Pública Veterinária Av. da Universidade Técnica 1300-477 Lisboa N 38°42'49.54, W 9°11'43.42 Click here https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg== to report this email as spam. -- The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message. -- This message has been scanned for malware by SurfControl plc. http://www.surfcontrol.com/ www.surfcontrol.com ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Make vector layer from JSON
Hi, i would think, that you have to use geojson instead of json, to get the geometry for the features. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Hugo Gesendet: Samstag, 6. März 2010 19:14 An: openlayers Betreff: [OpenLayers-Users] Make vector layer from JSON Hello all, I'm trying to create a vector layer based on a php query (which includes the_geom) encoded in JSON. Until the moment i haven't been able to achieve this. Following, is the relevant part of the code: var connect = new Ext.data.Connection(); connect.request({ url: 'mfbase/geoquery.php', params: { species: species, datai: datai, dataf: dataf }, success: function(response){ var resp = response.responseText; var json = new OpenLayers.Format.JSON(); var data = json.read(resp); //console.log(data[0].the_geom); var querylayer1 = new OpenLayers.Layer.Vector( 'Query1', { isBaseLayer: false, projection: wgs, geometryName: 'the_geom', } ); querylayer1.addFeatures(data); map.addLayer(querylayer1); } }) Any suggestions are more than welcomed :) Thanks to you all! Cheers, -- Hugo Martins FMV-UTL CIISA-Epidemiologia e Saúde Pública Veterinária Av. da Universidade Técnica 1300-477 Lisboa N 38°42'49.54, W 9°11'43.42 ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] WMS from ArcGIS Server on top of google maps -Parameter 'srs' contains unacceptable value.
Hi Philipp, the function OpenLayers.Layer.WMS.prototype.getFullRequestString have to be load after the OpenLayers script(s) are loaded (the function overwrites the original function from OpenLayers) and before the declaration of the Layer.WMS. It should be something in this way: ... script src=../lib/OpenLayers.js/script script type=text/javascript OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams,altUrl) { try{ var projectionCode=typeof this.options.projection == 'undefined' ? this.map.getProjection() : this.options.projection; }catch(err){ var projectionCode=this.map.getProjection(); } this.params.SRS = projectionCode==none ? null : projectionCode; return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments); } function init() { var boundaries = new OpenLayers.Layer.WMS( Boundaries, http://ag-0988a/ArcGIS/services/StateBoundaries_WGS84_WM_102113/MapServer/WMSServer?;, //parameter { layers: '0', format: 'image/png', transparent: true }, //options { visibility: true, isBaseLayer: false, singleTile: false, projection : 'EPSG:102113' } ); ... } /script /head body onload=init() ... Good Luck Arnd _ Von: Philipp Gaertner [mailto:gaertne...@gmail.com] Gesendet: Mittwoch, 3. März 2010 01:56 An: Arnd Wippermann Betreff: Re: [OpenLayers-Users] WMS from ArcGIS Server on top of google maps -Parameter 'srs' contains unacceptable value. Hi Arnd, thank you for the response, unfortunately I don't know where to use or replace your code snippet in my .js file. The WMS I work on has the following parameters. var boundaries = new OpenLayers.Layer.WMS( Boundaries, http://ag-0988a/ArcGIS/services/StateBoundaries_WGS84_WM_102113/MapServer/WMSServer?;, {layers: '0', //projection: 'EPSG:102113', format: 'image/png', transparent: true },{ visibility: true, isBaseLayer: false, singleTile: false } ); I added the projection: 'EPSG:102113' but it didn't seem to change anything. Where would go your code? Would it replace the the whole section of var boundaries or would it be an additional part? I'm a little lost. Regards, Philipp On 3 March 2010 05:54, Arnd Wippermann arnd.wipperm...@web.de wrote: Hi, i use this code to be able to pass a different projection code to the getFullRequestString of the Layer.WMS. If in the options for the Layer.WMS projection is set, then it will be used instead of the map.projection. OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams,altUrl) { try{ var projectionCode=typeof this.options.projection == 'undefined' ? this.map.getProjection() : this.options.projection; }catch(err){ var projectionCode=this.map.getProjection(); } this.params.SRS = projectionCode==none ? null : projectionCode; return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments); } Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Philipp Gaertner Gesendet: Dienstag, 2. März 2010 03:05 An: users@openlayers.org Betreff: [OpenLayers-Users] WMS from ArcGIS Server on top of google maps -Parameter 'srs' contains unacceptable value. Hi list, I have a layer of the states and territories of Australia and would like to overlay it on google maps using openlayers. The Australia layer is a WMS which is on my ArcGIS Server. I use EPSG:102113 which represents in the ESRI world the WGS_1984_Web_Mercator. The WMS has following capabilities: Layer queryable=1 Name0/Name TitleStateBoundaries_1/Title AbstractStateBoundaries_1/Abstract CRSCRS:84/CRS CRSEPSG:4326/CRS CRSEPSG:102113/CRS − EX_GeographicBoundingBox westBoundLongitude0.000870/westBoundLongitude eastBoundLongitude0.001429/eastBoundLongitude southBoundLatitude-0.000393/southBoundLatitude northBoundLatitude-0.82/northBoundLatitude /EX_GeographicBoundingBox BoundingBox CRS=CRS:84 minx=0.000870 miny=-0.000393 maxx=0.001429 maxy=-0.82/ BoundingBox CRS=EPSG:4326 minx=-0.000393 miny=0.000870 maxx=-0.82 maxy=0.001429/ BoundingBox CRS=EPSG:102113 minx=96.816766 miny=-43.740510 maxx=159.109219 maxy=-9.142176/ the openlayer setup looks like this var geographic = new OpenLayers.Projection(EPSG:4326); var mercator = new OpenLayers.Projection(EPSG:900913); //aka EPSG:3785 var gda94 = new OpenLayers.Projection(EPSG:4283); var world = new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34) var mapOptions = { projection: mercator, displayProjection: geographic, //for Mouse Position maxExtent: world, restrictedExtent: world, units: 'm', numZoomLevels: 22, maxResolution: 156543.0339, controls: [new OpenLayers.Control.PanZoomBar(), new
Re: [OpenLayers-Users] WMS from ArcGIS Server on top of google maps -Parameter 'srs' contains unacceptable value.
Hi, i use this code to be able to pass a different projection code to the getFullRequestString of the Layer.WMS. If in the options for the Layer.WMS projection is set, then it will be used instead of the map.projection. OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams,altUrl) { try{ var projectionCode=typeof this.options.projection == 'undefined' ? this.map.getProjection() : this.options.projection; }catch(err){ var projectionCode=this.map.getProjection(); } this.params.SRS = projectionCode==none ? null : projectionCode; return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments); } Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Philipp Gaertner Gesendet: Dienstag, 2. März 2010 03:05 An: users@openlayers.org Betreff: [OpenLayers-Users] WMS from ArcGIS Server on top of google maps -Parameter 'srs' contains unacceptable value. Hi list, I have a layer of the states and territories of Australia and would like to overlay it on google maps using openlayers. The Australia layer is a WMS which is on my ArcGIS Server. I use EPSG:102113 which represents in the ESRI world the WGS_1984_Web_Mercator. The WMS has following capabilities: Layer queryable=1 Name0/Name TitleStateBoundaries_1/Title AbstractStateBoundaries_1/Abstract CRSCRS:84/CRS CRSEPSG:4326/CRS CRSEPSG:102113/CRS − EX_GeographicBoundingBox westBoundLongitude0.000870/westBoundLongitude eastBoundLongitude0.001429/eastBoundLongitude southBoundLatitude-0.000393/southBoundLatitude northBoundLatitude-0.82/northBoundLatitude /EX_GeographicBoundingBox BoundingBox CRS=CRS:84 minx=0.000870 miny=-0.000393 maxx=0.001429 maxy=-0.82/ BoundingBox CRS=EPSG:4326 minx=-0.000393 miny=0.000870 maxx=-0.82 maxy=0.001429/ BoundingBox CRS=EPSG:102113 minx=96.816766 miny=-43.740510 maxx=159.109219 maxy=-9.142176/ the openlayer setup looks like this var geographic = new OpenLayers.Projection(EPSG:4326); var mercator = new OpenLayers.Projection(EPSG:900913); //aka EPSG:3785 var gda94 = new OpenLayers.Projection(EPSG:4283); var world = new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34) var mapOptions = { projection: mercator, displayProjection: geographic, //for Mouse Position maxExtent: world, restrictedExtent: world, units: 'm', numZoomLevels: 22, maxResolution: 156543.0339, controls: [new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.KeyboardDefaults()] }; var map = new OpenLayers.Map( 'map', mapOptions ); //Google Physical var gphy = new OpenLayers.Layer.Google(Google Physical, {type: G_PHYSICAL_MAP, sphericalMercator: true, isBaseLayer: true, numZoomLevels: 22, maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34) }); map.addLayer(gphy); var boundaries = new OpenLayers.Layer.WMS( Boundaries, http://ag-0988a/ArcGIS/services/StateBoundaries_WGS84_WM_102113/MapServer/WMSServer?;, {layers: '0',//srs: 'EPSG:102113', format: 'image/png', transparent: true },{ visibility: true, isBaseLayer: false, singleTile: false } ); map.addLayer(boundaries); The error message is Parameter 'srs' contains unacceptable value. I know that the google layer is defined with EPSG:900913 and my WMS has EPSG:102113, but I can't set the EPSG to 900913 because ESRI doesn't support it. How do I go from here, what are my options? I need to use Google as baselayer but can reproject all WMS as I like. Any suggestions are more than welcome. Regards, Philipp ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Select style for point features
Hi You can try to add an elseFilter to your style var lookupSens = { aller: {strokeDashstyle: solid}, retour: {strokeDashstyle: dash} }; styles.addUniqueValueRules(default, sens, lookupSens); var rules = [new OpenLayers.Rule({ symbolizer: {fillOpacity:0, strokeOpacity:1, strokeColor:#FF, strokeWidth: 4, pointRadius:10}, elseFilter: true })]; styles.styles[default].addRules(rules); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Olivier THIERRY Gesendet: Dienstag, 2. März 2010 15:06 An: Alexandre Dube; users@openlayers.org Betreff: Re: [OpenLayers-Users] Select style for point features 2010/3/2 Alexandre Dube ad...@mapgears.com: Olivier, The way to defined your default symbolizer with the applyDefaults method is correct, but you didn't do so with your select symbolizer. In order for a point to be drawn, it needs more than these two properties (like pointRadius for example). Try using applyDefaults there too. Then, remove the style from your point features too. In order for a feature to change style automatically when selected, it has to be done with the StyleMap or manually. If you set a symbolizer (style) directly to your feature, that's the only style it's going to have regardless of any stylemap defined. // are you saying that with this, points don't show at all when unselected ? Normally, it shouldn't. var feature = new OpenLayers.Feature.Vector(point); Kind regards, Alexandre Olivier THIERRY wrote: Hi, I have to draw routes on a map. I need points for the steps of the route and lines between the steps. I could make it work, but now I need to highlight these lines and points. Actually I need to change the colour of either lines or points when they are selected in a list outside the map or clicked on the map. To do this, I added a SelectFeature control to the layer containing the routes. I could make it work for lines by adding the following style map to the routes layer : var symbolizer = OpenLayers.Util.applyDefaults( { fillColor: #FF , strokeColor: #2A2AFF , strokeWidth: 2 } , OpenLayers.Feature.Vector.style[default]); var styles = new OpenLayers.StyleMap({ default: symbolizer, select: { fillColor: red , strokeColor: red } }); But I can't make it work with points. I create the points this way : var point = new OpenLayers.Geometry.Point(lon, lat, 0); point.transform(map.displayProjection, map.projection); var styleSite = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); styleSite.strokeColor = blue; styleSite.fillColor = blue; styleSite.pointRadius = 3; styleSite.strokeLinecap = square; var feature = new OpenLayers.Feature.Vector(point, null, styleSite); The points display OK, but colour doesn't change when I select the point. I think my problem deals with style, but I can't find what is wrong. Note I had to set the style for point vector. If I don't do this, it doesn't diplay. I find this strange since I don't need to do this for line feature ! Any idea what I did wrong ? Regards, Olivier ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users -- Alexandre Dubé Mapgears www.mapgears.com For what I understood, when you define a default style, other styles extend this default style. So when defining a select style for example, you just have to set the style attributes that you want to be different from default style. And it works very well indeed. I read this there : http://trac.openlayers.org/wiki/Styles#UsingPropertyStyles Anyway, I just found where my problem comes from. Actually I use rules with my style map, this way : var lookupSens = { aller: {strokeDashstyle: solid}, retour: {strokeDashstyle: dash} }; styles.addUniqueValueRules(default, sens, lookupSens); This rule helps me to have a different style for journey and return journey. But since it has no sense for points (just for lines), I don't have the sens property on the point I add to the layer, and it looks like it causes some problems ! If I remove this rule, the points print OK. But I really need this rule, so I can't remove it. Do you know if there is a way to tell OpenLayers to apply the rule only for some elements of the layer ? Or another workaround for this ? Regards, Olivier ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users ___ Users mailing list Users@openlayers.org
Re: [OpenLayers-Users] Beginner issue
Hi, 1. you have to reproject your vector data (with EPSG:900913 and EPSG:4326 it is possible without proj4js) 2. you have to add your vector layer to your map 3. you have to center the map //! set projections for transformation your vectors (before wkt_f.read) wkt_f.internalProjection = new OpenLayers.Projection(EPSG:900913); wkt_f.externalProjection = new OpenLayers.Projection(EPSG:4326); //! add vector layer index_map.addLayer(hood_vector); //! set MouseDefaults for navigation index_map.addControl(new OpenLayers.Control.MouseDefaults()); //! center map index_map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); that should show your map. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von ethio info Gesendet: Dienstag, 23. Februar 2010 21:51 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Beginner issue Sorry to keep pestering you, but does anyone know what I am doing wrong? if anyone can make this work, and tell me how to fix it, I would be very grateful. thanks On Sun, Feb 21, 2010 at 3:23 PM, ethio info info.et...@gmail.com wrote: I understand what you are saying but my previous request was rejected because it was over the size limit. Here it is: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head meta http-equiv=Content-Type content=text/html;charset=utf-8 / meta http-equiv=X-UA-Compatible content=IE=EmulateIE7 !-- GLOBAL JAVASCRIPT -- script src=http://www.latimes.com/includes/projects/js/menu.js; type=text/javascript/script script src='http://maps.google.com/maps?file=api http://maps.google.com/maps?file=apiv=2key=ABQIjpkAC9ePGem0lIq5XcMiuh R_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ amp;v=2amp;key=ABQIjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQ Ud_beF8dtzKET_EteAjPdGDwqpQ'/script script src=http://www.openlayers.org/api/OpenLayers.js;/script script type=text/javascript var index_map; var wkt_f = new OpenLayers.Format.WKT(); function load_index_map() { //var max_extent = new OpenLayers.Bounds(860986,-4383204,5870363,3600489); //working but no woreda's var max_extent = new OpenLayers.Bounds(660986,-4383204,4870363,3600489);//not working var options = { projection: new OpenLayers.Projection(EPSG:900913), units: m, maxResolution: 156543.0339, maxExtent: max_extent, minZoomLevel: 10, maxZoomLevel: 10, controls: [] }; // Firing up the map object index_map = new OpenLayers.Map('index-map', options); // Google terrain map var gphy = new OpenLayers.Layer.Google(Google Terrain, { type: G_PHYSICAL_MAP, sphericalMercator: true }); index_map.addLayer(gphy); index_map.addControl(new OpenLayers.Control.LayerSwitcher()); index_map.addControl(new OpenLayers.Control.MousePosition()); // Setting the feature style var template = { strokeColor : '#2262CC', strokeWidth: 2, strokeOpacity: 0.9, fillColor : '#2262CC', fillOpacity : 0.3, pointRadius : 3, strokeLinecap: round }; // Assigning the feature style var style = new OpenLayers.Style(template); var style_map = new OpenLayers.StyleMap({ 'default': style, 'select': { fillColor: '#2262CC', fillOpacity: 0.75 } }); var hood_vector = new OpenLayers.Layer.Vector(Wereda); ar hood_polygon_371 = wkt_f.read('MULTIPOLYGON (((39.2968382026 8.8274792477, 39.31350397758.748488041, 39.30163246668.742095689, 39.30368715128.7357033371, 39.2698990058.6920983646, 39.2315448931 8.6608214995, 39.22652233088.645982111, 39.24798236968.6108241751, 39.22492424288.589135838, 39.22218466348.5756662392, 39.2306316999 8.5656211146, 39.2571143018.5601419558, 39.25026535258.5464440587, 39.21396592518.5220161421, 39.17447032188.4606039034, 39.0858905871 8.385037171, 39.07584546268.3950822956, 39.03817624558.399419963, 39.03634985938.5128842107, 39.06717012788.5432478827, 39.0655720398 8.5562608849, 39.08726037698.5968979797, 39.08748867518.6528310595, 39.104154458.6825098366, 39.09821869458.6939247509, 39.1075789242 8.7101339291, 39.16031582818.742095689, 39.18405884988.7877553461, 39.17675330468.8019098398, 39.20140951948.8146945437, 39.2057471869 8.8039645243, 39.21990168058.8012249449, 39.24615598338.8299905288, 39.27104049648.8224566854, 39.29683820268.8274792477 )))'); hood_polygon_371.data = {'slug':' 371', 'name': '371'}; var hood_polygon_260 = wkt_f.read('MULTIPOLYGON (((39.506872625 9.3384108099, 39.52901755879.3116999105, 39.5100688019.2838475198, 39.5228535059.2751721849, 39.49637090399.2509725667, 39.5105253976 9.2502876718, 39.5089273096
Re: [OpenLayers-Users] OL + database
Hi, Try this var theObj = { type:Feature, id:OpenLayers.Feature.Vector_107, properties: {icon:icon_1.jpg}, geometry: {type:Point, coordinates:[26.015625, 18.6328125]}, crs: {type:OGC, properties: {urn:urn:ogc:def:crs:OGC:1.3:CRS84} } }; alert(theObj[properties][icon] + \n + theObj[geometry][type]); or alert(theObj.properties.icon + \n + theObj.geometry.type); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von ngreen Gesendet: Samstag, 20. Februar 2010 12:24 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] OL + database It's always good to know what options are available, but in this case GeoServer etc. definitely qualify as an unnecessary complication. OL is sufficient for this job. What I needed was this: http://openlayers.org/dev/examples/vector-formats.html and this: http://www.w3schools.com/php/php_ajax_database.asp I've trimmed the code from the vector-formats example down to just geojson. That works nicely. The simple ajax script lets me interact with the database as needed and it's quite easy to convert the geojson string into php variables and vice versa. The only thing I haven't figured out is how to access specific parts of the geojson string within OL. Eg. if you copy this into the vector-formats example above: {type:Feature, id:OpenLayers.Feature.Vector_107, properties:{icon:icon_1.jpg}, geometry:{type:Point, coordinates:[26.015625, 18.6328125]}, crs:{type:OGC, properties:{urn:urn:ogc:def:crs:OGC:1.3:CRS84}}} You can see that everything gets pulled into OL by the script. On my own page I can return the id and coordinates via feature.id and feature.geometry.x /y, but so far have had no luck trying to access other parts, eg. properties:{icon:icon_1.jpg}. Any geojson'ers know how to get at these? -- View this message in context: http://n2.nabble.com/OL-database-tp4588879p4602384.html 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] Trying to draw a box on a map, and get the coordinates back.
Hi, function findcoords (event) { var vertices = event.feature.geometry.getVertices(); var brackets = vertices.toString().replace(/POINT\(/g,[).replace(/\),/g,],).replace(/ /g,,).replace(/\)/,]); alert('ID:' + brackets); } This is one way to get what you want. If there is a simple way to get the coordinates in this form from a geojson string or object, i don't know. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Jtrsmith Gesendet: Donnerstag, 11. Februar 2010 18:16 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Trying to draw a box on a map,and get the coordinates back. Thanks again Arnd. I was able to get the coordinates back, however they are formatted differently. i get a csv list i.e. 50, 0, 50, 50, 0, 50, 0, 0, 50, 0 instead of brackets i.e. [50, 0], [50, 50], [0, 50], [0, 0], [50, 0] i am using the value to get the coordinates of a polygon added to my map so i can save it to a database and dynamically create a json file for my openlayers map, it looks like the only issue is the brackets, it crashes without them and i cannot fiigure out how to get them. should i save them to the database the way they are and try to add the brackets in my php code when creating the json? -- View this message in context: http://n2.nabble.com/Trying-to-draw-a-box-on-a-map-and-get-the-coordinates-b ack-tp4251287p4556020.html 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] Maxextent, resolution and zoom issue
Hi, that's from an OS OpenSpace map for the whole UK: osMap.getMaxResolution() : 2500 osMap.getExtent() for zoomLevel 0 (whole UK) : left-bottom=(-611483,-135514) right-top=(1888517,1364486) osMap.resolutions : [2500,1000,500,200,100,50,25,10,5,2,1] The example you refer to, seems to display only a small area of the UK, perhaps Southampton. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von jbloc1...@googlemail.com Gesendet: Dienstag, 2. Februar 2010 18:52 An: users@openlayers.org Betreff: [OpenLayers-Users] Maxextent, resolution and zoom issue Hi, i have been struggling with this problem for some time now. Basically I am trying to display two layers. 50k and 250K of the uk. Can anyone explain further what resolution, maxextent and zoom values I should have to display these layers correctly? My layers cover the whole of the UK. I have tried quite a few different values however I cannot make sense of how this works. The example I am referring to is below. Thanks for any help in advance Create an options object that holds a limited set of map resolutions and a maximum bounding extent to show the map. A new OS OpenSpace map object is created by passing in our 'map' HTML div element id and the map options. 1. var options = {resolutions: [10, 5], 2.maxExtent: new OpenSpace.MapBounds(40, 10, 45, 15) ); 3. osMap = new OpenSpace.Map('map', options); We now set the centre of the map and set the initial map zoom level to 1 (corresponding to the second defined layer in the resolutions array). 1. osMap osMap.setCenter(new OpenSpace.MapPoint(40,10), 1); Cheers ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] WMS error with openlayers
Hi, Question 2 as the message said, because you use a parameter layer instead of layers Change layer:'urbanareas' - layers:'urbanareas', then your WMS should work. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von subhajeet sur Gesendet: Sonntag, 31. Januar 2010 10:40 An: users@openlayers.org Betreff: [OpenLayers-Users] WMS error with openlayers Dear all, I'm new to openlayers and mapserver. I'm trying to run a particular mapfile via mapserver. I've encountered the following errors: 1. On using OpenLayers.Layers.MapServer: Base layer isn't gettting displayed when the overlays are selected. 2. On using OpenLayers.Layers.WMS: Following error message is generated inspite of defining METADATA msWMSLoadGetMapParams(): WMS server error. Invalid layer(s) given in the LAYERS parameter. Please find the attached mapfile and the html template. Could anyone please help me out. Thanks in advance. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] How to create a map on the fly, by clicking a button
Hi, Your parameter is a string and not an object var visor = new MyViewer('map'); Perhaps this will work: function MyViewer(div){ this.container = document.getElementById(div); -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von David Alda Fernandez de Lezea Gesendet: Dienstag, 26. Januar 2010 17:23 An: openlayers users Betreff: [OpenLayers-Users] How to create a map on the fly,by clicking a button Hello list, I'm trying to make a Gis Web Viewer and I need to generate a Map, after clicking a link/button from one div, into another div. I've created an Object class like this function MyViewer(){ var map; var container; this.MyViewer= MyViewer; function MyViewer(div){ this.container = div; this.map = new OpenLayers.Map( div, {projection: new OpenLayers.Projection(EPSG:23030), units: 'm', maxExtent: new OpenLayers.Bounds(46, 471, 61, 482), maxResolution: 292.96875}); ...layer definition... map.zoomToMaxExtent(); document.getElementById(this.container).style.visibility = visible; } } And my html looks like this: #map { border-style: solid; border-width: 1px; margin: 0px auto; width: 650px; height: 450px; position: relative; float: right; overflow: auto; visibility: hidden; } body div id=cabecera h2header/h2 /div div id=body script type=text/javascript function init(){ var visor = new MyViewer('map'); } /script a href=# onclick=init();ShowMap/abr /div div id=mapmap... /div /body ... But I get an error on line document.getElementById(this.container).style.visibility = visible; Saying: Uncaught TypeError: Cannot read property 'style' of null Is it possible to do what I'm trying to do ?? Thanks. Un saludo, ·· David Alda Fernández de Lezea Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad IKT Granja Modelo s/n · 01192 · Arkaute (Araba) ·· Tlfnos.: 945-00-32-95 Fax: 945-00.32.90 ·· email: da...@ikt.esweb: www.ikt.es ·· ___ 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] Select geojson feature from hyperlink
Hi, onclick=selectCtrl.select('testspot') Locate Testspot You have to deliver a feature object instead of a string of an attribute value. selectCtrl.select(vector_layer.features[0]) Arnd ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] help (add gml files,try)
Hi Ricardo, firebug shows: bounds is null zoomToExtent()(null, undefined)Map.js (Linie 2075) zoomToMaxExtent()(Object EVENT_TYPES=[24] options=Object style=Object)Map.js (Linie 2119) initGis()map3.html (Linie 125) onload()map3.html (Linie 1) [Break on this error] var center = bounds.getCenterLonLat(); your layer lindero is not loaded, when you want to zoom. Try instead map.setCenter(new OpenLayers.LonLat(x, y), 11); It could also be setting a baselayer from an GML layer, that not loaded yet leads to an error. I use always a faked layer to get a baselayer for my map and add my other layers as overlays. var fakeLayer = new OpenLayers.Layer( fake, ); fakeLayer.isBaseLayer=true; map.addLayer(fakeLayer); goof luck Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Ricardo Rodríguez Gesendet: Freitag, 22. Januar 2010 23:51 An: users@openlayers.org Betreff: [OpenLayers-Users] help (add gml files,try) hello all, I still have the same problem are not my files, I've done everything that I have recommended (to create a base layer, permissions on my server, check the coordinate system files) all the above is fine, but I still have the problem I have changed some things at this site is the link: http://obtra.univalle.edu.co/accewps/map3.html I recommend doing, I'm tired thanks for your answers Ricardo Rodríguez Ing. Topográfico Univalle ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Points and Popup shifted on a Google background
Hi, instead of your declaration gbase = new OpenLayers.Layer.Google( Google Physical, {type: G_PHYSICAL_MAP}, {'sphericalMercator': true} ); you have to use gbase = new OpenLayers.Layer.Google( Google Physical, {type: G_PHYSICAL_MAP, 'sphericalMercator': true} ); then your map is in spericalMercator. Otherwise it seems, that instead of your options for the map, the baselayer projection is taken and that is EPSG:4326. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von julien minet Gesendet: Freitag, 22. Januar 2010 13:57 An: users@openlayers.org Betreff: [OpenLayers-Users] Points and Popup shifted on a Google background Hi again, I've seen that no attachment can be sent to the list. So I've put the code at the end of this mail... - I've have a problem of misplacement of features and popup when adding a vector layer to a OL map with a background Google. I just want ot add some points entered in WGS84 (by OpenLayers.Layer.Vector) to a map with a Google layer as the base layer. I've put my map in spherical Mercator, as well as the google layer and I've transformed my points in EPSG:900913 but I still have a problem! My points are displayed near the exact location, but with a slight shift. When I zoom/zoom over or if I pan in the N-S direction, points are changing of position. Until here, it seems that it is just a projection problem, but I think I'm doing right in the projection setup(?) But the most surprising is that the popup, which should be displayed on the points when clicking on it, are displayed at the exact locations, at any scale! So the position of the popup are right! If I try to transfom the points from EPSG4326 to EPSG900913, they are not displayed anymore anywhere... I've attached my stand-alone working code. This identically happen under WinXP-IE7 or FF and Ubuntu-FF. Any hints are welcome! Julien html xmlns=http://www.w3.org/1999/xhtml; head link rel=stylesheet href=http://openlayers.org/dev/theme/default/style.css; type=text/css / link rel=stylesheet href=http://openlayers.org/dev/examples/style.css; type=text/css / titleWallonie with GoogleMaps/title script src='http://maps.google.com/maps?file=api http://maps.google.com/maps?file=apiamp;v=2amp;key=ABQICxUxJ46tcIiZKW G81HlNYBQNmDPi4Y89dW251X5Bl4Z1--Eg2BTkAwr63SeUaRI4wI8RwX7LgtHN0g amp;v=2amp;key=ABQICxUxJ46tcIiZKWG81HlNYBQNmDPi4Y89dW251X5Bl4Z1--Eg2BT kAwr63SeUaRI4wI8RwX7LgtHN0g'/script script src=http://openlayers.org/api/OpenLayers.js;/script script type=text/javascript var map, gbase, points, selectControl, selectedFeature; var proj = new OpenLayers.Projection(EPSG:4326); var bounds = new OpenLayers.Bounds(6.190,50.517,6.205,50.535); bounds.transform(proj, map.getProjectionObject()); var options = { projection: new OpenLayers.Projection(EPSG:900913), displayProjection: new OpenLayers.Projection(EPSG:4326), units: m, numZoomLevels: 18, maxResolution: 156543.0339, maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34) }; function onPopupClose(evt) { selectControl.unselect(selectedFeature); } function onFeatureSelect(feature) { selectedFeature = feature; popup = new OpenLayers.Popup.FramedCloud(chicken, feature.geometry.getBounds().getCenterLonLat(), null, div + feature.id +/div, null, true, onPopupClose); popup.setBackgroundColor(red); popup.setBorder(10px); feature.popup = popup; map.addPopup(popup); } function onFeatureUnselect(feature) { map.removePopup(feature.popup); feature.popup.destroy(); feature.popup = null; } function init() { map = new OpenLayers.Map('map',options); // Add google layers gbase = new OpenLayers.Layer.Google( Google Physical, {type: G_PHYSICAL_MAP}, {'sphericalMercator': true} ); map.addLayer(gbase); // Add Bornes Frontières Geometry var Bornes = new Array(); Bornes[0] = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(6.20475,50.52167)); Bornes[1] = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(6.20440,50.52148)); //Bornes[0] = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(6.20475,50.52167).transform(new OpenLayers.Projection(EPSG:4326),new OpenLayers.Projection(EPSG:900913))); //Bornes[1] = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(6.20440,50.52148).transform(new OpenLayers.Projection(EPSG:4326),new OpenLayers.Projection(EPSG:900913))); points = new OpenLayers.Layer.Vector(Infos, {projection: new
Re: [OpenLayers-Users] Way to get name of the feature attribute?
Hi, If you use an OGC conform WFS server, then you can use REQUEST=DescribefeatureType to get the attributes of the features. That are only the ones the server is configured to return, not all the columns that are probaply in the database. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von paweluz Gesendet: Freitag, 22. Januar 2010 12:39 An: users@openlayers.org Betreff: [OpenLayers-Users] Way to get name of the feature attribute? Hi I am using WFS-T to add object to the database. Is there a way to get a name of columns in that database. I mean how to get the name of the attribute. I am using these code below to add new object to the database. drawControls = { add_object:new OpenLayers.Control.DrawFeature( zielona_wfs, OpenLayers.Handler.Path )} drawControls[add_object].featureAdded = function(feature) { feature.layer.eraseFeatures([feature]); feature.geometry = new OpenLayers.Geometry.MultiLineString( feature.geometry ); selectedfeature=feature; feature.state = OpenLayers.State.INSERT; feature.layer.drawFeature(feature); } . function add_object() { selectedfeature.attributes['Id'] =parseInt(document.getElementById(id_geometry).value); selectedfeature.attributes['Road'] = document.getElementById(road_geometry).value; map.layers[1].commit(); return false; } As you can see I am using selectedfeature.attributes['Id']. I would like to use instead of 'Id' some parameter of feature or wfs layer (zielona_wfs). Is they a way to get to name of attributes (column in database) through WFS layer. I would also like to say that this: var object_attributes = feature.attributes for (var key in object_attributes) { document.write(key); } will not work because object_attributes is empty (because I am adding new object to database, not editing existing one) Does anyone have any idea?? Thanks, Poul -- View this message in context: http://n2.nabble.com/Way-to-get-name-of-the-feature-attribute-tp4439540p4439 540.html 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] WFS attributes at init()
Hi, Do you mean something like this?: var WFSLayer = ...; WFSLayer.events.on({ loadend: function() { var ftAttributes = WFSLayer.features[0].attributes; var Msg=; for(var key in ftAttributes) Msg += key + : + ftAttributes[key] + \r\n; alert(Msg); } }); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von paweluz Gesendet: Montag, 18. Januar 2010 14:09 An: users@openlayers.org Betreff: [OpenLayers-Users] WFS attributes at init() Hi! I am able to get name of the attribute and the attribute by clicking on the feature on map. I am trying to get only the name of the feature, and use them in init(function), not only in method onFeatureSelect(feature) but also in init(). Is there a way to get to them by using just the WFS_layer? Of course I can just write the name of them like id, name. but I want to get them always from the WFS feature, in case someone change something in the database. I found about one hundred pages about getting features and presenting them on popup menu but I could not find anything about my problem. Does anyone have an idea?? Regards, Paul -- View this message in context: http://n2.nabble.com/WFS-attributes-at-init-tp4413521p4413521.html 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] help(upload and update files)
Hi, You have to have one baselayer, so try lindero.isBaseLayer=true; //after map.addLayer() To add vectorlayers to your map, you can try something like this: function addGMLlayer(title, url) { var Lindero = new OpenLayers.Layer.GML(title, url, { format: OpenLayers.Format.GML, formatOptions: { 'extractStyles': true } }); map.addLayer(Lindero); } If the gml-files come not from the same domain as your page, then you have to use a proxy-script. Arnd Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Ricardo Rodríguez Gesendet: Freitag, 15. Januar 2010 15:50 An: users@openlayers.org Betreff: [OpenLayers-Users] help(upload and update files) hi all, there is some ecript to upload files and add them to the layers of the viewer openlayers thanks for any response Ricardo Rodríguez Ing. Topográfico Univalle ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Opacity of GoogleLayer, get selected layer
Hi, OSM.setOpacity(0.1); map.addLayers([google, OSM, google_t]); google.setOpacity(0.1); google_t.setOpacity(0.1); The Google layers have to add to the map before you can change the opacity of the Google layers. For other layers it's possible before adding them to the map. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Eric Lemoine Gesendet: Freitag, 15. Januar 2010 17:21 An: Dirk Tanneberger Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] Opacity of GoogleLayer, get selected layer On Fri, Jan 15, 2010 at 12:05 PM, Dirk Tanneberger dirk.tanneber...@unibas.ch wrote: Hi Eric, thanks for the fast reply. With the baseLayer-object it works. I tried to apply the method directly to the layer, maybe that was the problem. But still I have the problem, when changing the baseLayer. In my case I got three baseLayers and no matter which one is selected it should have a opacity. If I do it like this: var map = new OpenLayers.Map(options); var google = new OpenLayers.Layer.Google( Google, {'sphericalMercator': true} ); var OSM = new OpenLayers.Layer.OSM(OSM); var google_t = new OpenLayers.Layer.Google( Google_Terrain, {type: G_PHYSICAL_MAP, 'sphericalMercator': true} ); map.addLayers([OSM, google, google_t]); map.baseLayer.setOpacity(0.5); the opacity is applied just to the initial baseLayer. The other layers don't have a opacity after being selected. I think, thats why I have to trigger the event, wether a layer is selected or not and set the opacity afterwards. Maybe it is possible to do so in the treepanel-object of the mapFish-API. Couldn't find anything appropriate so far, but I have to dig more into it. If you or somebody else got a hint, I would appreciate it very much. http://www.openlayers.org/dev/examples/spherical-mercator.html open the firebug console, and do: map.layers[0].setOpacity(0.2) // - this changes the opacity of the current base layer map.layers[1].setOpacity(0.2) // - this changes the opacity of the Google Satellite layer, although it's not the current base layer now select the Google Satellite layer in the LayerSwitcher, its opacity is expectedly 0.2. Maybe I don't understand the issue you're having. -- 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 ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] reprojecting issues
Hi, Your layer are also displayed in lat/lon, but with your extent you are not able to zoom near enough. Set every time your bounds, then it should work. if (proj!=='EPSG:4326') { options.units='m'; options.maxExtent=new OpenLayers.Bounds(-2826520,-6354390,4449320,4187770); } else { options.maxExtent=new OpenLayers.Bounds(-180,-90,180,90); options.units='dd'; } Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Pere Roca Ristol Gesendet: Dienstag, 12. Januar 2010 14:02 An: users@openlayers.org Betreff: [OpenLayers-Users] reprojecting issues hi all, please correct me if I'm wrong. As far as I have investigated around, if I want to reproject all the layers, I have to first destroy the map, recreate it with options.projection=my_proj and recreate all the layers (when destroying the map, layers persist but params are deleted) and add them Even with some errors (EPSG 32661 and 3411 are not correctly reprojected) it can be see on http://edit.csic.es/geo/mapviewer/projections_test.html http://edit.csic.es/geo/mapviewer/projections_test.html What it doesn't work at all is trying to switch to lat/long (4326), where I don't get an error but a blank image. Some idea why it happens? and why 32661 and 3411 are not correctly displayed? thanks in advance, Pere -- View this message in context: http://n2.nabble.com/reprojecting-issues-tp4291395p4291395.html 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] Problems with SLD_BODY
Hi, I have setup my SLD online example [1] to WMS.Post for IE and things seems to work. But zoom and pan will raise an error. This can also be seen with the OpenLayers example [2], when you zoom out and pan around. The errorline refers to Line 541 this.observers[cacheID].push({'element':element,'name':name,'observer':obser ver,... I'm using IE6 and OpenLayers.js from dev. Nevertheless an interesting technic to get SLD_BODY work with IE! Arnd [1] http://gis.ibbeck.de/OLClient/examples/wms_sld_world_ie_post.asp [2] http://openlayers.org/dev/examples/WMSPost.html -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Andreas Hocevar Gesendet: Freitag, 8. Januar 2010 12:15 An: fsalasGeocuba; users@openlayers.org Betreff: Re: [OpenLayers-Users] Problems with SLD_BODY you can use Layer.WMS.Post instead of Layer.WMS, and things should be fine. Regards, Andreas. 2010/1/7, fsalasGeocuba fsa...@geocuba.cu: Hi, I´m trying to apply one new style to point layer using for that the property SLD_BODY. For do this operation I do with my own rules one StyledLayerDescriptor but here is the problem, when hay try to put more of six rules, no drawing me the layer. My questions is. There are rulers´s limits for SLD_BODY? Example: function Change_Styles() { map.layers[0].params.SLD_BODY = 'StyledLayerDescriptor version=1.0.0UserLayerNametopp:sennal/NameUserStyleNameUs erSelection/NameFeatureTypeStyleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToProper tyNametipo_senal/PropertyNameLiteralFV/Literal/PropertyIsEqual ToPropertyIsEqualToPropertyNameciega_luminica/PropertyNameLite ralL/Literal/PropertyIsEqualTo/And/FilterPointSymbolizerGr aphicExternalGraphicOnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/FFENFL.png/Formati mage/gif/Format/ExternalGraphicOpacityLiteral1.0/Literal/Op acitySizeLiteral20.0/Literal/SizeRotationLiteral0.0/Lite ral/Rotation/Graphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToProper tyNametipo_senal/PropertyNameLiteralFA/Literal/PropertyIsEqual ToPropertyIsEqualToPropertyNameciega_luminica/PropertyNameLite ralL/Literal/PropertyIsEqualTo/And/FilterPointSymbolizerGr aphicExternalGraphicOnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/FFENFL.png/Formati mage/gif/Format/ExternalGraphicOpacityLiteral1.0/Literal/Op acitySizeLiteral20.0/Literal/SizeRotationLiteral0.0/Lite ral/Rotation/Graphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToProper tyNametipo_senal/PropertyNameLiteralENF/Literal/PropertyIsEqua lToPropertyIsEqualToPropertyNameciega_luminica/PropertyNameLit eralL/Literal/PropertyIsEqualTo/And/FilterPointSymbolizerG raphicExternalGraphicOnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/FFENFL.png/Formati mage/gif/Format/ExternalGraphicOpacityLiteral1.0/Literal/Op acitySizeLiteral20.0/Literal/SizeRotationLiteral0.0/Lite ral/Rotation/Graphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToProper tyNametipo_senal/PropertyNameLiteralENF/Literal/PropertyIsEqua lToPropertyIsEqualToPropertyNameciega_luminica/PropertyNameLit eralC/Literal/PropertyIsEqualTo/And/FilterPointSymbolizerG raphicExternalGraphicOnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/ENFC.png/Formatima ge/gif/Format/ExternalGraphicOpacityLiteral1.0/Literal/Opac itySizeLiteral20.0/Literal/SizeRotationLiteral0.0/Litera l/Rotation/Graphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToProper tyNametipo_senal/PropertyNameLiteralBZ/Literal/PropertyIsEqual ToPropertyIsEqualToPropertyNameciega_luminica/PropertyNameLite ralL/Literal/PropertyIsEqualToPropertyIsEqualToPropertyNameco lor/PropertyNameLiteralVerde/Literal/PropertyIsEqualTo/And/ FilterPointSymbolizerGraphicExternalGraphicOnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/BZL-V.png/Formatim age/gif/Format/ExternalGraphicOpacityLiteral1.0/Literal/Opa citySizeLiteral20.0/Literal/SizeRotationLiteral0.0/Liter al/Rotation/Graphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToProper tyNametipo_senal/PropertyNameLiteralBZ/Literal/PropertyIsEqual ToPropertyIsEqualToPropertyNameciega_luminica/PropertyNameLite ralL/Literal/PropertyIsEqualTo PropertyIsEqualToPropertyNamecolor/PropertyNameLiteralRoja/Li teral/PropertyIsEqualTo/And/FilterPointSymbolizerGraphicEx ternalGraphicOnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple
Re: [OpenLayers-Users] Trying to draw a box on a map, and get the coordinates back.
Hi, That should it be. function findcoords (event) { var vertices = event.feature.geometry.getVertices(); alert('ID:' + vertices); } Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Jtrsmith Gesendet: Donnerstag, 7. Januar 2010 17:27 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Trying to draw a box on a map, and get the coordinates back. i am not sure i explained what i was looking for correctly. here is an example. vectors.events.register('featureadded', vectors, findcoords); function findcoords (feature) { var vertices = feature.geometry.getVertices(); document.getElementById('output').value = 'ID:' + vertices; } the event does actually trigger, however, feature.geometry.getVertices() does not work. i am using geojson to display other polygons on the map, and would like the variable vertices to get the coordinates of the polygon vertices so that i can add a new polygon to the map and save the coordinates in a database. John micklesh wrote: Hi, John. if i understood your requirements, there is an example in the docs http://dev.openlayers.org/docs/files/OpenLayers/Control-js.html regards, michael. 2010/1/4 John Smith jtrsm...@gmail.com i just saw this post and was wondering if the solution was ever found. i am basically trying to do the same thing. I need to draw a box around an area of my map and show the coordinates in a form field, so i can post the coordinates and a description to my database. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users -- View this message in context: http://n2.nabble.com/Trying-to-draw-a-box-on-a-map-and-get-the-coordinates-b ack-tp4251287p4267311.html 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] Trying to draw a box on a map, and get the coordinates back.
Hi John, To get geoJSON in return use OpenLayers.Format.GeoJSON(): var formats = { wkt: new OpenLayers.Format.WKT(), geojson: new OpenLayers.Format.GeoJSON(), georss: new OpenLayers.Format.GeoRSS(), gml: new OpenLayers.Format.GML(), kml: new OpenLayers.Format.KML() }; var type = geojson; //var type = gml; var theParser = formats[type]; function findcoords (event) { var data = theParser.write(event.feature); alert('ID:' + data); //only relevant for geoJSON, and only one feature var objData = eval ( '(' + data + ')'); alert(objData[geometry][coordinates]); } vectors.events.register('featureadded', vectors, findcoords); Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Jtrsmith Gesendet: Donnerstag, 7. Januar 2010 19:36 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Trying to draw a box on a map, and get the coordinates back. thank you that works. is it possible to get the vertices in a geojson coordinate format? i.e. [-277, 359], [-277, 407], [-238, 407], [-238, 359], [-277, 359] instead of POINT(-277 359),POINT(-277 407),POINT(-238 407),POINT(-238 359) thanks again John Arnd Wippermann wrote: Hi, That should it be. function findcoords (event) { var vertices = event.feature.geometry.getVertices(); alert('ID:' + vertices); } Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Jtrsmith Gesendet: Donnerstag, 7. Januar 2010 17:27 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] Trying to draw a box on a map, and get the coordinates back. i am not sure i explained what i was looking for correctly. here is an example. vectors.events.register('featureadded', vectors, findcoords); function findcoords (feature) { var vertices = feature.geometry.getVertices(); document.getElementById('output').value = 'ID:' + vertices; } the event does actually trigger, however, feature.geometry.getVertices() does not work. i am using geojson to display other polygons on the map, and would like the variable vertices to get the coordinates of the polygon vertices so that i can add a new polygon to the map and save the coordinates in a database. John micklesh wrote: Hi, John. if i understood your requirements, there is an example in the docs http://dev.openlayers.org/docs/files/OpenLayers/Control-js.html regards, michael. 2010/1/4 John Smith jtrsm...@gmail.com i just saw this post and was wondering if the solution was ever found. i am basically trying to do the same thing. I need to draw a box around an area of my map and show the coordinates in a form field, so i can post the coordinates and a description to my database. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users -- View this message in context: http://n2.nabble.com/Trying-to-draw-a-box-on-a-map-and-get-the-coordin ates-b ack-tp4251287p4267311.html 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 -- View this message in context: http://n2.nabble.com/Trying-to-draw-a-box-on-a-map-and-get-the-coordinates-b ack-tp4251287p4268014.html 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] Problems with SLD_BODY
Hi, I would suggest, that with your SLD_BODY (6050 chars; more rules, more chars) the url get too long. I have the same problem with IE. FF seems to get along. Instead of SLD_BODY you can perhaps use SLD and write your SLD_BODY into a file, that is over http reachable. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von fsalasGeocuba Gesendet: Donnerstag, 7. Januar 2010 23:48 An: users@openlayers.org Betreff: [OpenLayers-Users] Problems with SLD_BODY Hi, I´m trying to apply one new style to point layer using for that the property SLD_BODY. For do this operation I do with my own rules one StyledLayerDescriptor but here is the problem, when hay try to put more of six rules, no drawing me the layer. My questions is. There are rulers´s limits for SLD_BODY? Example: function Change_Styles() { map.layers[0].params.SLD_BODY = 'StyledLayerDescriptor version=1.0.0UserLayerNametopp:sennal/NameUserStyleNameUserSele ction/NameFeatureTypeStyleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToPropertyName tipo_senal/PropertyNameLiteralFV/Literal/PropertyIsEqualToProperty IsEqualToPropertyNameciega_luminica/PropertyNameLiteralL/Literal/P ropertyIsEqualTo/And/FilterPointSymbolizerGraphicExternalGraphic OnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/FFENFL.png/Formatimage/g if/Format/ExternalGraphicOpacityLiteral1.0/Literal/OpacitySize Literal20.0/Literal/SizeRotationLiteral0.0/Literal/Rotation/G raphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToPropertyName tipo_senal/PropertyNameLiteralFA/Literal/PropertyIsEqualToProperty IsEqualToPropertyNameciega_luminica/PropertyNameLiteralL/Literal/P ropertyIsEqualTo/And/FilterPointSymbolizerGraphicExternalGraphic OnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/FFENFL.png/Formatimage/g if/Format/ExternalGraphicOpacityLiteral1.0/Literal/OpacitySize Literal20.0/Literal/SizeRotationLiteral0.0/Literal/Rotation/G raphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToPropertyName tipo_senal/PropertyNameLiteralENF/Literal/PropertyIsEqualToPropert yIsEqualToPropertyNameciega_luminica/PropertyNameLiteralL/Literal/ PropertyIsEqualTo/And/FilterPointSymbolizerGraphicExternalGraphic OnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/FFENFL.png/Formatimage/g if/Format/ExternalGraphicOpacityLiteral1.0/Literal/OpacitySize Literal20.0/Literal/SizeRotationLiteral0.0/Literal/Rotation/G raphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToPropertyName tipo_senal/PropertyNameLiteralENF/Literal/PropertyIsEqualToPropert yIsEqualToPropertyNameciega_luminica/PropertyNameLiteralC/Literal/ PropertyIsEqualTo/And/FilterPointSymbolizerGraphicExternalGraphic OnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/ENFC.png/Formatimage/gif /Format/ExternalGraphicOpacityLiteral1.0/Literal/OpacitySizeL iteral20.0/Literal/SizeRotationLiteral0.0/Literal/Rotation/Gra phic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToPropertyName tipo_senal/PropertyNameLiteralBZ/Literal/PropertyIsEqualToProperty IsEqualToPropertyNameciega_luminica/PropertyNameLiteralL/Literal/P ropertyIsEqualToPropertyIsEqualToPropertyNamecolor/PropertyNameLiter alVerde/Literal/PropertyIsEqualTo/And/FilterPointSymbolizerGraph icExternalGraphicOnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/BZL-V.png/Formatimage/gi f/Format/ExternalGraphicOpacityLiteral1.0/Literal/OpacitySize Literal20.0/Literal/SizeRotationLiteral0.0/Literal/Rotation/Gr aphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToPropertyName tipo_senal/PropertyNameLiteralBZ/Literal/PropertyIsEqualToProperty IsEqualToPropertyNameciega_luminica/PropertyNameLiteralL/Literal/P ropertyIsEqualTo PropertyIsEqualToPropertyNamecolor/PropertyNameLiteralRoja/Literal /PropertyIsEqualTo/And/FilterPointSymbolizerGraphicExternalGraphi cOnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; xlink:type=simple xlink:href=file:/D:/AppServ/www/SIGANAV/images/BZL-R.png/Formatimage/gi f/Format/ExternalGraphicOpacityLiteral1.0/Literal/OpacitySize Literal20.0/Literal/SizeRotationLiteral0.0/Literal/Rotation/Gr aphic/PointSymbolizer/RuleRuleFilter xmlns:gml=http://www.opengis.net/gml;AndPropertyIsEqualToPropertyName tipo_senal/PropertyNameLiteralBZ/Literal/PropertyIsEqualToProperty IsEqualToPropertyNameciega_luminica/PropertyNameLiteralL/Literal/P ropertyIsEqualToPropertyIsEqualToPropertyNamecolor/PropertyNameLiter
Re: [OpenLayers-Users] Using only one set of modify feature controls for different layers?
Hi, It is possible to work with one control set for all vector layers. I have an application, where i use this. When changing from one vectorlayer to another, I destroy the controls and declare them then for the next vectorlayer. But i have my controls set in a OpenLayers panel. So there is no need for registering events, that's part of the panel. Perhaps there is the cause, that your approach doesn't work. Arnd http://gis.ibbeck.de/OLClient/OLClient.asp?MAPNR=900913LAYERS=10,100020 ,100630,100641CENTER=798470.75198434,6669045.919625ZOOM=17 -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von cgp Gesendet: Dienstag, 5. Januar 2010 18:16 An: users@openlayers.org Betreff: [OpenLayers-Users] Using only one set of modify feature controls for different layers? I added 3 different WFS polygon overlays to the map like this: var wfs_poly_1 = new OpenLayers.Layer.Vector(WFS POLY 1, { strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ version: 1.1.0, url: /geoserver/wfs, featureType: 'LAYER_PREFIX.WFS_POLY_1', featureNS: http://geoserver.sf.net;, featurePrefix: sde, srsName: EPSG:900913, geometryName: SHAPE }) }); wfs_poly_1.setVisibility(false); var wfs_poly_2 = new OpenLayers.Layer.Vector(WFS POLY 2, { strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ version: 1.1.0, url: /geoserver/wfs, featureType: 'LAYER_PREFIX.WFS_POLY_2', featureNS: http://geoserver.sf.net;, featurePrefix: sde, srsName: EPSG:900913, geometryName: SHAPE }) }); wfs_poly_2.setVisibility(false); var wfs_poly_3 = new OpenLayers.Layer.Vector(WFS POLY 3, { strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ version: 1.1.0, url: /geoserver/wfs, featureType: 'LAYER_PREFIX.WFS_POLY_3', featureNS: http://geoserver.sf.net;, featurePrefix: sde, srsName: EPSG:900913, geometryName: SHAPE }) }); wfs_poly_3.setVisibility(false); map.addLayers( [ wfs_poly_1, wfs_poly_2, wfs_poly_3 ]); Then I added the modify controls like this: (by default, wfs_poly_1 is selected) modifyControls = { select: new OpenLayers.Control.SelectFeature(wfs_poly_1,{ onSelect: onFeatureSelect, onUnselect: onFeatureUnselect, toggle: true, clickout:true, multipleKey: ctrlKey}), drag: new OpenLayers.Control.ModifyFeature(wfs_poly_1,{mode:OpenLayers.Control.ModifyF eature.DRAG,displayClass:olControlModifyFeatureDrag}), resize: new OpenLayers.Control.ModifyFeature(wfs_poly_1,{mode:OpenLayers.Control.ModifyF eature.RESIZE,displayClass:olControlModifyFeatureResize}), rotate: new OpenLayers.Control.ModifyFeature(wfs_poly_1,{mode:OpenLayers.Control.ModifyF eature.ROTATE,displayClass:olControlModifyFeatureRotate}), reshape: new OpenLayers.Control.ModifyFeature(wfs_poly_1,{mode:OpenLayers.Control.ModifyF eature.RESHAPE,displayClass:olControlModifyFeatureReshape}), delete_f: new OpenLayers.Control.SelectFeature(wfs_poly_1,{onSelect:function(feature){vect or1.destroyFeatures([feature])}}) }; for (var key in modifyControls) { map.addControl(modifyControls[key]); } I also made my own layer switcher that only allows modification of one layer at a time. When I toggle between the layers, I assign the layer to each of the modify feature controls: for(var modify_key in modifyControls) { var control = modifyControls[modify_key]; control.layer = layer; } The following HTML displays the controls: div id=modifyControlsMODIFY CONTROLSbr/ img id=select class=modify_functions src=./js/img/select-enabled.png alt=Select/ img id=drag class=modify_functions src=./js/img/drag-enabled.png alt=Drag/
Re: [OpenLayers-Users] geojson - Performance issue
Hi, for own sld test purpose I have set up an example http://gis.ibbeck.de/OLClient/examples/wms_sld_world.asp which use SLD to render filtered items of a map. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von steve.tout...@inspq.qc.ca Gesendet: Mittwoch, 6. Januar 2010 17:10 An: Andreas Hocevar Cc: users@openlayers.org; users-boun...@openlayers.org Betreff: Re: [OpenLayers-Users] geojson - Performance issue Thanks for this alternative Andreas. I don't know much about sld but I read some threads and it seems to be the right solution. I'll try to find some goog examples. It never ends...Always something new to learn Thanks Steve Steve Toutant, M. Sc. Analyste en géomatique Secteur environnement Direction de la santé environnementale et de la toxicologie Institut national de santé publique du Québec 945, avenue Wolfe Québec, Qc G1V 5B3 Tél.: (418) 650-5115 #5281 Fax.: (418) 654-3144 mailto:steve.tout...@inspq.qc.ca steve.tout...@inspq.qc.ca http://www.inspq.qc.ca/ http://www.inspq.qc.ca Andreas Hocevar ahoce...@opengeo.org@openlayers.org Envoyé par : users-boun...@openlayers.org 06/01/2010 10:35 AM A users@openlayers.org cc Objet Re: [OpenLayers-Users] geojson - Performance issue Hi, 2000+ features is way too much for rendering in the browser. if you use mapserver already, then you can also query the layer as WMS layer, using sld_body with a filter. If your query is complex, use Layer.WMS.Post instead of Layer.WMS to avoid urls that are too long for IE. Regards, Andreas. On 2010-01-06 16:29, steve.tout...@inspq.qc.ca wrote: Hi, I created a WMS (mapserver) layer containing 13400 polygons. It loads in less then 3 seconds. Good. I need to develop a tool for the user so he can create a custom query on this layer to retreive specific polygons. In a form, the user select the parameters and launch the request. Here is the code below. That works, but it takes minutes to render. Per example, a query that returns 2482 polygons, In firebug I see that the query runs in less then 2 seconds. But, It seems that the creation of the geometries is an heavy task. I get this warning in FF I click on Continue several times and then I get geometries in the map. I guess 2482 polygons is simply too much for a vector layer. If that is the case, is there another format then GeoJson I could use? Maybe my approach is totally wrong... Any comments would be appreciated. Thanks for your help, Steve The code used: Ext.Ajax.request({ url: 'requeteVulnerabilite.php', method:'POST', params: { inddef: cb_inddefValue}, failure: function(){alert(Ca pas marché);}, success: function(result, request ) { //alert(result.responseText); vulnerabiliteLayer.destroyFeatures(); var features = new OpenLayers.Format.GeoJSON({'internalProjection':map.baseLayer.projection,'ex ternalProjection':map.baseLayer.projection }).read(result.responseText); var bounds; if(features) { if(features.constructor != Array) { features = [features]; } for(var i=0; ifeatures.length; ++i) { if (!bounds) { bounds = features[i].geometry.getBounds(); } else { bounds.extend(features[i].geometry.getBounds()); } } vulnerabiliteLayer.addFeatures(features); map.zoomToExtent(bounds); } } }); /Steve Toutant, M. Sc./ Analyste en géomatique Secteur environnement Direction de la santé environnementale et de la toxicologie Institut national de santé publique du Québec 945, avenue Wolfe Québec, Qc G1V 5B3 Tél.: (418) 650-5115 #5281 Fax.: (418) 654-3144_ __steve.tout...@inspq.qc.ca_ mailto:steve.tout...@inspq.qc.ca_ __http://www.inspq.qc.ca_ http://www.inspq.qc.ca/ ___ 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 ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] Zoom-based feature styling
Hi, Have a look at this example http://openlayers.org/dev/examples/styles-context.html The context option of an OpenLayers.Style object offers the possibility to style features by own declared functions. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Mak Kolybabi Gesendet: Dienstag, 29. Dezember 2009 17:19 An: users@openlayers.org Betreff: [OpenLayers-Users] Zoom-based feature styling I expect that there's an easy way to do this, but it so far eludes me. I have an OpenLayers.Layer.Vector object called icons. Each feature in this layer has two attributes that I need to worry about: type and zoom. There are fifty different types, and five different zooms, so far. I already have type-based styling using: new OpenLayers.Rule({ filter: new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.EQUAL_TO, property: type, value: type_1 }), symbolizer: { externalGraphic: /path/to/images/1.png, graphicHeight: 25, graphicWidth: 25, graphicOpacity: 1.0 } })); I realize I could use max/minScaleDenominator to restrict zooms, but 5x50 rules is excessive. What I'm looking for is something like: new OpenLayers.Rule({ filter: new OpenLayers.Filter.Logical({ filters: [ new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.EQUAL_TO, property: type, value: type_1 }), new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO, property: zoom, value: map.zoom }) ], type: OpenLayers.Filter.Logical.AND }), symbolizer: { externalGraphic: /path/to/images/1.png, graphicHeight: 25, graphicWidth: 25, graphicOpacity: 1.0 } })); Except where map.zoom is dynamically evaluated, instead of it being evaluated only when the style is created. Any ideas or suggestions are appreciated. -- Mak Kolybabi Programmer Telenium Inc. 204-957-2821 ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] insert spatial data into mysql
Hi, If you not want to use WFS-T, you can manuell add your polygons to your db with a server script. I do this task by looping through the features of a vector layer, to get the attributes and geometry of these features and and post them to a server script. The script uses ODBC to insert the features geometry into my db. var aspODBC= ...; //server script to insert data into a MS Access MDB via ODBC var KATEGORIE = AREAS; var TABLE = POLYGONS; function SaveGeometry(vlayer) { var featuresCount = vlayer.features.length; for(var i=0;ifeaturesCount;i++) { insertData(table, vlayer.features[i].geometry); } clearVectorlayer(); } function insertData(table, WKTString) { var POSITION = WKTString.toString(); var theUrl = aspODBC; var data = { MODE: INSERT, TABLE : table, POSITION : POSITION, KATEGORIE: KATEGORIE } var myAjax = new OpenLayers.Ajax.Request( theUrl, { method: 'post', data: OpenLayers.Util.getParameterString(data), headers : { Content-Type: application/x-www-form-urlencoded }, onComplete: showResponseINSERT, onFailure: showResponseFailureINSERT }); } Updating and deleting features are also possible in this way. And with MapServer and ogr-ODBC it's possible to retrieve this data via WMS or WFS. Arnd -Ursprüngliche Nachricht- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von MadAGu Gesendet: Montag, 21. Dezember 2009 21:12 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] insert spatial data into mysql well anyone? -- View this message in context: http://n2.nabble.com/insert-spatial-data-into-mysql-tp4164235p4200314.html 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] rendering WFS and vectors based on zoom levels
minScale and maxScale or minResolution and maxResolution should do the trick. function layerGML_BW(title, url, projection) { var lyr = new OpenLayers.Layer.Vector(title , { minScale : 4000, maxScale : 50, projection: projection, strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: url, format: new OpenLayers.Format.GML({ extractAttributes: true }) }) }); return(lyr); } from http://gis.ibbeck.de/ginfo/apps/planwerk/planwerk_nordbahntrasse.asp if you zoom into the small recangles, a layer with labels will show up. Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Lammie Jonson Gesendet: Donnerstag, 17. Dezember 2009 22:33 An: users@openlayers.org Betreff: [OpenLayers-Users] rendering WFS and vectors based on zoom levels I figured out how to render WFS from my website using a proxy. The browser will send a request like this to the server: Parameters: {url=http://mysite.com?typename=topp%3Astates http://mysite.com?typename=topp%3AstatesSERVICE=WFSVERSION=1.0.0REQUEST= GetFeatureSRS=EPSG%3A4326BBOX=-570.9375,-457.646484375,819.84375,380.47851 5625 SERVICE=WFSVERSION=1.0.0REQUEST=GetFeatureSRS=EPSG%3A4326BBOX=-570.9375 ,-457.646484375,819.84375,380.478515625} Suppose I only want the content rendered through WFS to only be visible at lower zoom levels, is there a way to indicate this in openlayers in the constructor for the WFS layer ? I would like to also be able to do that for any other vector data as well. I could do this in a variety of ways using session data through a cookie or by somehow checking the map zoom level whenever the map moves. In the case of WFS, maybe I could somehow figure out the zoom level from the bounding box, but if there is a more transparent way to do that I would like to do it that way or whatever is the preferred cleaner approach, etc. ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
Re: [OpenLayers-Users] my road styleMap not working
Hi, perhaps this works var rType = {}; //new Object() Arnd _ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Haftish 21 Gesendet: Freitag, 11. Dezember 2009 12:52 An: users@openlayers.org Betreff: [OpenLayers-Users] my road styleMap not working Trying to define a styleMap of my road layer based on rdlnstattx attribute, I defined a rule based on type as follows: var rStyle = new OpenLayers.StyleMap(); var rType = new Array(); rType = { FUN: { text: 'Functioning', strokeColor:#ff, strokeWidth: 7 }, SCH: { text: 'Schematic road', strokeColor:#0aa989, strokeWidth: 4 }, COM: { text: 'Compiled road connector', strokeColor:#f4a427, strokeWidth: 3 } }; rStyle.addUniqueValueRules(default, 'rdlnstattx', rType); But, nothing seems working. My styleMap on polygon layer is working well. Where did I miss sth? Any clue??? Thank you in advance!!! ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users