show polygon with dotted line border

338 views
Skip to first unread message

Namrata

unread,
Apr 6, 2012, 6:42:22 AM4/6/12
to openscales-dev
Hello All,

I am using OpenScales 1.2.
I am trying to right style for polygon symbolizer. I want to show
polygon object with dotted line border.

I have tried by using custom action script class for dotted line but
still it is showing polygon with normal line. Please let me know how
to achieve it.


Thanks,
Namrata

nanda kishor

unread,
Apr 9, 2012, 12:58:40 AM4/9/12
to opensca...@googlegroups.com
@ Namrata

Your Polygon layer is in WFS or in WMS.

Munna.


--
You received this message because you are subscribed to the Google Groups "openscales-dev" group.
To post to this group, send email to opensca...@googlegroups.com.
To unsubscribe from this group, send email to openscales-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openscales-dev?hl=en.




--

- Regards
  NANDA KISHOR.K.S
  M.Tech (RS & GIS)
  09738120522
  09986715366


Namrata Nikam

unread,
Apr 9, 2012, 6:33:34 AM4/9/12
to opensca...@googlegroups.com
It is in WFS.

nanda kishor

unread,
Apr 9, 2012, 6:58:27 AM4/9/12
to opensca...@googlegroups.com
I am also facing same problem, but mine is point layer its in WFS,

Namrata Nikam

unread,
Apr 9, 2012, 7:41:00 AM4/9/12
to opensca...@googlegroups.com
Solution: 

1. Write custom marker class with  code to draw dotted shape like circle/rectangle
2. write style function with this custom marker to show dotted circle/rectangle.
3. assign this style function to style property of ur point layer

nanda kishor

unread,
Apr 10, 2012, 1:02:26 AM4/10/12
to opensca...@googlegroups.com
@ Namrata,

Is it possible to display a jpeg/image as the points in WFS, according to rule.


Regards,
Munna

Namrata Nikam

unread,
Apr 10, 2012, 1:55:42 AM4/10/12
to opensca...@googlegroups.com
Yes, It is possible by using 'DisplayObjectMarker' class.

You can write style function like this


