Styling polygon dash-dot borders in GeoServer using SLD - border

I want to draw polygon borders using a pattern of dashes and other symbols like triangles or circles but most polygons share borders so I get an undesired result.
Using this SLD code:
<se:PolygonSymbolizer>
<se:Fill>
<se:SvgParameter name="fill">#cf72be</se:SvgParameter>
</se:Fill>
</se:PolygonSymbolizer>
<se:LineSymbolizer>
<se:Stroke>
<se:GraphicStroke>
<se:Graphic>
<se:Mark>
<se:WellKnownName>circle</se:WellKnownName>
<se:Fill>
<se:SvgParameter name="fill">#333333</se:SvgParameter>
</se:Fill>
</se:Mark>
<se:Size>6</se:Size>
</se:Graphic>
</se:GraphicStroke>
<se:SvgParameter name="stroke-dasharray">6 18</se:SvgParameter>
</se:Stroke>
</se:LineSymbolizer>
<se:LineSymbolizer>
<se:Stroke>
<se:SvgParameter name="stroke">#AA0000</se:SvgParameter>
<se:SvgParameter name="stroke-dasharray">10 14</se:SvgParameter>
<se:SvgParameter name="stroke-dashoffset">14</se:SvgParameter>
</se:Stroke>
</se:LineSymbolizer>
I get this result in GeoServer:
Is there any way to avoid having two overlapping border lines or to make symbols perfectly overlap?

Related

adding a legend outside of barchart

I created a side by side barchart using this this code
IT=c(0.588, 0.765)
DE=c(0.214, 0.63)
FR=c(0.37, 0.73)
PL=c(0.692,0.793)
GB=c(0.381, 0.757)
NL=c(0.227, 0.62)
GR=c(0.692, 0.902)
HU=c(0.706, 0.698)
SE=c(0.143, 0.493)
# combine two vectors using cbind
# function
CountryChart=cbind(IT,DE,FR,PL,UK,NL,GR,HU,SE)
barplot(CountryChart,beside=T, ylim =c(0,1), )
and I got this graph
I need to add a legend to the graph but I am unable to do it.
What I would like to do is add the following title to the entire graph 'Percentage of ERWP supporters and opposers per country, who rate the refugee issue as a major threat'
I also want add a description for the bars, with a title 'Opinion on ERWP' where I specify that the dark grey bars are 'unfavorable' and light grey bars are 'favorable'
For example:
legend("topright" , legend=c("Unfavorable","Favorable"), title="Opinion on ERWP")

MySQL ST_CONTAINS on Overlap case

