Syntax for the Region tag in KML - scale

I have several hundred placemarks that are all in one folder. I'm trying to make the labels appear only below a certain altitude. (The placemarks were created by exporting a layer from ArcGIS, and I presume that the altitude should be specified in the units used by the coordinate system of the layer, in this case, in feet; correct me if I'm wrong.) However, nothing I do with the <Region> tag seems to work; the labels happily appear at all altitudes. Here is the code that I'm using; can anyone tell what is wrong with it?
<Document id="DocumentName">
<name>NameGoesHere</name>
<Snippet></Snippet>
<Folder id="NameOfTheFolder">
<name>NameGoesHere</name>
<Region id="highAltitude">
<LatLonAltBox>
<north>40</north>
<south>37</south>
<east>-74</east>
<west>-79</west>
<minAltitude>50000</minAltitude>
<maxAltitude>500000</maxAltitude>
</LatLonAltBox>
<LabelStyle id="styleNameHere">
<scale>0</scale>
</LabelStyle>
</Region>
<Snippet></Snippet>
...
<placemark> ... </placemark>
<placemark> ... </placemark>
<placemark> ... </placemark>
...
</Folder>
</Document>
The point of all this code is to suppress labels at altitudes above 50,000 feet, but it does nothing of the sort. Toward the end of the code, after the </Folder> tag but before the </Document> tag, there is some code, generated when the file was exported, that specifies label styles. But whether or not I delete the <scale> part of it, it seems to have no effect. That code is as follows:
<Style id="Stylename">
<IconStyle>
...
</IconStyle>
<LabelStyle>
<color> ... </color>
<scale> ... </scale>
</LabelStyle>
<PolyStyle>
...
</PolyStyle>
</Style>
I suspect that I'm doing something wrong here in terms of syntax, but, because I've had no experience with KML at all until a few days ago, I'm not sure what the issue is. I appreciate any ideas as to why this isn't working.

You need to define the Lod (Level of Detail) in the Region otherwise it will always appear.
<Region id="highAltitude">
<LatLonAltBox>
...
</LatLonAltBox>
<Lod>
<minLodPixels>256</minLodPixels>
</Lod>
<Region>
The minLodPixels defines the size of the region where if it is less than this minimum number of pixels on the screen then the region is not shown.
https://developers.google.com/kml/documentation/kmlreference#lod
Also, the LabelStyle is not valid within the Region. That must appear in a <Style> element. If KML doesn't behave as you'd expect 9 out of 10 times the syntax is wrong -- try to validate it using a KML validator.

Related

QR code missing characters after printing with Zebra S4M

I am programming a Zebra S4M template:
^FX[Fonts]^FS
^FX[Graphics]^FS
^FX[Format]^FS
CT~~CD,~CC^~CT~
^XA
^DFR:QR.ZPL^FS
~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR3,3^MD10^LRN^CI0
^MMT
^PW980
^LL0461
^LS0
^FT137,424^BQN,2,7
^FN24^FDQR_CUST_CODE^FS
^XZ
The line in question is ^FN24^FDQR_CUST_CODE^FS, where the variable is supplied in a .xml file
<?xml version="1.0" standalone="no"?>
<!DOCTYPE labels SYSTEM "label.dtd">
<labels _FORMAT="R:QR.ZPL" _QUANTITY="1" _PRINTERNAME="Printer 1" _JOBNAME="LBL101">
<label>
<variable name="QR_CUST_CODE">11112345678</variable>
</label>
</labels>
The resulting code only contains values 12345678, so I am missing first 3x1.
Any suggestions? Tried to add QA to the FD but it does not work.
When creating a QR Code in ZPL, the ^FD command has additional arguments that must be set before the data is added.
Change your last line as show here:
From:
^FN24^FDQR_CUST_CODE^FS
To:
^FN24^FDMM,NQR_CUST_CODE^FS
Below is example from the BQ Command guide that should help you further.
https://support.zebra.com/cpws/docs/zpl/BQ_Command.pdf

How can I verify a SVG doc is correct? (version 1.2)

