Count points in polygons with WFS or WPS - geoserver

I'm having 2 separate layers in geoserver. One containing polygons and other one contains points. How can I count the number of points within each polygon using wfs or wps requests?
QGIS describing the exact functionality I'm asking.
I tried using vec:InclusionFeatureCollection WPS function but it only returns attributes from the first feature collection so I can't count them grouped by polygons:
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>vec:InclusionFeatureCollection</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>first</ows:Identifier>
<wps:Reference mimeType="text/xml; subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs" method="POST">
<wps:Body>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2">
<wfs:Query typeName="osm:events"/>
</wfs:GetFeature>
</wps:Body>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>second</ows:Identifier>
<wps:Reference mimeType="text/xml; subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs" method="POST">
<wps:Body>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2">
<wfs:Query typeName="osm:administrative_4"/>
</wfs:GetFeature>
</wps:Body>
</wps:Reference>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput mimeType="text/xml; subtype=wfs-collection/1.0">
<ows:Identifier>result</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>

Related

Orbeon static autocomplete not working as expected

I'm using Orbeon v2017.1 and I'd like to add an autocomplete field with a static itemset.
I've tried implementing it as it is defined here
https://doc.orbeon.com/form-runner/component/autocomplete#static
and I've also tried creating a service and action which will fill the data, but it displays it as radio buttons instead of populating the dropdown.
Is there a working example for this version of Orbeon which I could look at?
EDIT:
Here is an example of two autocomplete fields (dynamic and static)
I'm not sure if the used free web service supports filtering, so the fr-search-value was not used for the dynamic one (is it possible to filter it somehow in Orbeon for both static and dynamic?)
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xh:head>
<xh:title/>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance id="all-countries"
src="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/ListOfCountryNamesByName/XML"/>
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<country-dynamic-autocomplete label=""/>
<country-static-autocomplete label=""/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="country-dynamic-autocomplete-bind" ref="country-dynamic-autocomplete"
name="country-dynamic-autocomplete"/>
<xf:bind id="country-static-autocomplete-bind" ref="country-static-autocomplete"
name="country-static-autocomplete"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>insurance</application-name>
<form-name>test</form-name>
<title xml:lang="en"/>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<!-- Don't make readonly by default in case a service modifies the resources -->
<xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<country-dynamic-autocomplete>
<label>Countries Dynamic Autocomplete</label>
<hint/>
</country-dynamic-autocomplete>
<country-static-autocomplete>
<label>Countries Static Autocomplete</label>
<hint/>
</country-static-autocomplete>
<section-1>
<label>Country Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:autocomplete xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
id="country-dynamic-autocomplete-control"
labelref="#label"
max-results-displayed="300"
resource="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/ListOfCountryNamesByName/XML"
bind="country-dynamic-autocomplete-bind">
<xf:label ref="$form-resources/country-dynamic-autocomplete/label"/>
<xf:hint ref="$form-resources/country-dynamic-autocomplete/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/ArrayOftCountryCodeAndName/tCountryCodeAndName">
<xf:label ref="sName"/>
<xf:value ref="sISOCode"/>
</xf:itemset>
</fr:autocomplete>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<fr:autocomplete id="country-static-autocomplete-control" ref="country-static-autocomplete"
dynamic-itemset="false"
bind="country-static-autocomplete-bind">
<xf:label ref="$form-resources/country-static-autocomplete/label"/>
<xf:hint ref="$form-resources/country-static-autocomplete/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="instance('all-countries')/ArrayOftCountryCodeAndName/tCountryCodeAndName">
<xf:label ref="sName"/>
<xf:value ref="sISOCode"/>
</xf:itemset>
</fr:autocomplete>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>

Geomesa WPS tubeselect error

I am running geoserver 2.9.4 from this image and I am trying to get the tubeselect example working, because I need to show how points move through time. My WPS request is the following:
<ows:Identifier>gs:Import</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>features</ows:Identifier>
<wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wps" method="POST">
<wps:Body>
<wps:Execute version="1.0.0" service="WPS">
<ows:Identifier>geomesa:TubeSelect</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>tubeFeatures</ows:Identifier>
<wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST">
<wps:Body>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:geomesa="geomesa">
<wfs:Query typeName="geomesa:posicion"/>
</wfs:GetFeature>
</wps:Body>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>featureCollection</ows:Identifier>
<wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST">
<wps:Body>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:geomesa="geomesa">
<wfs:Query typeName="geomesa:posicion"/>
</wfs:GetFeature>
</wps:Body>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>maxSpeed</ows:Identifier>
<wps:Data>
<wps:LiteralData>55</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>maxTime</ows:Identifier>
<wps:Data>
<wps:LiteralData>120</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput mimeType="text/xml; subtype=wfs-collection/1.0">
<ows:Identifier>result</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>
</wps:Body>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>coverage</ows:Identifier>
<wps:Reference mimeType="image/tiff" xlink:href="http://geoserver/wcs" method="POST">
<wps:Body/>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>workspace</ows:Identifier>
<wps:Data>
<wps:LiteralData>geomesa</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>store</ows:Identifier>
<wps:Data>
<wps:LiteralData>posiciones</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>name</ows:Identifier>
<wps:Data>
<wps:LiteralData>posiciones-current</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>srs</ows:Identifier>
<wps:Data>
<wps:LiteralData>EPSG:4326</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput>
<ows:Identifier>layerName</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>
But when I execute the WPS process, I got the following error:
<ows:ExceptionText>Unrecognized request type {}</ows:ExceptionText>
My setup is geomesa 1.3.2 with apache accumulo as DataStore. My datastore is geomesa:posiciones
Any idea?
You might need to specify the content-type header - in curl it would be something like:
curl -X POST -d #my-request.xml 'http://localhost:8080/geoserver/wps' -H 'Content-Type: text/xml'

