Geoserver point symbology with jpg, gif or png, not display in openlayer - svg

I would like to update graphic symbolize in geoserver style from svg to png, gif or jpg. However, the symbol doesn't display when I view in openlayer. Svg symbol works fine.
Here is my code:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
<NamedLayer>
<se:Name>map_seed_source_site </se:Name>
<UserStyle>
<se:Name>map_seed_source_site </se:Name>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Single symbol </se:Name>
<se:PointSymbolizer>
<se:Graphic>
<se:ExternalGraphic>
<se:OnlineResource xlink:type="simple" xlink:href="http://www.opendevelopmentcambodia.net/wp-content/themes/opendata/images/seed-sources-legend.gif" />
<se:Format>image/gif</se:Format>
</se:ExternalGraphic>
<se:Size>100 </se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

When you tried, have you also changed this line?
from
<se:Format>image/gif</se:Format>
to
<se:Format>image/png</se:Format>
I'm also not sure if you can use <size> tag with non-vector graphic files. So try to change the gif to PNG and also to remove the size. The SLD will use the original size of the PNG. I'm not 100% sure it helps but it is worth a try...

Related

Create kml file to display al bitmap vertically in Google Earth

I have seen examples where it is possible to display a bitmap as a vertical profile in Google Earth. Like this:
However, I have not been able to find any kml/kmz examples of this. Does anyone have a simple example of how to do this?
Does it include using the dae (collada) file format too?
One method to do this would be to use a KML "Photo Overlay". They are designed to place landscape photographs vertically in the world, so that they can be viewed with the Earth terrain & imagery as matching background. You could use that technique to place images like these on vertical planes. There is a basic tool in Earth Pro to create Photo Overlays (Add menu >> Photo). Or you can create them manually or programmatically by writing the appropriate KML (reference links below), though it can get pretty complex with all the placement and field of view parameters. Also note that Photo Overlays work in Earth Pro (Earth v7.x), but do not currently work in Earth for web & mobile (Earth v9.x).
You could also do this using 3D models (yes, collada based) where you have a model representing your vertical plane(s), and the images as textures on the models. 3D models also only work in Earth Pro at this time. Which technique is easier will depend on the tools and skills you have available.
https://developers.google.com/kml/documentation/photos
https://developers.google.com/kml/documentation/kmlreference#photooverlay
My PhotoOverlay example is just here.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document id="7">
<visibility>0</visibility>
<PhotoOverlay id="8">
<name>PhotoOverlay Test</name>
<visibility>0</visibility>
<Camera>
<longitude>-122.3599987260313</longitude>
<latitude>47.62949781133496</latitude>
<altitude>100</altitude>
<heading>-90</heading>
<tilt>90</tilt>
<roll>0</roll>
</Camera>
<Icon id="10">
<href>foo.png</href>
</Icon>
<ViewVolume>
<leftFov>-45</leftFov>
<rightFov>45</rightFov>
<bottomFov>-45</bottomFov>
<topFov>45</topFov>
<near>20000</near>
</ViewVolume>
</PhotoOverlay>
</Document>
</kml>
My kml example using collada is here.
You have to prepare your_prepared_square.dae and your_prepared.png in same folder. The square size is 1m x 1m. This model is scaling base.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document id="1">
<Placemark id="2">
<name>My billboard</name>
<Model id="3">
<altitudeMode>absolute</altitudeMode>
<Location>
<longitude>140.037</longitude>
<latitude>36.84895</latitude>
<altitude>500</altitude>
</Location>
<Orientation>
<heading>90</heading>
<tilt>0</tilt>
<roll>0</roll>
</Orientation>
<Scale>
<x>1</x>
<y>10000</y>
<z>3500</z>
</Scale>
<Link id="4">
<href>your_prepared_square.dae</href>
</Link>
<ResourceMap>
<Alias>
<targetHref>your_prepared.png</targetHref>
<sourceHref>mapping.png</sourceHref>
</Alias>
</ResourceMap>
</Model>
</Placemark>
</Document>
</kml>
And mapping.png is texture filename in the collada model. This has
to be defined in the model. following fragment is a part of your_prepared_square.dae. But you don't need to prepare mapping.png. KML replaces it to your_prepared.png.
:
:
<library_images>
<image id="texture" name="texture">
<init_from>mapping.png</init_from>
</image>
</library_images>
:
:
folllowing image is applied this method.

