2

I'm looking for the guide to draw the arrow at end of line in geoserver.

So follow this thread (How do I draw the arrow on the line using SLD of Geoserver?), I've made it work with the shapefile.

However, with my data source is from Mongodb, the arrow did not appear. Here the sample of my Mongodb record.

{
"_id" : "Y6z5zsA6RF8Wpoocu",
"name" : "-1",
"description" : "",
"geometry" : {
    "type" : "LineString",
    "coordinates" : [ 
        [ 
            103.0102419455, 
            21.378932367
        ], 
        [ 
            103.0102432625, 
            21.3789060899
        ], 
        [ 
            103.0102144437, 
            21.3788595105
        ]
    ]
    },
}

If I choose generic style, the layer preview display ok. But when I change to the arrow style, the layer preview not work at all. So I added the "properties" : { "the_geom" : "" }, "the_geom" : "" to make sure this part work, then the line appear again but without the arrow

<ogc:Function name="endPoint">
<ogc:PropertyName>the_geom</ogc:PropertyName>
</ogc:Function>

It's seem that the < ogc:Function name="endPoint" > is not work with MongoDB source. When I remove that part the arrow appear but in the middle of the line.

How should I config with my data?

  • your geometry is called geometry not the_geom – Ian Turton Feb 6 '18 at 8:28
0

In your SLD you have asked GeoServer to find the endpoint of an attribute/property called the_geom (the default geometry name in a Shapefile), but in your MongoDB you have called your geometry element geometry so that nothing is found and the function (endPoint) returns a null geometry and thus nothing is drawn.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.