How to make a resizable SplitPane within a Tab in JavaFX 2.0 (preferably using SceneBuilder and/or FXML)?

The question basically says it all, with the caveat that I'm a newbie to GUI design in general and JavaFX in particular. To reproduce in SceneBuilder, drag a TabPane onto the scene, and drag a SplitPane into the first tab's AnchorPane. Adjust (drag) the size of the SplitPane to match the the size of the tab. This is not a problem if the SplitPane is not a child (I only tested it as a (grand)child of a Tab so far). You'll have something like this:
Upon preview, if you try to expand the window size by dragging, the SplitPane won't resize:
Here is the FXML I get from SceneBuilder, using the process described at the top of this post with perhaps a few minor changes that didn't help:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<TabPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" tabClosingPolicy="UNAVAILABLE" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
<tabs>
<Tab text="Untitled Tab 1">
<content>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="0.0" minWidth="0.0" prefHeight="386.0" prefWidth="613.0">
<children>
<SplitPane dividerPositions="0.29797979797979796" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="358.0" prefWidth="600.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="158.0" prefWidth="277.0" />
</items>
</SplitPane>
</children></AnchorPane>
</content>
</Tab>
<Tab text="Untitled Tab 2">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</Tab>
</tabs>
</TabPane>
The problem is that your SplitPane is a child of an AnchorPane. In case you have something under AnchorPane, it is anchored to specific co-ordinates. To allow the child to take up the whole are, you need to specify the AnchorPane's anchor to zero.
<TabPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" tabClosingPolicy="UNAVAILABLE" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
<tabs>
....
<SplitPane dividerPositions="0.29797979797979796" maxHeight="-Infinity"
maxWidth="-Infinity" prefHeight="358.0" prefWidth="600.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
....
</tabs>
</TabPane>
Using scene-builder, you can assign the AnchorPane Constraints by:
Select the child under AnchorPane
Move to Layout section on the right hand side panel
You will see a section called AnchorPane constraints, just type in the four section values and save

How do i display an image instead of text for a ? on an xml form for ODK collect?

Since odk collect uses utf-8, the language that i would like the questions of the form to be in would be displayed one character at a time vs. conjoined. instead of displaying text for the question, i want the question to display an image which will be on the question text formatted properly. Is there anyway this can be done, are there any good tutorials or information out there that can help me accomplish this?
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
<h:head>
<h:title>firstform</h:title>
<model>
<instance>
<data id="build_firstform_1375472795">
<meta>
<instanceID/>
</meta>
<field_name/>
<field_age/>
<field_location/>
</data>
</instance>
<itext>
<translation lang="eng">
<text id="/data/field_name:label">
<value>**<img src="Q1.png" >**</value>
</text>
<text id="/data/field_name:hint">
<value>What is your name (last, first)?</value>
</text>
the bolded code did not work.
<?xml version="1.0" encoding="UTF-8"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:jr="http://openrosa.org/javarosa" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><h:head xmlns="">
<h:title>images</h:title><model>
<instance>
<data id="1">
<some_text/>
<image_test/>
</data>
</instance>
<itext>
<translation lang="eng">
<text id="/data/image_test:label">
<value>picture test</value>
</text>
<text id="/data/image_test:a">
<value form="image">jr://images/p1.jpg</value>
</text>
<text id="/data/image_test:b">
<value form="image">jr://images/p2.jpg</value>
</text>
</translation>
</itext>
<bind nodeset="/data/image_test" type="select1"/>
</model>
</h:head>
<h:body xmlns="">
<select1 ref="/data/image_test">
<label ref="jr:itext('/data/image_test:label')"/>
<item>
<label ref="jr:itext('/data/image_test:a')"/>
<value>a</value>
</item>
<item>
<label ref="jr:itext('/data/image_test:b')"/>
<value>b</value>
</item>
<item>
<label ref="jr:itext('/data/image_test:c')"/>
<value>c</value>
</item>
</select1>
</h:body>
</h:html>

