各位大侠请教 WKB 和 AGF 的格式说明

zhshly007 2007-08-20 07:55:23
小弟今日研究PostGis,数据以AsBinary形式提供,但格式均为WKB和AGF格式,不知哪位高人帮帮小弟,提供一下这些格式的具体说明;小弟谢谢了!
...全文
335 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhshly007 2007-08-23
  • 打赏
  • 举报
回复
看来不用了,呵呵呵,找到了;
Well-known binary (WKB) representation
This section describes the well-known binary representation for geometries.

The OpenGIS Consortium "Simple Features for SQL" specification defines the well-known binary representation. This representation is also defined by the International Organization for Standardization (ISO) "SQL/MM Part: 3 Spatial" standard. See the related reference section at the end of this topic for information on functions that accept and produce the WKB.

The basic building block for well-known binary representations is the byte stream for a point, which consists of two double values. The byte streams for other geometries are built using the byte streams for geometries that are already defined.

The following example illustrates the basic building block for well-known binary representations.

// Basic Type definitions
// byte : 1 byte
// uint32 : 32 bit unsigned integer (4 bytes)
// double : double precision number (8 bytes)

// Building Blocks : Point, LinearRing

Point {
double x;
double y;
};
LinearRing {
uint32 numPoints;
Point points[numPoints];
};
enum wkbGeometryType {
wkbPoint = 1,
wkbLineString = 2,
wkbPolygon = 3,
wkbMultiPoint = 4,
wkbMultiLineString = 5,
wkbMultiPolygon = 6
};
enum wkbByteOrder {
wkbXDR = 0, // Big Endian
wkbNDR = 1 // Little Endian
};
WKBPoint {
byte byteOrder;
uint32 wkbType; // 1=wkbPoint
Point point;
};
WKBLineString {
byte byteOrder;
uint32 wkbType; // 2=wkbLineString
uint32 numPoints;
Point points[numPoints];
};

WKBPolygon {
byte byteOrder;
uint32 wkbType; // 3=wkbPolygon
uint32 numRings;
LinearRing rings[numRings];
};
WKBMultiPoint {
byte byteOrder;
uint32 wkbType; // 4=wkbMultipoint
uint32 num_wkbPoints;
WKBPoint WKBPoints[num_wkbPoints];
};
WKBMultiLineString {
byte byteOrder;
uint32 wkbType; // 5=wkbMultiLineString
uint32 num_wkbLineStrings;
WKBLineString WKBLineStrings[num_wkbLineStrings];
};

wkbMultiPolygon {
byte byteOrder;
uint32 wkbType; // 6=wkbMultiPolygon
uint32 num_wkbPolygons;
WKBPolygon wkbPolygons[num_wkbPolygons];
};

WKBGeometry {
union {
WKBPoint point;
WKBLineString linestring;
WKBPolygon polygon;
WKBMultiPoint mpoint;
WKBMultiLineString mlinestring;
WKBMultiPolygon mpolygon;
}
};

The following figure shows an example of a geometry in well-known binary representation using NDR coding.

Figure 58. Geometry representation in NDR format. (B=1) of type polygon (T=3) with 2 linears (NR=2), where each ring has 3 points (NP=3).

jixingzhong 2007-08-21
  • 打赏
  • 举报
回复
搜索 Geometry格式转换函数

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