Problem with style validation in geoserver

Try to set a style in geoserver styles editor.
but the validation fails
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/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>capitals</Name>
<UserStyle>
<Name>fix_histogram</Name>
<Title>Fix Histogram</Title>
<FeatureTypeStyle>
<Rule>
<Title>Capitals</Title>
<RasterSymbolizer>
<ContrastEnhancement>
<Normalize>
<VendorOption name="algorithm">StretchToMinimumMaximum</VendorOption>
<VendorOption name="minValue">50</VendorOption>
<VendorOption name="maxValue">100</VendorOption>
</Normalize>
</ContrastEnhancement>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
line 19: cvc-complex-type.2.1: Element 'Normalize' must have no character or element information item [children], because the type's content type is empty.
but this code was taken from the example for RasterSymbolizer:
https://docs.geoserver.org/latest/en/user/styling/sld/reference/rastersymbolizer.html
Thanks,
It is possible that the schema that the editor is using has not been updated to recognise the vendor options you are using.
Does the style work if you apply it?

default circle ProgressBar thickness etc

I have the default circle ProgressBar:
https://i.stack.imgur.com/DlYL4.png
I would like to change the thickness, color and the corner radius (in an XML) Already, found some examples, but they don't work with the default circle.
Thank you very much!
Create an xml file in drawable folder.
Drawable XML file
progress_bar_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="360">
<shape
android:shape="ring"
android:thickness="2dp"
android:useLevel="false">
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#ff00ff"
android:endColor="#00ffffff"
android:angle="0"/>
</shape>
</rotate>
Start color and end Color of gradient you should change according to your need.
To change the thickness of progress bar you change the thickness using android:thickness attribute of shape.
And add code to your layout xml file.
<ProgressBar
android:id="#+id/progress_bar"
android:layout_width="30dp"
android:layout_height="30dp"
android:indeterminateDrawable="#drawable/progress_bar_bg" />
android:layout_width and android:layout_height should be change according to your need.
I hope its Work for you.

ImageMagick/Convert - SVG opacity not taken into account

I want to convert the SVG file below with ImageMagick's convert to an PNG file. Unfortunately I can't figure out how to call convert so that the opacity value of the rectangle is taken into account. When I open the svg with inkscape and save it as png the opacity value is used so I assume the svg file is correct. (The reason I want to use "convert" is that inkscape is not installed on the server I am using) I use convert right now in the most simple way, any additional parameters I tried did not have any positive effect (convert first time user...)
convert test-alpha.svg test-alpha.png
Thanks buddies
martin
UPDATE: tested on OSX Mountain Lion, ImageMagick 6.8.8-3 Q16 x86_64 2014-02-19 (installed via mac ports)
UPDATE2: Just tried it on a linux machine and, as nwellnhof already commented, it does it correct there. So it seems a particular OSX related problem
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" id="qi-svg" class="quote-image" width="640" height="480" style="width: 640px; height: 480px;">
<rect id="background" width="150" height="300" style="opacity: 1;fill: #aa0000" transform="translate(200,0)" />
<rect id="background" width="150" height="300" style="opacity: 0.1;fill: #aa0000" />
</svg>
1) correct png via inkscape
2) png via convert
I reinstalled ImageMagick on OSX with the following ports command
sudo port install imagemagick +rsvg
and it works now, the +rsvg made the trick.

SVG xml:base attribute not working in IE9

I'm trying to create an SVG document that includes image tags referencing png files. This works if I include the absolute path of the png in every image tag but if I try putting an xml:base attribute in it doesn't seem to work in IE9. However it does seem to work Firefox and Chrome. Is there a bug in IE or is there something wrong with my syntax?
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:base="file:///C:/SVG/Devices/valves/">
<image width="40" height="56" x="10" y="10" xlink:href="motorised_valve[purple].gif"/>
</svg>
For complicated reasons I don't want to go into here, I can't put the SVG document into the same folder as the images.
Thanks for any help
Mog
Would it be acceptable in your case to embed your PNG images in your document using the data:// protocol? That would solve your problem, at the expense of potentially making the XML rather large.

Resources