-3

When I load the feature source and style in the map layer it does not always display.

The feature and style were loaded in mapcontent: (http://tva1.sinaimg.cn/large/007X8olVly1g6s6dbbhqdj30w00i0ta5.jpg )

featuresfeatures: (http://tva1.sinaimg.cn/large/007X8olVly1g6s6ejjsnwj30wz0kgab0.jpg )

features in database:

WIDTH_LEFT  LINE_STYLE                       WKT
N   NormalRoute LINESTRING(82.3308944444444 44.89158888888889,82.89986111111108 44.59994444444439)
N   NormalRoute LINESTRING(82.3308944444444 44.89158888888889,81.32899999999999 43.9581388888889)
N   NormalRoute LINESTRING(120.1201694444439 47.363625,120.4744444444439 47.7275)
N   NormalRoute LINESTRING(120.1201694444439 47.363625,120.706388888889 47.1844444444444)
N   NormalRoute LINESTRING(89.12944444444439 43.03111111111109,89.39305555555559 43.55777777777779)
N   NormalRoute LINESTRING(89.39305555555559 43.55777777777779,89.5169444444444 43.8041666666667)
N   NormalRoute LINESTRING(89.5169444444444 43.8041666666667,89.60913888888891 43.98631944444439)
N   NormalRoute LINESTRING(120.2911666666669 35.97711111111109,120.248611111111 36.2975)
N   NormalRoute LINESTRING(120.248611111111 36.2975,120.3788888888889 36.5316666666667)
N   NormalRoute LINESTRING(120.0086111111109 37.13499999999999,120.445555555556 36.98333333333329)
N   NormalRoute LINESTRING(120.3683972222219 36.2873138888889,120.4955555555559 36.38)
N   NormalRoute LINESTRING(120.4805555555559 36.1166666666667,120.2911666666669 35.97711111111109)
N   NormalRoute LINESTRING(102.324019444444 38.55711111111109,103.3783333333329 38.41166666666669)
Y   NormalRoute LINESTRING(112.955 17.85833333333329,112.283333333333 17)
Y   NormalRoute LINESTRING(112.283333333333 17,111.05 15.3583333333333)
Y   NormalRoute LINESTRING(100.9649999999999 22.7183333333333,100.555833333333 24.12194444444439)
Y   NormalRoute LINESTRING(100.555833333333 24.12194444444439,100.283333333333 25.045)
Y   NormalRoute LINESTRING(100.283333333333 25.045,100.255833333333 25.13833333333329)
Y   NormalRoute LINESTRING(100.255833333333 25.13833333333329,100 26)
Y   NormalRoute LINESTRING(100 26,100 27.94888888888889)
Y   NormalRoute LINESTRING(100 27.94888888888889,100 30.28055555555559)
Y   NormalRoute LINESTRING(100 30.28055555555559,100 30.92888888888889)
Y   NormalRoute LINESTRING(100 30.92888888888889,100 32)
Y   NormalRoute LINESTRING(100 32,99 32.6016666666667)
Y   NormalRoute LINESTRING(99 32.6016666666667,97.71833333333329 33.37666666666669)
Y   NormalRoute LINESTRING(97.71833333333329 33.37666666666669,96.5 34.1083333333333)
Y   NormalRoute LINESTRING(96.5 34.1083333333333,94.20305555555559 35.45083333333329)

feature Type:

SimpleFeatureType createFeatureType(String typeName, Class type) {
    SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
    builder.setName(typeName);
    builder.setCRS(DefaultGeographicCRS.WGS84);
    builder.add("the_geom", type);
    builder.add("CODE_ID",String.class);
    builder.add("WIDTH_LEFT",String.class);
    builder.add("LINE_STYLE",String.class);


    final SimpleFeatureType TYPE = builder.buildFeatureType();
    return TYPE;
}

the whole .sld file:

<?xml version="1.0" encoding="UTF-8"?>

<sld:UserStyle xmlns:sld="http://www.opengis.net/sld" xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">
  <sld:Name>Default Styler</sld:Name>
  <sld:FeatureTypeStyle>
    <sld:Name>name</sld:Name>
    <sld:Rule>
      <sld:Name>WidthWay</sld:Name>
      <ogc:Filter>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>WIDTH_LEFT</ogc:PropertyName>
          <ogc:Literal>Y</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>
      <sld:MaxScaleDenominator>1000000.0</sld:MaxScaleDenominator>
      <sld:LineSymbolizer>
        <sld:Stroke>
          <sld:CssParameter name="stroke">#A8A8A8</sld:CssParameter>
          <sld:CssParameter name="stroke-linecap">round</sld:CssParameter>
          <sld:CssParameter name="stroke-opacity">0.5</sld:CssParameter>
          <sld:CssParameter name="stroke-width">12</sld:CssParameter>
        </sld:Stroke>
      </sld:LineSymbolizer>
    </sld:Rule>
    <sld:Rule>
      <sld:Name>NomalWay</sld:Name>
      <ogc:Filter>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>LINE_STYLE</ogc:PropertyName>
          <ogc:Literal>NormalRoute</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>
      <sld:MaxScaleDenominator>1000000.0</sld:MaxScaleDenominator>
      <sld:LineSymbolizer>
        <sld:Stroke>
          <sld:CssParameter name="stroke">#001b55</sld:CssParameter>
          <sld:CssParameter name="stroke-linecap">round</sld:CssParameter>
          <sld:CssParameter name="stroke-opacity">0.6</sld:CssParameter>
          <sld:CssParameter name="stroke-width">2</sld:CssParameter>
        </sld:Stroke>
      </sld:LineSymbolizer>
    </sld:Rule>
    <sld:Rule>
      <sld:Name>FansWay</sld:Name>
      <ogc:Filter>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>LINE_STYLE</ogc:PropertyName>
          <ogc:Literal>FansRoute</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>
      <sld:MaxScaleDenominator>1000000.0</sld:MaxScaleDenominator>
      <sld:LineSymbolizer>
        <sld:Stroke>
          <sld:CssParameter name="stroke">#001b55</sld:CssParameter>
          <sld:CssParameter name="stroke-linecap">round</sld:CssParameter>
          <sld:CssParameter name="stroke-opacity">0.6</sld:CssParameter>
          <sld:CssParameter name="stroke-width">2</sld:CssParameter>
          <sld:CssParameter name="stroke-dasharray">15.0 8.0</sld:CssParameter>
        </sld:Stroke>
      </sld:LineSymbolizer>
    </sld:Rule>
    <sld:Rule>
      <sld:Name>VisualFlightWay</sld:Name>
      <ogc:Filter>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>LINE_STYLE</ogc:PropertyName>
          <ogc:Literal>VisualFlightRoute</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>
      <sld:MaxScaleDenominator>1000000.0</sld:MaxScaleDenominator>
      <sld:LineSymbolizer>
        <sld:Stroke>
          <sld:GraphicStroke>
            <sld:Graphic>
              <sld:Mark>
                <sld:WellKnownName>circle</sld:WellKnownName>
                <sld:Fill>
                  <sld:CssParameter name="fill">#001b55</sld:CssParameter>
                </sld:Fill>
                <sld:Stroke>
                  <sld:CssParameter name="stroke">#001b55</sld:CssParameter>
                  <sld:CssParameter name="stroke-linecap">round</sld:CssParameter>
                  <sld:CssParameter name="stroke-opacity">0.6</sld:CssParameter>
                  <sld:CssParameter name="stroke-width">2</sld:CssParameter>
                </sld:Stroke>
              </sld:Mark>
              <sld:Size>2</sld:Size>
            </sld:Graphic>
          </sld:GraphicStroke>
          <sld:CssParameter name="stroke">#001b55</sld:CssParameter>
          <sld:CssParameter name="stroke-linecap">round</sld:CssParameter>
          <sld:CssParameter name="stroke-opacity">0.6</sld:CssParameter>
          <sld:CssParameter name="stroke-width">2</sld:CssParameter>
          <sld:CssParameter name="stroke-dasharray">2.0 8.0</sld:CssParameter>
        </sld:Stroke>
      </sld:LineSymbolizer>
    </sld:Rule>
  </sld:FeatureTypeStyle>
</sld:UserStyle>
leomessi
  • 69
  • 6
  • please ! if any trouble in my problem,just point out... – leomessi Sep 08 '19 at 08:26
  • We need to see the content of some of your features and the whole of the SLD, the other code is irrelevant - though you should probably use a DataStore not an SQL query. – Ian Turton Sep 08 '19 at 09:33

1 Answers1

0

If anyone has the same confusion that you have loaded the style and featuresource in the map layer,but it not display,maybe you should adjustment the MaxScaleDenominator or MinScaleDenominator in .sld file. It's a amusing question,but it cost my 1 week and 6 reputations.

leomessi
  • 69
  • 6