Include images in CSV/KML file - csv

I'm working with OpenLayers 3 and I want to include images in KML file in order to show them inside the point on the map.
I created this csv file:
I converted it to KML file using https://batchgeo.com
The structure of the KML file:
<kml xmlns='http://www.opengis.net/kml/2.2'>
<Document>
<name>Logos2</name><Placemark>
<styleUrl>#0</styleUrl>
<name>A</name>
<ExtendedData>
<Data name='logo'>
<value>logos/a.png</value>
</Data>
</ExtendedData>
<address></address>
<Point>
<coordinates>44.72,14.78,0</coordinates>
</Point>
</Placemark>
<Placemark>
.
.
.
in code:
electedTextStyleFunction(feature.get('value'))
If I replaced 'value' with 'name', it shows successfully on each point. but when i keep 'value', nothing shows. Any idea?

Related

Predefine data in HTML field from XML in odoo

I have a HTML-field in my model.py like this:
from odoo import models, fields
class TestModel(models.model):
_name = 'test.model'
content = fields.HTML()
To display the data of my model I used <field name="content" widget='html'> in the corresponding view file.
Now I want to add predefined data, when the module is first installed.
Normally, I add data inside the datafolder with .xml files.
So I created an .xml with the following content:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="unique_id" model="test.model">
<field name="content">
<p>Some Text</p>
</field>
</record>
</data>
</odoo>
But I end up getting parsing errors like this:
File "/Path/to/my/odoo/installation/odoo/tools/convert.py", line 782, in convert_xml_import
relaxng.assert_(doc)
File "src/lxml/etree.pyx", line 3633, in lxml.etree._Validator.assert_
AssertionError: Element odoo has extra content: data, line 3
What am I doing wrong or do I have a complete wrong understanding of how the HTML-field works?
Any help is appreciated.
Ok, if anyone ever stumbles across this...
One has to specify the type for an HTML-field.
So instead of <field name="content"> it has to be <field name="content" type="html"> and then it works as intended.
Happy Odoo'ing!

Replace LaTeX formulas in HTML markup with IMG tags linked to generated SVG images

I have an XML file witch in some nodes contains HTML markup. I want to be able to use LaTeX formulas there. I'm trying to find a way to generate another XML file with those formulas replaced with <img src="..."> tags, and produce corresponding svg images. Is there a tool for that, or is the task to specific and I need to write it myself? I was hoping that there is something that I could tweak a little to get it to work like that.
Example is below:
Input file:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<snippet>
In mathematics, <b>Euler's identity</b> is the equality $e^{i\pi}+1=0$.
</snippet>
<snippet>
Albert Einstein's famous formula:
$$E=mc^2$$
</snippet>
</root>
Output files:
f1.svg
f2.svg
<?xml version="1.0" encoding="UTF-8"?>
<root>
<snippet>
In mathematics, <b>Euler's identity</b> is the equality <img src="f1.svg" />.
</snippet>
<snippet>
Albert Einstein's famous formula:
<img src="f2.svg" />
</snippet>
</root>
I was looking into mathjax-node and mathjax-node-cli and found the tool tex2svg witch takes a TeX string and produces a single image. Seems like a part of what I need, but there's still a lot to do.

KML/Fusion Tables - line is always red

I've been playing around with the Fusion Tables/Google Maps stuff to create some flight paths between different places but I can't figure out how to style the lines correctly.
This is an example KML that I imported:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>LineStyle.kml</name>
<open>1</open>
<Style id="linestyleExample">
<LineStyle>
<color>00FF00</color>
<width>4</width>
<gx:labelVisibility>1</gx:labelVisibility>
</LineStyle>
</Style>
<Placemark>
<name>LineStyle Example</name>
<styleUrl>#linestyleExample</styleUrl>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<coordinates>-0.47364383,51.824664,0.0 -122.364152,37.824322,0.0</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
And it draws the line correctly but it's always red no matter what value I put inside the LineStyle section.
Anyone got any ideas how to get a different colour? I've tried everything I can think of but I'm stuck!
Thanks in advance,
Mark
You can style them (polylines, polygons, and markers) in FusionTables using the User Interface (in Visualize:Map, click on Configure Styles). It is easiest if you put style information in a column (unless you want them all the same)
You can also configure up to 5 styles dynamically in the Google Maps API v3 on a (single) FusionTablesLayer.
Fusion Tables does not import style information, you have to re-style using the Fusion Tables interface