function imgStyle() :Style
{
  [Embed (source="../src/marker.png")] 
  static const imgData:Class;
  
   var mark:DisplayObjectMarker = new DisplayObjectMarker(imgData); 
   var symbolizer:PointSymbolizer = new PointSymbolizer(mark); 
   rule.symbolizers.push(symbolizer);
   var style:Style = new Style(); 
   var rule:Rule = new Rule();
   style.rules.push(rule);
   return style;

Namrata Nikam

unread,
Apr 10, 2012, 1:56:29 AM4/10/12
to opensca...@googlegroups.com
Yes, It is possible by using 'DisplayObjectMarker' class.

You can write style function like this


function imgStyle() :Style
{
  [Embed (source="../src/marker.png")] 
  static const imgData:Class;
  
   var mark:DisplayObjectMarker = new DisplayObjectMarker(imgData); 
   var symbolizer:PointSymbolizer = new PointSymbolizer(mark); 
   rule.symbolizers.push(symbolizer);
   var style:Style = new Style(); 
   var rule:Rule = new Rule();
   style.rules.push(rule);
   return style;
}



Munna

unread,
Apr 10, 2012, 4:32:02 AM4/10/12
to opensca...@googlegroups.com
@Namrata,  Can you help form this..,(Styling the point WFS layer)

I have defined WFS layer.
I am not getting where i have to define the style.
this is my map code..(In Flex 3)

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns="*" 
 xmlns:os="http://openscales.org"
 creationComplete="initMap()" 
 xmlns:handler="org.openscales.fx.handler.*" width="100%" height="100%">
 
<mx:Script>
<![CDATA[
import org.openscales.core.events.LayerEvent;
import org.openscales.core.Map;
import org.openscales.core.Trace;
import org.openscales.core.handler.feature.draw.DrawPolygonHandler;
import org.openscales.core.handler.feature.draw.DrawHandler;
import org.openscales.core.events.DrawingEvent;

import org.openscales.core.handler.feature.SelectFeaturesHandler;
import org.openscales.core.handler.Handler;
import org.openscales.core.Map;
import org.openscales.core.Trace;

// Specific imports for this example
import org.openscales.core.feature.LineStringFeature;
import org.openscales.core.feature.MultiLineStringFeature;
import org.openscales.core.feature.MultiPointFeature;
import org.openscales.core.feature.MultiPolygonFeature;
import org.openscales.core.feature.PointFeature;
import org.openscales.core.feature.PolygonFeature;
import org.openscales.core.geometry.Collection;
import org.openscales.core.geometry.Geometry;
import org.openscales.core.geometry.LineString;
import org.openscales.core.geometry.LinearRing;
import org.openscales.core.geometry.MultiLineString;
import org.openscales.core.geometry.MultiPoint;
import org.openscales.core.geometry.MultiPolygon;
import org.openscales.core.geometry.Point;
import org.openscales.core.geometry.Polygon;
import org.openscales.core.layer.FeatureLayer;
import org.openscales.core.style.Rule;
import org.openscales.core.style.Style;
import org.openscales.core.style.fill.SolidFill;
import org.openscales.core.style.symbolizer.PolygonSymbolizer;
import org.openscales.core.style.stroke.Stroke;

import org.openscales.proj4as.ProjProjection;

import org.openscales.core.popup.Anchored;
import org.openscales.core.events.FeatureEvent;
import org.openscales.core.events.MapEvent;
import org.openscales.core.Map;
import org.openscales.core.Trace;
import org.openscales.core.style.Style;

private var popup:Anchored
[Bindable] private var map:Map;
[Bindable] public var displayTrace:Boolean = false;
[Bindable] public var displayFirebugTrace:Boolean = false;

private function initMap():void {
Trace.useFireBugConsole = displayFirebugTrace;
map = fxmap1.map;
map.addEventListener(FeatureEvent.FEATURE_CLICK, onFeatureClick);
}
private function onFeatureClick(event:FeatureEvent):void {
if(popup) {
popup.destroy();
}
popup = null;
popup = new Anchored();
popup.feature = event.feature;
var content:String = "";
if(event.feature.attributes["station_id"] != undefined)
content = content + "<b><font size='20'>" + event.feature.attributes["station_id"] + " (" + event.feature.attributes["STATE_ABBR"] + ")</font></b><br />";
for(var attribute:String in event.feature.attributes) {
if((attribute != "station_id") && (attribute != "coordinates")) 
content = content + "<b>" + attribute + "</b> : " + event.feature.attributes[attribute] + "<br />";
}
popup.htmlText = content;
map.addPopup(popup, true);
}

[Bindable] public var wb:Number = 74.051;
[Bindable] public  var eb:Number = 11.582;
[Bindable] public  var nb:Number = 78.588;
[Bindable] public  var sb:Number = 18.477;

private var polygonhandler:DrawPolygonHandler= new DrawPolygonHandler(map,false,graphiclayer);
private var graphiclayer:FeatureLayer;
private var rect:Rectangle = new Rectangle(75,11,79,18);
private var extpoly:PolygonFeature = new PolygonFeature();

]]>
</mx:Script>
<mx:Canvas width="100%" height="100%" id="canvas1" borderStyle="solid">
<os:Map id="fxmap1" height="100%" width="100%" >

<os:WMS name="KarnatakaState" 
layers="Final:Karstate_Boundy" 
format="image/jpeg" 
isBaseLayer="true">
</os:WMS>

<os:WFS name="AWSPOINTS" 
typename="Final:atmo_pressure" 
projection="EPSG:4326" 
version="1.0.0" 
useCapabilities="true" 
capabilitiesVersion="1.0.0" 
style="{Style.getDefaultPointStyle()}">
</os:WFS>

<os:DragHandler id="dragHandler" />

<os:WheelHandler/>
<os:Extent left="74.051" 
bottom="11.582" 
right="78.588" 
top="18.477"/>

<os:Spinner id="spinner" 
x="{width / 2}" 
y="{height / 2}"/>
<os:MousePosition x="20" 
y="675" 
displayProjection="EPSG:4326"/>

<os:SelectFeaturesHandler active="true" enableClickSelection="false" enableBoxSelection="false" enableOverSelection="true" />
</os:Map>

<os:ControlPanel x="10" y="10" title="Navigation" paddingRight="0" paddingLeft="0" paddingBottom="0">
<os:PanComponent map="{map}"/>
<mx:HBox width="100%" paddingLeft="5" paddingRight="5">
<os:ZoomComponent map="{map}"/>
<mx:Spacer width="100%" />
<os:ZoomBoxComponent map="{map}" width="32" height="32"/>
</mx:HBox>
<os:OverviewMapComponent map="{map}" width="140">
<os:Mapnik name="Mapnik" isBaseLayer="true"/>
</os:OverviewMapComponent>
</os:ControlPanel>
</mx:Canvas>
</mx:Canvas>


My WFS layer contains the rainfall information. I wanted to set a 4 rules for the quantity of rainfall and i need to show 4 jpeg image as the points for 4 rules,
 like for 
Rule1 is rainfall 0 to 25 rain1.jpeg
Rule2 is rainfall 25 to 50 rain2.jpeg
Rule3 is rainfall 50 to 75 rain4.jpeg 
Rule4 is rainfall 75 to 100 rain5.jpeg

my WFS layer contains data as,

name       lat        long     rainfall
A             13         70        15
B             14         70        80
C             15         70        30
D             16         70        58
E             13.5      70        70

Thanks in advance........

Regards,
Munna
Munna


It is in WFS.


Munna.


To post to this group, send email to openscales-dev@googlegroups.com.
To unsubscribe from this group, send email to openscales-dev+unsubscribe@googlegroups.com.

nanda kishor

unread,
Apr 11, 2012, 6:56:11 AM4/11/12
to opensca...@googlegroups.com
@ Namrata,

   I have tried this, but i am getting the bellow error message. 
1012: The static attribute may be used only on definitions inside a class.

I am not getting how to change the styles of the WFS point layer,

please can u help me from this..

Thanks in advance..

--Munna

Andrew Henry

unread,
Apr 11, 2012, 7:09:07 AM4/11/12
to opensca...@googlegroups.com
Hi,

maybe this was already suggested and I missed it but can you not style the polygon using SLD in your map server?

Andy

nanda kishor

unread,
Apr 11, 2012, 10:02:54 AM4/11/12
to opensca...@googlegroups.com
Thanks Henry.  But I am using Geoserver and used SLD in Geoserver.  However, this is not getting displayed in Openscales using WFS.

Is there any other way?

nanda kishor

unread,
Apr 11, 2012, 10:05:59 AM4/11/12
to opensca...@googlegroups.com
Thanks Namrata.  Now there is no error.  

My function is as follows:

function imgStyle():Style{
[Embed (source = "../src/assets/Clear.png")]
const imgData:Class;
var mark:DisplayObjectMarker = new DisplayObjectMarker(imgData);
var symbolizer:PointSymbolizer = new PointSymbolizer(mark);
var style:Style = new Style();
var rule:Rule = new Rule();
rule.symbolizers.push(symbolizer);
style.rules.push(rule);
return style;


And mxml code is as follows:

                                 <os:WFS name="AWSPOINTS" 
typename="Finalv1:test" 
projection="EPSG:4326" 
version="1.0.0" 
useCapabilities="true" 
capabilitiesVersion="1.0.0"
style="{this.imgStyle()}" >
</os:WFS>

Though there are no errors, the map is not getting displayed.  Can you please help.

Best Regards

Nanda Kishor.

WillPetty

unread,
Apr 11, 2012, 10:14:46 AM4/11/12
to opensca...@googlegroups.com

I normally add my layers in AS not MXML, but you don't need the "?request=GetMap" in the url do you?

-Will

nanda kishor

unread,
Apr 12, 2012, 3:00:36 AM4/12/12
to opensca...@googlegroups.com
I am very new for Flex and OpenScales so i started with mxml not with AS..

Without using the "?request=GetMap" in the url, the map are displaying, its fine..

-Munna

On Wed, Apr 11, 2012 at 7:44 PM, WillPetty <willpe...@gmail.com> wrote:

I normally add my layers in AS not MXML, but you don't need the "?request=GetMap" in the url do you?

-Will

--
You received this message because you are subscribed to the Google Groups "openscales-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openscales-dev/-/7OVsuV1-cNMJ.

nanda kishor

unread,
Apr 19, 2012, 7:28:07 AM4/19/12
to opensca...@googlegroups.com
@Will,
 
Is it possible to change the shape of the points in the WFS layer, I want to display the points as the circle.

thanks in advance..

--munna

On Wed, Apr 11, 2012 at 7:44 PM, WillPetty <willpe...@gmail.com> wrote:

I normally add my layers in AS not MXML, but you don't need the "?request=GetMap" in the url do you?

-Will

--
You received this message because you are subscribed to the Google Groups "openscales-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openscales-dev/-/7OVsuV1-cNMJ.

WillPetty

unread,
Apr 19, 2012, 12:18:40 PM4/19/12
to opensca...@googlegroups.com
yes, you can shape a point feature how ever you want. you can do this either on the back end ( if your using something like geoServer) with a sld style, or with openscales styles.
 
there are default styles.. here is an example of creating a style of a orange circle..

                      var fill:SolidFill = new SolidFill(0xFF6600);
                var stroke:Stroke = new Stroke(0x000000);
                var mark:WellKnownMarker = new
                    WellKnownMarker(WellKnownMarker.WKN_CIRCLE, fill, stroke);
                var symbolizer:PointSymbolizer = new PointSymbolizer();
                symbolizer.graphic = mark;

                var rule:Rule = new Rule();
                rule.name = "Default rule";
                rule.symbolizers.push(symbolizer);
                var style1:Style = new Style();
                style1.name = "Default Orange circle style";
                style1.rules.push(rule);

and then you should be able to just say something like:

                                 layer.style = style1;

Hope that helps, Will



On Thursday, April 19, 2012 7:28:07 AM UTC-4, Munna wrote:
@Will,
 
Is it possible to change the shape of the points in the WFS layer, I want to display the points as the circle.

thanks in advance..

--munna
On Wed, Apr 11, 2012 at 7:44 PM, WillPetty <willpe...@gmail.com> wrote:

I normally add my layers in AS not MXML, but you don't need the "?request=GetMap" in the url do you?

-Will

--
You received this message because you are subscribed to the Google Groups "openscales-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openscales-dev/-/7OVsuV1-cNMJ.

To post to this group, send email to openscales-dev@googlegroups.com.
To unsubscribe from this group, send email to openscales-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages