Skip to content

Instantly share code, notes, and snippets.

@ca0v ca0v/ogc.d.ts
Last active Dec 30, 2015

Embed
What would you like to do?
First shot at describing OGC interfaces in json
// converted from ol readers
declare module ogc {
module wms {
export interface ContactPersonPrimary {
ContactPerson: string;
ContactOrganization: string;
}
export interface ContactAddress {
AddressType: string;
Address: string;
City: string;
StateOrProvince: string;
PostCode: string;
Country: string;
}
export interface ContactInformation {
ContactPersonPrimary: ContactPersonPrimary;
ContactPosition: string;
ContactAddress: ContactAddress;
ContactVoiceTelephone: string;
ContactElectronicMailAddress: string;
}
export interface Service {
Name: string;
Title: string;
Abstract: string;
KeywordList: string[];
OnlineResource: string;
ContactInformation: ContactInformation;
Fees: string;
AccessConstraints: string;
LayerLimit: number;
MaxWidth: number;
MaxHeight: number;
}
export interface Get {
OnlineResource: string;
}
export interface Post {
OnlineResource: string;
}
export interface HTTP {
Get: Get;
Post: Post;
}
export interface DCPType {
HTTP: HTTP;
}
export interface GetCapabilities {
Format: string[];
DCPType: DCPType[];
}
export interface Get2 {
OnlineResource: string;
}
export interface HTTP2 {
Get: Get2;
}
export interface DCPType2 {
HTTP: HTTP2;
}
export interface GetMap {
Format: string[];
DCPType: DCPType2[];
}
export interface Get3 {
OnlineResource: string;
}
export interface HTTP3 {
Get: Get3;
}
export interface DCPType3 {
HTTP: HTTP3;
}
export interface GetFeatureInfo {
Format: string[];
DCPType: DCPType3[];
}
export interface Request {
GetCapabilities: GetCapabilities;
GetMap: GetMap;
GetFeatureInfo: GetFeatureInfo;
}
export interface AuthorityURL {
OnlineResource: string;
name: string;
}
export interface BoundingBox {
crs: string;
extent: number[];
res: number[];
}
export interface BoundingBox2 {
crs: string;
extent: number[];
res: number[];
}
export interface LogoURL {
Format: string;
OnlineResource: string;
size: number[];
}
export interface Attribution {
Title: string;
OnlineResource: string;
LogoURL: LogoURL;
}
export interface FeatureListURL {
Format: string;
OnlineResource: string;
}
export interface LegendURL {
Format: string;
OnlineResource: string;
size: number[];
}
export interface StyleSheetURL {
Format: string;
OnlineResource: string;
}
export interface Style {
Name: string;
Title: string;
Abstract: string;
LegendURL: LegendURL[];
StyleSheetURL: StyleSheetURL;
}
export interface MetadataURL {
Format: string;
OnlineResource: string;
type: string;
}
export interface LegendURL2 {
Format: string;
OnlineResource: string;
size: number[];
}
export interface StyleSheetURL2 {
Format: string;
OnlineResource: string;
}
export interface Style2 {
Name: string;
Title: string;
Abstract: string;
LegendURL: LegendURL2[];
StyleSheetURL: StyleSheetURL2;
}
export interface BoundingBox3 {
crs: string;
extent: number[];
res: number[];
}
export interface LogoURL2 {
Format: string;
OnlineResource: string;
size: number[];
}
export interface Attribution2 {
Title: string;
OnlineResource: string;
LogoURL: LogoURL2;
}
export interface Dimension {
name: string;
units: string;
unitSymbol?: any;
default: string;
values: string;
nearestValue?: boolean;
}
export interface Layer3 {
Name: string;
Title: string;
Abstract: string;
KeywordList: string[];
Identifier: string[];
MetadataURL: MetadataURL[];
Style: Style2[];
queryable: boolean;
opaque: boolean;
noSubsets: boolean;
CRS: string[];
EX_GeographicBoundingBox: number[];
BoundingBox: BoundingBox3[];
Attribution: Attribution2;
MinScaleDenominator: number;
MaxScaleDenominator: number;
Dimension: Dimension[];
}
export interface AuthorityURL2 {
OnlineResource: string;
name: string;
}
export interface Dimension2 {
name: string;
units: string;
unitSymbol?: any;
default: string;
values: string;
}
export interface Layer2 {
Name: string;
Title: string;
CRS: string[];
EX_GeographicBoundingBox: number[];
BoundingBox: BoundingBox2[];
Attribution: Attribution;
Identifier: string[];
FeatureListURL: FeatureListURL[];
Style: Style[];
MinScaleDenominator: number;
MaxScaleDenominator: number;
Layer: Layer3[];
queryable: boolean;
opaque: boolean;
noSubsets: boolean;
AuthorityURL: AuthorityURL2[];
Dimension: Dimension2[];
fixedWidth?: number;
fixedHeight?: number;
cascaded?: number;
}
export interface Layer {
Title: string;
CRS: string[];
AuthorityURL: AuthorityURL[];
BoundingBox: BoundingBox[];
Layer: Layer2[];
}
export interface Capability {
Request: Request;
Exception: string[];
Layer: Layer;
}
export interface Wms {
version: string;
Service: Service;
Capability: Capability;
}
}
//http://www.geojson.org/geojson-spec.html
module geojson {
// todo
}
module wfs {
interface IWfsFlags {
[property: string]: boolean;
}
interface IWfsGetCapabilities {
serviceIdentification: {
title: string;
abstract: string;
keywords: IWfsFlags;
serviceType: {
value: string;
};
serviceTypeVersion: string;
fees: string;
accessConstraints: string;
};
serviceProvider: {
providerName: string;
serviceContact: {
individualName: string;
positionName: string;
contactInfo: {
phone: {
voice: string;
};
address: {
city: string;
administrativeArea: string;
postalCode: string;
country: string;
};
};
};
};
operationsMetadata: {
GetCapabilities: {
dcp: {
http: {
get: Array<{
url: string;
}>;
post: Array<{
url: string;
}>;
};
};
parameters: {
AcceptVersions: IWfsFlags;
AcceptFormats: IWfsFlags;
};
};
DescribeFeatureType: {
dcp: {
http: {
get: Array< {
url: string;
}>;
post: Array< {
url: string;
}>;
};
};
parameters: {
outputFormat: IWfsFlags;
};
};
GetFeature: {
dcp: {
http: {
get: Array< {
url: string;
}>;
post: Array< {
url: string;
}>;
};
};
parameters: {
resultType: IWfsFlags;
outputFormat: IWfsFlags;
};
constraints: {
LocalTraverseXLinkScope: IWfsFlags;
};
};
GetGmlObject: {
dcp: {
http: {
get: Array< {
url: string;
}>;
post: Array< {
url: string;
}>;
};
};
};
LockFeature: {
dcp: {
http: {
get: Array< {
url: string;
}>;
post: Array< {
url: string;
}>;
};
};
parameters: {
releaseAction: {
ALL: boolean;
SOME: boolean;
};
};
};
GetFeatureWithLock: {
dcp: {
http: {
get: Array< {
url: string;
}>;
post: Array< {
url: string;
}>;
};
};
parameters: {
resultType: {
results: boolean;
hits: boolean;
};
outputFormat: IWfsFlags;
};
};
Transaction: {
dcp: {
http: {
get: Array< {
url: string;
}>;
post: Array< {
url: string;
}>;
};
};
parameters: {
inputFormat: {
};
idgen: {
GenerateNew: boolean;
UseExisting: boolean;
ReplaceDuplicate: boolean;
};
releaseAction: {
ALL: boolean;
SOME: boolean;
};
};
};
};
featureTypeList: {
featureTypes: Array< {
name: string;
featureNS: string;
title: string;
abstract: string;
keywords: IWfsFlags;
srs: string;
bounds: {
left: number;
bottom: number;
right: number;
top: number;
};
}>;
};
}
interface IWfsDescribeFeatureType {
targetNamespace: string;
elementFormDefault: string;
featureTypes: Array<{
typeName: string;
properties: Array<{
name: string;
type: string;
nillable: string;
minOccurs: string;
maxOccurs: string;
localType: string;
}>;
}>;
targetPrefix: string;
}
interface IWfsGetFeatureComponents {
id: string;
x?: number;
y?: number;
components?: Array<IWfsGetFeatureComponents>;
}
interface IWfsGetFeature {
data: any;
id: string;
geometry: {
id: string;
components: Array<IWfsGetFeatureComponents>;
};
attributes: any;
fid: string;
}
}
// prefered interfaces generated from ol.Format.SLD output
module sld {
///<reference path="../../ref.d.ts"/>
interface IStyleLayerDescriptorFilter {
type?: string;
property?: string;
value?: string;
lowerBoundary?: string;
upperBoundary?: string;
filters?: Array<IStyleLayerDescriptorFilter>;
}
// TODO: requires id to be optional for validation to succeed..report as TS defect?
interface IStyledLayerDescriptorRule {
id?: string;
filter?: IStyleLayerDescriptorFilter;
symbolizer?: {
Polygon?: {
fill?: boolean;
stroke?: boolean;
fillColor?: string;
fillOpacity?: string;
strokeColor?: string;
};
Text?: {
label: string;
fontFamily: string;
fontStyle: string;
fontSize: string;
fontWeight: string;
labelAnchorPointX: string;
labelAnchorPointY: string;
haloRadius: string;
haloColor: string;
haloOpacity: string;
fill: boolean;
fontColor: string;
};
};
}
interface IStyledLayerDescriptorLayer {
name: string;
namedStyles: Array<any>;
userStyles: Array< {
id: string;
layerName: string;
defaultsPerSymbolizer: boolean;
rules: Array<IStyledLayerDescriptorRule>;
propertyStyles: {
label?: boolean;
};
defaultStyle: {
fillColor?: string;
fillOpacity?: number;
strokeColor?: string;
strokeOpacity?: number;
strokeWidth?: number;
strokeDashstyle?: string;
pointRadius?: number;
graphicName?: string;
};
}>;
}
interface IStyledLayerDescriptorLayers {
[property: string]: IStyledLayerDescriptorLayer;
}
interface IStyledLayerDescriptor {
version: string;
namedLayers: IStyledLayerDescriptorLayers;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.