当前位置:网站首页>Geojson format description (detailed format)
Geojson format description (detailed format)
2022-06-28 02:10:00 【The most ferocious little seal】
1. brief introduction
GeoJSON Is a format that encodes geographic data structures .GeoJSON Objects can represent geometric information 、 An element or collection of elements .GeoJSON The following geometry types are supported :Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon and GeometryCollection.GeoJSON The element in contains a geometric object and an attribute object , A feature set represents a collection of multiple features . A complete GeoJSON The data structure is always a JSON object . stay GeoJSON in , Objects consist of a collection of key value pairs . For every member , Names are always strings . The value of the member is either character string 、 Numbers 、 object 、 Array , Or "true","false" and "null", The array and object are composed of the values of the above types .
geojson Data acquisition address :http://datav.aliyun.com/tools/atlas/#&lat=31.769817845138945&lng=104.29901249999999&zoom=4
2. GeoJSON object
GeoJSON Always consists of a single object . This object represents geometry 、 An element or collection of elements , An object can have any number of members ( Key value pair ).
- GeoJSON The object must have a name of "type" Members of . The value of this member is determined by GeoJSON The string determined by the type of the object .
{
"type": "FeatureCollection",
"features": [
// Other content
]
}
type The value of the member must be one of the following :“Point”, “MultiPoint”, “LineString”, “MultiLineString”, “Polygon”, “MultiPolygon”, “GeometryCollection”, “Feature”, perhaps “FeatureCollection”.( Similar to the code above )
GeoJSON Object may have an optional "crs" member , Its value must be an object of a coordinate reference system ( see 3. Coordinate reference system object ).
{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"features": [
// Other content
]
}
GeoJSON The object may have a "bbox" member , Its value must be an array of bounding boxes **( see 4. Bounding box )**.
{
"type": "FeatureCollection",
"bbox": [-180.0, -90.0, 180.0, 90.0],
"features": [
// Other content
]
}
2.1 Geometry object
The geometric (Geometry) It's a kind of GeoJSON object , At this time type The value of the member is one of the following strings :"Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", perhaps "GeometryCollection". except “GeometryCollection” Any other type of GeoJSON Geometric objects must have a name of "coordinates" Members of .coordinates The value of a member is always an array . The structure of the elements in this array is determined by the geometric type .
{
"type": "FeatureCollection",
"features": [
{
"type": "GeoJSON",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
108.953361,
34.292663
],
[
108.953404,
34.289539
],
[
108.950857,
34.289529
]
// Multiple latitude and longitude points
]
]
]
}
}
]
}
2.1.1.Position( Base point )
position Is the basic geometry . Of geometric objects "coordinates" The members consist of a position( Here is the geometric point )、position Array ( Line or geometric multipoint ),position Array of arrays ( Noodles 、 Multi line ) perhaps position Multidimensional array of ( In many ways ) form .
position Represented by an array of numbers ( It can be understood as latitude and longitude ). Must have at least two elements , There can be more elements . The order of the elements must follow x,y,z The order ( The east direction of coordinates in the projection coordinate reference system 、 To the north 、 Elevation or coordinate longitude in geographic coordinate reference system 、 latitude 、 Altitude ). Any number of other elements is allowed, and this article does not discuss the project .
2.1.2. type type :Point( spot )
Right type "Point" Come on ,“coordinates" The member must be a separate position.
{
"type": "Point", "coordinates": [100.0, 0.0] }
2.1.3. type type :MultiPoint( Multipoint )
Right type "MultiPoint" Come on ,"coordinates" Members must be position Array .
{
"type": "MultiPoint",
"coordinates": [ [100.0, 0.0], [101.0, 1.0] ]
}
2.1.4. type type :LineString( Line )
Right type "LineString" Come on ,“coordinates" Members must be two or more position Array of .
A linear ring has 4 One or more position A closed line of . The first and last positions are the same ( They represent the same point ). Although linear rings do not explicitly act as GeoJSON Geometric type , However, it is mentioned in the definition of surface geometry type .
{
"type": "LineString",
"coordinates": [ [100.0, 0.0], [101.0, 1.0] ]
}
2.1.5. type type :MultiLineString( Multi line )
Right type “MultiLineString" Come on ,"coordinates" The member must be an array of linear coordinates .
{
"type": "MultiLineString",
"coordinates": [
[ [100.0, 0.0], [101.0, 1.0] ],
[ [102.0, 2.0], [103.0, 3.0] ]
]
}
2.1.6. type type :Polygon( Noodles )
Right type "Polygon" Come on ,"coordinates" The member must be an array of linear circular coordinates . For faces with multiple rings , The first ring must be an outer ring , Others must be internal rings or holes , And the direction of the inner ring and the outer ring is opposite .
Without holes :
{
"type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
]
}
Porous ( The direction of the outer ring and the inner ring is always opposite )
{
"type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],
[ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]
]
}
2.1.7. type type :MultiPlygon( In many ways )
Right type "MultiPlygon" Come on ,"coordinates" The member must be an array of face coordinates .
{
"type": "MultiPolygon",
"coordinates": [
[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
[
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]
]
]
}
2.1.8. type type :Geometry Collection( Geometric set )
The type is "GeometryCollection" Of GeoJSON An object is a collection object , It represents a collection of geometric objects . A geometric set must have a name "geometries" Members of . And "geometries" The corresponding value is an array . Each element in this array is a GeoJSON Geometry object .
{
"type": "GeometryCollection",
"geometries": [
{
"type": "Point",
"coordinates": [100.0, 0.0]
},
{
"type": "LineString",
"coordinates": [ [101.0, 0.0], [102.0, 1.0] ]
}
]
}
2.2 Feature object
The type is "Feature" Of GeoJSON The object is Feature object .
- The element object must have a name of
"geometry"Members of , The value of this geometric member is defined above geometry Object or JSON Of null value . - The element object must have a name of
“properties"Members of , The value of this property member is an object ( whatever JSON Object or JSON Of null value ). - If the element is a common identifier , Then this identifier should contain the name “id” Members of the object .
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"adcode": 610102,
"name": " New town ",
"center": [
108.959903,
34.26927
],
"centroid": [
108.991696,
34.271932
],
"childrenNum": 0,
"level": "district",
"parent": {
"adcode": 610100
},
"subFeatureIndex": 0,
"acroutes": [
100000,
610000,
610100
]
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
108.953361,
34.292663
],
[
108.953404,
34.289539
],
[
108.950857,
34.289529
]
// Multiple latitude and longitude points
]
]
]
}
}
]
}
2.2.1 “properties" member
“properties" The content of the member is to save Feature object Other attribute information , For example Feature object Of name Information, etc .
2.3. FeatureCollection object
The type is "FeatureCollection" Of GeoJSON An object is a feature set object .
The type is "FeatureCollection" The object of must have a name "features" Members of . And “features" The corresponding value is an array . Each element in this array is defined above feature object .
You can refer to 2.2 Example
3. Coordinate reference system object
GeoJSON Object's coordinate reference system (CRS) By it "crs" Members to determine . If the object does not crs member , So it's a parent or a grandparent crs Members may be acquired as its crs. If this has not yet been achieved crs member , So the default CRS Will be applied to GeoJSON object .
- default CRS Is a geographic coordinate reference system , It uses WGS84 data , The units of length and height are decimal .
- The name is "crs" The value of a member must be JSON object ( It means the following CRS object ) perhaps JSON Of null. If CRS The value of is null, Then assume that there is no CRS 了 .
- crs Members should be located at ( Feature set 、 features 、 Of geometric order ) In the hierarchy GeoJSON Top level of object , And it should not be repeated or overwritten in self objects or grandchildren .
- Non empty CRS Object has two mandatory objects :“type" and "properties”.
- type The value of a member must be a string , This string indicates CRS Type of object .
- The value of a property member must be an object .
- CRS The coordinate order cannot be changed **( see 2.1.1. Location )**
{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"features": [
// Other content
]
}
3.1. CRS
CRS Objects can pass through name To indicate the coordinate reference system . under these circumstances , its "type" The value of a member must be a string "name". its "properties" The value of a member must contain "name" Member's object . This "name" The value of the member must be a string that identifies the coordinate reference system . such as “urn:ogc:def:crs:OGC:1.3:CRS84" Of OGC CRS Of URN Should take precedence over old identifiers such as "EPSG:4326" Selected .
3.2. On-line CRS
CRS Objects can also be connected to the Internet CRS Parameters . under these circumstances , its "type" The value of a member must be a string "link", its "properties" The value of a member must be a linked object .
- The connection object consists of a required member :“href”, And an optional member :“type”.
- Essential "href" The value of a member must be dereferenced URI( Unified resource identification ).
- Optional "type" The value of a member must be a string , And this string implies the provided URI Used in to indicate CRS Parameter format . The recommended value is :“proj4”,“ogcwkt”,esriwkt", However, other values can be used .
{
"type": "FeatureCollection",
"crs": {
"type": "link",
"properties": {
"href": "http://example.com/crs/42",
"type": "proj4"
}
},
"features": [
// Other content
]
}
The auxiliary file of the relative path can also be used as CRS Deal directly with :
{
"type": "FeatureCollection",
"crs": {
"type": "link",
"properties": {
"href": "data.crs",
"type": "ogcwkt"
}
},
"features": [
// Other content
]
}
4.Bounding Boxes
To include geometry、feature perhaps feature collection Coordinate range information ,GeoJSON The object may have a name of "bbox Members of .bbox The value of a member must be 2*n Array , here n Is the number of dimensions of the contained geometric objects , And the maximum and minimum values of all coordinate axes .bbox The order of the coordinate axes of follows the order of the geometric coordinate axes . besides ,bbox The coordinate reference system of is assumed to match where it is located GeoJSON Object's coordinate reference system .
feature On the object bbox Examples of members :
{
"type": "Feature",
"bbox": [-180.0, -90.0, 180.0, 90.0],
"geometry": {
"type": "Polygon",
"coordinates": [[
[-180.0, 10.0], [20.0, 90.0], [180.0, -5.0], [-30.0, -90.0]
]]
}
}
feature collection In the object bbox Examples of members :
{
"type": "FeatureCollection",
"bbox": [100.0, 0.0, 105.0, 1.0],
"features": [
// Other content
]
}
Reference resources :
https://zhuanlan.zhihu.com/p/510882183
https://blog.csdn.net/qq_36213352/article/details/117534921
边栏推荐
- Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
- Centos8 operation record command version Yum redis MySQL Nacos JDK
- 【sylixos】NEW_1 型字符驱动示例
- 零基础多图详解图神经网络
- Numpy----np.meshgrid()
- [Yocto RM]1 - System Requirements
- Overview of drug discovery-01 overview of drug discovery
- Maimai hot post: Why are big factories keen on making wheels?
- [Yocto RM] 2 - Yocto Project Terms
- Interviewer asked: Inheritance of JS
猜你喜欢