I'm facing a problem using the ST_CONTAINS geospatial function on MySQL 5.6.31.
I've the following MULTIPOLYGON:
I need to check if some point is inside a MULTIPOLYGON, in this case the red one on the image, so i do:
SET #g1 = ST_GEOMFROMTEXT('MULTIPOLYGON(((41.94142040508967 12.41757292797851,41.94442097040815 12.419032049682611,41.93529115206086 12.43456740429687,41.91939065648979 12.425126028564447,41.92475512204906 12.407702398803705,41.94142040508967 12.41757292797851),(41.92552143745503 12.409933996704096,41.90987400689221 12.402638388183588,41.90252797153794 12.421864462402338,41.907446714803015 12.433194113281244,41.92603230927889 12.419461203124994,41.92552143745503 12.409933996704096,41.92552143745503 12.409933996704096),(41.906248516384416 12.397567221513638,41.89551602293968 12.423402258745083,41.90101026279693 12.430268713823208,41.90771770545893 12.420398184648404,41.91033661082307 12.39653725325192,41.906248516384416 12.397567221513599,41.906248516384416 12.397567221513599,41.906248516384416 12.397567221513638,41.906248516384416 12.39756722151363,41.906248516384416 12.39756722151363,41.906248516384416 12.39756722151363,41.906248516384416 12.39756722151363,41.906248516384416 12.39756722151363,41.906248516384416 12.39756722151363,41.906248516384416 12.39756722151363,41.906248516384416 12.39756722151363,41.906248516384416 12.39756722151363,41.906248516384416 12.397567221513638)))');
SET #g2 = POINT(41.9059998,12.4159939);
SELECT ST_CONTAINS(#g1,#g2);
The result is 0.
If i change the point, specifying for example a point in the upper polygon, i got 1.
Why this behaviour? It seems that when two polygons overlaps the ST_CONTAINS see it as en empty part of them.
What can i do?
Thanks to all!
That's a weird (not standard compliant and probably invalid) multipolygon.
Multipolygon is described as something like:
MULTIPOLYGON(((p1_shell), (p1_hole1), (p1_hole2)), ((p2_shell), (p2_hole1), (p2_hole2)))
I.e. polygons are separated by double round brackets, and polygon shell is separated from holes by single round brackets. In your case it is single brackets - so this WKT describes a single polygon with two holes! Note that it is not a valid one (you can call ST_IsValid to check) - the hole is not fully contained within the shell as required by standard But anyway MySql allows this, and since the red point is within hole, it is not contained by the shape, so MySql result is correct.
If the desired semantic of the shape is a multipolygon, not polygon with holes, replace ),( with )),(( to get that semantics. Note that this is still not valid WKT shape - individual polygons in a multipolygon are not allowed to intersect (again check with ST_IsValid). But it should give you correct result anyway (although, being non-standard, this is somewhat undefined behavior).
If you want to be standard-compliant, you should clean this WKT. What you do depends on semantics you need. Maybe ST_UNION these polygons and get a single one. Or to keep all three - the correct way to describe a shape consisting of possibly intersecting polygons is GEOMETRYCOLLECTION with polygons as members.

Hover on <p> element to highlight geographic boundary, D3 Choropleth

I made a choropleth map of Chicago's 77 neighborhoods in D3.
The only challenge is, it's hard to know which neighborhood is which.
So, what I did was make divs with p elements (containing the neighborhood names) in the body of my HTML file and positioned them into a blank spot in my svg/canvas.
See a visual here.
What I'm trying to do is make it so when you hover over the name, the geographic boundary of the neighborhood highlights. Somehow I need to relate the geography to the text, but I have no idea how.
For a more robust solution, you would ideally want to add an id field to your data. This assumes that your data is some format (such as JSON). You may already have a unique identifier that you can use instead, but if not the following should work.
var i = 0;
for (var x in dataSet)
dataSet[x].id = ++i; //Or i++ for zero-based indexing
Now it depends on how you are generating the svg elements, but ideally you are using the enter function of d3. In that case, just create the result of enter as a variable and use it to append both the path (map portion) as well as the text.
var dataSelect = svg.selectAll(".item").data(data.items);
var dataEnter = dataSelect.enter();
dataEnter.append("path").....
dataEnter.append("text").....text(function(d){return d.label;}) //Using text because this is drawn inside the SVG.
With using the data and enter functions, the created objects automatically have the id data bound to them.
This makes it a simple case of text.id == path.id in your mouseover function.
svg.selectAll(".itemText").on("mouseover", function(textItem){
svg.selectAll(".item").each(function (cityItem){
if (cityItem.id == textItem.id)
d3.select(this).style("fill", "green");
else
d3.select(this).style("fill", function(d){return d.color;});
})
});
I've done this in a fiddle which you can see here
Note that this does not use p elements because ideally, if you're using SVG then you probably should use text elements. If you have to use p elements, then you can still use this general technique, but instead using p.text() as the matching factor on mouseover instead of id, assuming that the name is bound to your path data somewhere.

SSRS chart lines not connecting

I have an SSRS Line chart which plots supply points with square feet on the X axis and Price on the Y axis. Right now I don't really care about making it pretty just getting the lines to show up correctly. I am plotting the points and grouping by Subdivision/Builder.
So for example Subdivision A has builders Y and Z. I want to show different colors and lines for Subdivision A builder Y verses Subdivision A Builder Z.
The problem is that the lines are not connecting when a point for another subdivision builder combination breaks up that line.
The grey line and points below are not all connected as the yellow point is between the grey points so the grey line is not connected to all grey points.
How can I make the points of the same color (same Subdivision/Builder) connected via a line?
As I found out the hard way recently, this problem is often caused by null values in the data not being properly handled by SSRS. Without seeing your data, I can't be certain that's the cause, but nulls were the culprit I encountered the same behavior.
The solutions usually involve assigning values to the color of the EmptyPoint property on the Series, sometimes in conjunction with setting the EmptyPointValue to specify null handling. I've found many references to this problem on the web, but I'll only post links to the best two, both of which are on StackExchange:
The thread SSRS Line Chart NULL VALUE - Horizontal Line contains a thorough discussion of this issue. The usual workaround given is to hard-code a color expression for each line using an IIf, but sometimes this isn't an option, especially if the field you're grouping on has dynamic, unpredictable values, as my dataset did.
The picture posted there depicts clear examples of the same type of line breaks. The user named trubs posted a code sample which illustrates how to set the EmptyPoint, in case where an Iif will work:
=iif(isNothing(Fields!SelectedValue.Value),'No Color',"LightBlue")
The first reply in SSRS Line Chart Not Connecting Data Points details a workaround for cases when the EmptyPoint value & nulls are the root cause and simple hard-coded IIfs won't do the trick. Although I have yet to get my line colors to match the point markers the way I'd like, I can verify that this solution at least gives you your lines back and allows you to assign a variety of colors to them. It's fairly simple and involves merely pasting in some VB code for a couple color properties.
I was asked in the comments section to provide the details of the solutions, but don't want to plagiarize, so I'll simply do a long direct quote of JohnBob's answer:
Firstly, in order to get the lines to join up, you need to set the
EmptyPoint colour for the series.
Select your series in your chart In the properties tab (not the
dialog) drill down into the EmptyPoint property and set the colour to
be Black
This will get them joining up - yay! But part of the line is colour
and the other part is black, right? That's a bit silly, especially
considering if you leave the colour to Automatic on the EmptyPoint
that it will be transparent.
So, then we need to get the series and the EmptyPoint's colours in
sync. Using code from here. I added some code to the code of the
report.
1). Right click on an empty space on the report and select "Report
Properties" 2). In the code tab, paste the following:
Private colorPalette As String() = {"#418CF0", "#FCB441", "#E0400A", "#05642E", "#1A3B69", "#BFBFBF", "#E0400A", "#FCB441", "DarkBlue", "Tomato", "Orange", "CornflowerBlue", "Gold", "Red", "Green", "LightBlue", "Lime", "Maroon", "LightSteelBlue", "Tan", "Silver"}
Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
Then we need to call this code when setting the colour of the series
and of the EmptyPoint.
Select your series
In the properties tab paste something the following (replace WhateverTheGroupIsForYourSeries with your series group name):
=Code.GetColor(Fields!*WhateverTheGroupIsForYourSeries*.Value)
Drill down to the color element of the EmptyPoint Series property
Paste the same text as from point two [e.g. =Code.GetColor(Fields!*WhateverTheGroupIsForYourSeries*.Value)]
And voila! You're done! I can't believe how unnecessarily difficult
this is :D
I hope this helps.
Just put your Fields!(YourSeriesGroup).Value in Series Groups to above of
Fields!(YourCategoryGroup).Value in Category Groups, your series group should be in both Series Groups and Category Groups (should be above of your initial category group).
And after that right click horizontal axis and select Horizontal Axis Properties. Set Axis Type to Scalar and click OK.

Show a threshold line in Flex Chart

I am stuck with a requirement to display a horizontal line on a ColumnChart to indicate a threshold level. I have the data to the Chart as an ArrayCollection.
So my question here : Is it possible to get the location of a value that is shown on the y axis? I think I will be able to place a line or 1px high canvas on top of the Chart to achieve this. Or better, is there any built in functionality that i may have overlooked or is there some open library that can achieve something like this?
The easiest solution is to add a LineSeries to your chart which has the same value on the Y-axis for each item on the X-axis.
Your dataprovider could be produced as follows, with the column chart using "result" for its yField and the line chart using "threshold" as its yField.
<dataset>
<dataitem>
<time>16:00</time>
<result>170</result>
<threshold>350</threshold>
</dataitem>
<dataitem>
<time>17:00</time>
<result>430</result>
<threshold>350</threshold>
</dataitem>
<dataitem>
<time>18:00</time>
<result>250</result>
<threshold>350</threshold>
</dataitem>
</dataset>