Using Natural Earth Cultural and Physical Data in Geoserver
Home › Forums › Advice & Tutorials › Software & Services › Using Natural Earth Cultural and Physical Data in Geoserver
Tagged: Cultural, Earthatlas, Ext JS, GeoExt, Geoserver, Howto, Natural Earth, physical, SLD, Styled Layer Descriptor
- This topic has 6 replies, 1 voice, and was last updated 13 years, 8 months ago by chiragmo.
-
AuthorPosts
-
February 15, 2011 at 11:06 pm #3431
wlernerParticipantI am attempting to use the Natural Earth cultural and physical data with GeoServer. Importing the data to GeoServer is not difficult. However, the data does not appear to be displaying correctly. For example, when I attempt to add the 10m_populated_places layer, the layer displays small, red boxes. This is not the desired behavior. I would like to see a small dot, with the name of the city above the dot.
Does this require modification of the styled layer descriptor (SLD) file? I am unsure how to proceed, so any advice or assistance would be appreciated.
Thank you.
February 15, 2011 at 11:08 pm #4152
chiragmoParticipantI am on a similar issue myself…i got the same results with that map as well. Im using GeoServer also.
February 15, 2011 at 11:11 pm #4153
wlernerParticipantYou may want to take a look at this link:
http://earthatlas.info/naturalearth/
The website here has the desired effect I think we are both looking for. I have contacted to website author, so any advice he offers I will repost here. Please let me know if you discover anything in the mean time.
February 16, 2011 at 12:11 am #4154
chiragmoParticipantThanks, i’ll post what i find out as well.
February 21, 2011 at 10:24 pm #4155
wlernerParticipantI have discovered that you must edit the styled layer descriptor (SLD) or make a new one in order for the data to be shown correctly. A good resource for this is the SLD Cookbook, written by the GeoServer folks. This book contains some wonderful examples that I used to get the data to display correctly.
If you use GeoServer and examine the layer, you can see that there is a fair amount of data attached to the 10m_populated_places layer, which allows you to display all sorts of data.
It would be most helpful if people would post their SLD files regarding the Natural Earth data, both cultural and physical.
February 21, 2011 at 11:35 pm #4156
wlernerParticipantTo place black points with location names above the points, you could use the following in your SLD:
<FeatureTypeStyle>
<Rule>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
</Mark>
<Size>4</Size>
</Graphic>
</PointSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>Name</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-size">4</CssParameter>
<CssParameter name="font-style">normal</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.0</AnchorPointY>
</AnchorPoint>
<Displacement>
<DisplacementX>0</DisplacementX>
<DisplacementY>5</DisplacementY>
</Displacement>
</PointPlacement>
</LabelPlacement>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>For this to work with Natural Earth data, note the following line:
<ogc:PropertyName>Name</ogc:PropertyName>
The property “Name” must be exactly as shown. This is because the “Name” property is what is actually called from the map layer to display the name.
Please understand that this is not the complete file! Do not cut and paste this. In order for this to work, one also needs the headers, which you can find in any of the GeoServer sample styles built in to the software.
I hope this was helpful.
Warren
February 23, 2011 at 8:27 pm #4157
chiragmoParticipantThanks, i just discovered this as well while trying to figure out how to change the color of the ocean in some of my maps from gray to it’s blue-ish shade. Also keep in mind for some of these maps…mostly all i believe, the default style is polygon..therefore when you want to create the labels for the countries, you will need to state the polygon symbolizer tag in your sld. The example above is for a point symbolizer…Here is an example to get the labels working with GEOSERVER and natural earth maps using the SLD(from geoserver’s SLD cookbook):
“
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<StyledLayerDescriptor version=”1.0.0″
xsi:schemaLocation=”http://www.opengis.net/sld StyledLayerDescriptor.xsd”
xmlns=”http://www.opengis.net/sld”
xmlns:ogc=”http://www.opengis.net/ogc”
xmlns:xlink=”http://www.w3.org/1999/xlink”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<NamedLayer>
<Name>Polygon with default label</Name>
<UserStyle>
<Title>SLD Cook Book: Polygon with default label</Title>
<FeatureTypeStyle>
<Rule>
<PolygonSymbolizer>
<Fill>
<CssParameter name=”fill”>#40FF40</CssParameter>
</Fill>
<Stroke>
<CssParameter name=”stroke”>#FFFFFF</CssParameter>
<CssParameter name=”stroke-width”>2</CssParameter>
</Stroke>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>name</ogc:PropertyName>
</Label>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
“
Also if you need to reference the data from these shape files and if your using OPENLAYERS, you can reference it through the getfeatureinfo method (which is a openlayers method).
-
AuthorPosts
You must be logged in to reply to this topic.