I used a program called Fritzing to draw some basic Arduino schematics, and then export the output as a SVG. This works just as expected, but then I noticed that the SVG output only looks okay in some browsers and only okay in some versions of Firefox.
Since Fritzing is a open source app I figured that I could look into the code (and maybe help out a little).
But now over to the question, what is a correct SVG supposed to look like? What verifier over at W3C can I use to check the file?
I tried to use the verifiers found on this page: http://validator.w3.org/dev/tests/
But they all complained a lot, especially about the SVG version. The verifiers seem to like version 1.0 and 1.1, but when I look at the top of this file seems to be using version 1.2?
This is the top three lines from the problematic file (reformatted for readability):
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created with Fritzing (http://www.fritzing.org/) -->
<svg width="3.50927in"
x="0in"
version="1.2"
y="0in"
xmlns="http://www.w3.org/2000/svg"
height="2.81713in"
viewBox="0 0 252.667 202.833"
baseProfile="tiny"
xmlns:svg="http://www.w3.org/2000/svg">
Is there a specific SVG 1.2 verifier I can use?
Or shall I try to verify the SVG as if it was a classical XML file?
(As a side note, Fritzing seems to use Qt, so if there some QTest I can use it may be useful.)
You can use e.g http://validator.nu. Since your file is standalone, select xml parsing, paste the RNG url in the schema textfield (the schema url you're looking can be found in the relevant specification, in this case SVG 1.2 Tiny: http://www.w3.org/TR/SVGTiny12/relaxng/Tiny-1.2.rng ).
Even your three line snippet isn't valid SVG 1.2 Tiny content (x and y attributes are not allowed on the <svg> element in Tiny). You should add a link to your file somewhere, otherwise it's hard to say what it should look like.
There is a python utility in terminal svgcheck, which claims to target version 1.2, as defined in draft-7996-bis. A promising utility, IMHO.
SVG Checking Procedure.
pip install svgcheck
svgcheck ~/path/to/mysvgfile.svg
The svg file with proper standards will give something like:
$ svgcheck alert-circle.svg
Parsing file alert-circle.svg
INFO: File conforms to SVG requirements.
Make sure you have pip installed and python configured properly
For the subset SVG Tiny 1.2 Portable/Secure (SVG P/S), used for example in Brand Indicators for Message Identification (BIMI), see Using the RNC Schema to Validate BIMI SVG Images. It shows how to perform Relax NG Compact (RNC) XML schema validation on the command line.
pip3 install jingtrang
wget 'https://bimigroup.org/resources/SVG_PS-latest.rnc.txt'
pyjing -c SVG_PS-latest.rnc.txt my-image.svg
For my use-case, a PNG logotype converted to SVG Tiny 1.2 using png2svg, this was the output.
my-image.svg:1:159: error: value of attribute "baseProfile" is invalid; must be equal to "tiny-ps"
my-image.svg:1:174: error: element "g" not allowed yet; missing required element "title"
Errors were easily fixed by editing the baseProfile value and adding <title>A very nice image title</title>.

XPROC - Generation of files in secondary port

My requirement is to generate one XML file and few HTML files in the secondary port. I have configured few steps in XProc.
Here’s the sample code:
<p:xslt name="create-document">
<p:input port="stylesheet">
<p:document href="stylesheet.xsl" />
</p:input>
</p:xslt>
<p:for-each>
<p:iteration-source>
<p:pipe step="create-document" port="secondary" />
</p:iteration-source>
<p:store>
<p:with-option name="doctype-public" select="'-//W3C//DTD XHTML 1.0 Frameset//EN'" />
<p:with-option name="doctype-system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'" />
<p:with-option name="encoding" select="'UTF-8'" />
<p:with-option name="media-type" select="'text/html'" />
<p:with-option name="method" select="'xhtml'" />
<p:with-option name="omit-xml-declaration" select="'no'" />
</p:store>
</p:for-each>
The problem here is HTML file is generated properly. And the XML file is generated, but I am not able to view the XML content. Instead it displays everything in HTML format.This is because of <p:store> in the above code snippet.
How do you have two <p:store> steps? (One for HTML and the other for XML)
It would be nice if you could somehow determine with which xsl:result-document parameters each document on the secondary output was written. You would be able to duplicate those for your p:store. But you can derive other things from each document. You can retrieve the document name using base-uri(), and you can look at for instance the root element. You can put these values in a variable using:
<p:variable name="path" select="base-uri(/*)"/>
<p:variable name="root" select="local-name(/*)"/>
(Put these just below the p:iteration-source.)
You then need to decide how to call p:store. You could use XPath if, provided your XProc parser supports XPath 2.0 (like XMLCalabash does). But I’d recommend using a p:choose like this:
<p:choose>
<p:when test="ends-with($path, '.xhtml')">
<p:store
doctype-public="-//W3C//DTD XHTML 1.0 Frameset//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
encoding="UTF-8"
media-type="text/html"
method="xhtml"
omit-xml-declaration="no">
<p:with-option name="href" select="$path"/>
</p:store>
</p:when>
<p:otherwise>
<p:store
encoding="UTF-8"
media-type="application/xml"
method="xml"
omit-xml-declaration="no">
<p:with-option name="href" select="$path"/>
</p:store>
</p:otherwise>
</p:choose>
(This entire p:choose replaces the p:store you already have.)
The test in p:when only looks at $path, but you could include a test for $root as well, if you like.
It also requires you to use .xhtml as extension in your xsl:result-document statements for the HTML output, but you can easily tweak that if you like.
The var and the choose should be enough to get your XML written properly, at least.
Good luck!

Problem playing parallel effects

I could not play the parallel effect which is defined by the following code:
var parallel:Parallel=new Parallel();
var E1:WipeDown=new WipeDown();
var E2:WipeLeft=new WipeLeft();
parallel.addChild(E2);
parallel.addChild(E1);
parallel.duration=2000;
parallel.target=this;
parallel.play();
On playin the effect by calling effect() function only the effect E1 is getting played.
If the code was:
parallel.addChild(E1);
parallel.addChild(E2);
instead of:
parallel.addChild(E2);
parallel.addChild(E1);
then only the effect E2 is getting played..
To summurize only the top most child effect is getting played..
Can any one plese suggest a solution...
<code>
<mx:Parallel target="{this}" id="wipeDownLeft" duration="2000">
<mx:WipeDown target="{this}" duration="2000"/>
<mx:WipeLeft target="{this}" duration="2000"/>
</code>
If above code is not clear one can check with this application(copy the code and run)
code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768" xmlns:ns1="*">
<mx:Canvas id="C" creationComplete="{E.play()}" width="50%" height="50%" backgroundColor="#387C44">
</mx:Canvas>
<mx:Parallel id="E" duration="2000">
<mx:WipeLeft duration="2000" target="{C}"/>
<mx:WipeDown duration="2000" target="{C}"/>
</mx:Parallel>
<mx:Button click="E.play([C])" x="{C.width+10}" y="{C.height+10}">
</mx:Button>
</mx:Application>
Maybe try setting the target property for each of the child effects instead?
Probably wouldnt hurt to do this for duration either...
I have only used effects in mxml, and this it how ive always done it (same with the doc examples?) - in fact have even done the dual wipe you are trying here, but not in AS...
[Edit] - I cannot see your mxml unlessI go into edit mode, but i cannot submit edits - use the code tags on it...
but same again, specify target and duration for the children not the parallel...
I think, the reason that, WipeLeft and WipeDown are mutually exclusive effects. But must performed in parallel. if you replace a to the , then it will be work. Or if you replace WipeLeft (or WipeDown) effect to some other effect, f.ex. , then it will be work too.

How is the Correct use of ui:repeat tag to build a selctOneMenu in XHTML using JBoss Seam Framework?

This is suppose to be quite simple but I have already spent couple of hours on this without solution. My fragment of code follows:
<h:selectOneMenu id="carro" value="#{abastecimentoAction.idCarroPesquisa}" required="true">
<ui:repeat value="#{carroList.resultList}" var="_meuCarro">
<f:selectItem itemValue="#{_meuCarro.id}" itemLabel="#{_meuCarro.nome}"/>
<h:outputText value="Testes"/>
</ui:repeat>
</h:selectOneMenu>
The point is the "Testes" string is correctly printed as many times as the size of carroList.resultList but no options is printed. I get a blank combo.
tx in advance.
Just managed to fix this using:
<h:selectOneMenu id="carro" value="#{abastecimentoAction.idCarroPesquisa}" required="false">
<s:selectItems var="carro" value="#{carroList.resultList}" label="#{carro.nome}" itemValue="#{carro.id}" />
</h:selectOneMenu>

Resources