Hi, you have a code review strategy to check!

基于AM335X开发板 ARM Cortex-A8——Acontis EtherCAT主站开发案例

The practice of dual process guard and keeping alive in IM instant messaging development

Using redis bitmap to realize personnel online monitoring

树莓派实现温控风扇智能降温

数据库查询优化:主从读写分离及常见问题

面试官问:能否模拟实现JS的new操作符

Numpy----np.reshape()

Numpy----np. reshape()

1382. 将二叉搜索树变平衡-常规方法
随机推荐
【牛客讨论区】第四章:Redis
Arrays. Aslist() pit
[Yongyi XY chair] trial experience
JS 随机数(随机数 小数)
Coscon'22 lecturer solicitation order
Chapitre 4: redis
网络爬虫是什么
Set collection usage
[Yocto RM]3 - Yocto Project Releases and the Stable Release Process
如何阅读一篇论文
Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection
【永艺XY椅】试用体验
[Yocto RM] 2 - Yocto Project Terms
如何理解 Transformer 中的 Query、Key 与 Value
Neural network of zero basis multi map detailed map
Jenkins - 邮件通知 Email Notification 插件
I/o limit process and CPU limit process
基于可学习尺寸自适应分子亚结构的药物相互作用预测
【牛客討論區】第四章:Redis
Solon 1.8.3 release, cloud native microservice development framework