Appointment color change in Exchange using Java EWS 1.2

I am making use of this piece of code to set the color. It;s setting color on my computer, but when I send appointments to others, the color is not getting set in their calendar after they accept it.
ExtendedPropertyDefinition propDefColor = new ExtendedPropertyDefinition(
UUID.fromString("00062002-0000-0000-c000-000000000046"),
0x8214, MapiPropertyType.Integer);
appointment.setExtendedProperty(propDefColor, "6");
I tried to retrieve it after saving an appointment with this piece of code, but it didn't work.
PropertySet propset=new PropertySet(BasePropertySet.FirstClassProperties, propDefColor);
appointment.bind(service,appointment.getId(), propset);
for(ExtendedProperty extendedProperty : appointment.getExtendedProperties()) {
System.out.println(extendedProperty.getValue());
}
And I am using:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
For client requirement. And Java EWS API1.2.
Kindly let me know how to get the color in other clients. (I don't know how to use MasterCategorylist or categories or tryGetProperty()).
Kindly help me in this. If we need to use tryGetProperty(), then how to pass the parameters in it?
Propertydefinitionenter code here
OutParam<Object>
Kindly help.
Not answering you 'all the way' but maybe this helps you further.
I hard code EWS XML requests and this is how I retrieve the master configuration list:
<soap:Envelope xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<typ:RequestServerVersion Version="Exchange2010" />
</soap:Header>
<soap:Body>
<mes:GetUserConfiguration>
<mes:UserConfigurationName Name="CategoryList">
<typ:DistinguishedFolderId Id="calendar"/>
</mes:UserConfigurationName>
<mes:UserConfigurationProperties>All</mes:UserConfigurationProperties>
</mes:GetUserConfiguration>
</soap:Body>
</soap:Envelope>
The answer is:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="722" MinorBuildNumber="0" Version="Exchange2010" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<m:GetUserConfigurationResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetUserConfigurationResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:UserConfiguration>
<t:UserConfigurationName Name="CategoryList">
<typ:DistinguishedFolderId Id="calendar" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"/>
</t:UserConfigurationName>
<t:ItemId Id="AAMkADkyZ[snip]fSM9AAA=" ChangeKey="CQAAAB[snip]p3Law"/>
<t:XmlData>77u/PD94bW[snip]lcz4NCg==</t:XmlData>
</m:UserConfiguration>
</m:GetUserConfigurationResponseMessage>
</m:ResponseMessages>
</m:GetUserConfigurationResponse>
</s:Body>
</s:Envelope>
That xmldata is what you want. It's Base64 encoded, if you decode it, it reads:
<?xml version="1.0"?>
<categories default="Red Category" lastSavedSession="2" lastSavedTime="2013-07-29T07:47:43.0411241Z" xmlns="CategoryList.xsd">
<category name="Red Category" color="0" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="1601-01-01T00:00:00Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2010-09-29T10:08:46.487Z" lastSessionUsed="0" guid="{61c23d24-ed86-47ec-8565-433e3a6b21b7}" renameOnFirstUse="1" />
<category name="Blue Category" color="7" keyboardShortcut="0" usageCount="6" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="2013-04-17T09:10:04.043Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-04-17T09:10:04.043Z" lastSessionUsed="2" guid="{e19dd512-bff1-46d8-a858-54cc114872ad}" renameOnFirstUse="0" />
<category name="Purple Category" color="8" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="1601-01-01T00:00:00Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2010-09-29T10:08:46.487Z" lastSessionUsed="0" guid="{fd3afb30-285e-4bf2-885e-f9fdfe00002e}" renameOnFirstUse="1" />
<category name="Green Category" color="4" keyboardShortcut="0" usageCount="6" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="2013-04-17T09:10:12.782Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-04-17T09:10:12.782Z" lastSessionUsed="2" guid="{c3dc51d0-1cc4-42cf-9fa9-75146905771f}" renameOnFirstUse="0" />
<category name="Orange Category" color="1" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="1601-01-01T00:00:00Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2010-09-29T10:08:46.487Z" lastSessionUsed="0" guid="{10c78b6f-5828-4b3c-af0c-138aaac52dae}" renameOnFirstUse="1" />
<category name="Yellow Category" color="3" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="1601-01-01T00:00:00Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2010-09-29T10:08:46.487Z" lastSessionUsed="0" guid="{37cc21d3-b6a9-4dae-a1fb-422249b9fbb0}" renameOnFirstUse="1" />
<category name="TimeTell" color="7" keyboardShortcut="0" usageCount="7" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="2013-07-29T07:31:17.8034765Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-07-29T07:31:17.8034765Z" lastSessionUsed="2" guid="{3348e50b-1763-42fb-a9e9-25b74038b9aa}" renameOnFirstUse="0" />
</categories>
And there you have the categories and associated colors.
I redid the code using another lib that made it easier. It takes care of getting/setting all the fields.

Resources