카테고리 없음

JSON to GeoJSON

Neda 2023. 4. 19. 19:07

1. GeoJSON

1.1 GeoJSON이란?

GeoJSON은 자바스크립트 기반의 지리 공간 데이터 교환 형식이다
-rfc7946

 

1.2. GeoJSON 예시

 

1.2.1 Point (점)

  • 아래의 JSON은 한 점 [40,5]라는 위치 정보(coordinates)를 가지고 있는 Point GeoJSON이다.
  • 경도, 위도를 배열의 요소로 가짐
{ type: "Point", coordinates: [ 40, 5 ] }

 

1.2.3 MultiPoint (여러 점)

  • 아래의 JSON은 여러 점의 위치 정보 배열(coordinates)을 가지고 있는 MultiPoint 타입 GeoJSON이다.
  • Point를 배열의 요소로 가짐
{ type: "MultiPoint", coordinates: [[ 40, 5 ], [30, 2], [50, 10]] }

 

1.2.3 LineString (선)

  • 아래의 JSON은 두 개 이상의 점의 위치 정보 배열(coordinates)을 가지고 있는 LineString 타입 GeoJSON이다.
  • MultiPoint와 비슷하지만, 여러 점을 이어서 선을 만든다.
  • Point를 배열의 요소로 가짐
{ type: "LineString", coordinates: [[ 40, 5 ], [30, 2], [50, 10]] }

 

1.2.3 MultiLineString (여러 선)

  • 아래의 JSON은 LineString을 요소로 하는 배열(coordinates)을 가지고 있는 MultiLineString  타입 GeoJSON이다.
  • LineString을 배열의 요소로 가진다
{ 
type: "LineString", coordinates: [
	[ [ 40, 5 ], [30, 2], [50, 10] ],
    [ [ 20, 5 ], [60, 2], [30, 10] ],
]
}

 

 

1.3 GeoJSON 참고자료

GeoJSON 페이지

 

GeoJSON

GeoJSON GeoJSON is a format for encoding a variety of geographic data structures. { "type": "Feature", "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }, "properties": { "name": "Dinagat Islands" } } GeoJSON supports the following geometry type

geojson.org

Geojson  rfc 페이지

 

RFC ft-ietf-geojson: The GeoJSON Format

GeoJSON is a geospatial data interchange format based on JavaScript Object Notation (JSON). It defines several types of JSON objects and the manner in which they are combined to represent data about geographic features, their properties, and their spatial

datatracker.ietf.org

 

mongodb

 

GeoJSON Objects — MongoDB Manual

Docs Home → MongoDB Manual MongoDB supports the GeoJSON object types listed on this page.To specify GeoJSON data, use an embedded document with:a field named type that specifies the GeoJSON object type anda field named coordinates that specifies the obje

www.mongodb.com

 

google Maps

 

데이터 영역  |  Maps JavaScript API  |  Google Developers

의견 보내기 데이터 영역 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 플랫폼 선택: Android iOS JavaScript Google 지도 데이터 영역은 임의의 지리 공간 데이터

developers.google.com

 

 

1.4 openapi json 변경하기

아래와 같은 데이터를 xml or json으로 받아올 수 있다.

{
"lat": 33.09,
"loc": "제주 서귀포시 서쪽 108km 해역",
"lon": 125.42,
"mt": 2.6,
"tmEqk": 20230419004507,
"tmFc": 202304190047,
"dep": 14
}

경도, 위도 값은 'coordinates'에 넣고

나머지는 'propperties'에 넣을 수 있다.

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [125.42, 33.09]
  },
  "properties": {
    "location": "제주 서귀포시 서쪽 108km 해역",
    "magnitude": 2.6,
    "time": "2023-04-19T00:45:07Z",
    "depth": 14
  }
}