DocBook: How to link to another man page?

I am writing a couple of man pages in DocBook. I would also like to convert them to HTML for display on the web. How can I insert a link from one man page to another, such that it appears in man as target(1) but appears on the web as a hyperlink to the other man page, which has also been converted to a separate HTML file in the same directory?
I think I have figured this out. You should use a <citerefentry/> in the document, which appears as expected in a man page. It isn't hyperlinked in a HTML document unless you provide a method for generating the target URL, which you do in a customisation layer.
Here is an example document snippet for the "See Also" section in a man page:
<refsect1 id="seealso">
<title>See Also</title>
<simplelist type="inline">
<member><citerefentry><refentrytitle>grep</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>awk</refentrytitle><manvolnum>1P</manvolnum></citerefentry></member>
</simplelist>
</refsect1>
Coupled with this customisation template (saved as custom.xsl)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- Ignore spaces between elements (without this, the URL is "grep .html" -->
<xsl:strip-space elements="*"/>
<!-- Turn citerefentry elements into HTML links -->
<xsl:param name="citerefentry.link" select="1"/>
<!-- Code to generate the URL for a given citerefentry element -->
<xsl:template name="generate.citerefentry.link">
<xsl:value-of select="refentrytitle"/>
<xsl:text>.html</xsl:text>
</xsl:template>
</xsl:stylesheet>
Using the xmlto program to process the DocBook XML, specifying the customisation layer for HTML:
$ xmlto man input.xml
$ xmlto html-nochunks -m custom.xsl input.xml
In a manpage, this produces:
SEE ALSO
grep(1), awk(1P)
And in HTML it produces this: (all the <span> elements have been removed for clarity)
<h2>See Also</h2>
grep(1), awk(1)
The actual URLs generated can be adjusted by editing the content of the generate.citerefentry.link template in custom.xsl. The example above just uses the value of the <refentrytitle> from the DocBook XML and appends ".html" to it.

Does Google Maps respect the <BalloonStyle> definition in KML?

I'm using the GGeoXml object to overlay KML on an embedded Google Map. I need to customize the popup balloon for placemarks, so I'm trying to use the <BalloonStyle> element:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="http://earth.google.com/kml/2.0">
<name>Concessions</name>
<Style id="masterPolyStyle">
...
<BalloonStyle>
<text>
<![CDATA[
<h6>Concession</h6>
<h4>$[name]</h4>
<p>$[description]</p>
]]>
</text>
<displayMode>default</displayMode>
<bgColor>DDA39B81</bgColor>
</BalloonStyle>
</Style>
...
</Document>
This works as expected in Google Earth, but the embedded map API appears to ignore this altogether. I suppose I could just leave out the <name> element altogether and just put everything in HTML inside the <description> element, but I'd like to be able to take advantage of the <ExtendedData> element to display custom data in a structured way.
This is now documented here (2009/04):
http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html
< BalloonStyle > no
(When did you ask this ? This forum/service needs a big fat DATE on each question, with a year in it :-) )
2$c,
*pike
No, like you have mentioned, html in the description is the only way I know that you can control the style of balloons through kml/georss feed.
Actually, the document referenced above (http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html) must have changed, b/c now it says:
<BalloonStyle> partially only <text>
is supported
My problem is that the <text> seems to work for one KML file, but not another. The one that works for has polygon placemarkers, the other has points represented by icons - I wonder if that is why...