Basic

OpenLayers ์˜คํ”ˆ๋ ˆ์ด์–ด

natrue 2021. 3. 24. 15:56
728x90

 

OpenLayers

์˜คํ”ˆ๋ ˆ์ด์–ด๋Š” ์˜คํ”ˆ ์†Œ์Šค ์›น ๋ธŒ๋ผ์šฐ์ €์—์„œ  ์ง€๋„ ๋ฐ์ดํ„ฐ๋ฅผ ํ‘œ์‹œํ•˜๊ธฐ ์œ„ํ•œ javaScript ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

OpenLayers๋Š” ์ง€๋„์„œ๋ฒ„๋ฅผ ์ด์šฉํ•ด์„œ ์ง€๋„๋ฅผ ๋„์šธ ์ˆ˜ ์žˆ๋Š” ์˜คํ”ˆ์†Œ์Šค

 

  • ์ง€๋„ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•˜์ง€ ์•Š์Œ.
  • ์ง€๋„์„œ๋น„์Šค๋ฅผ ํŽธ๋ฆฌํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๋„๊ตฌ 
  • ๊ธฐ๋Šฅ๋ณ„๋กœ ๋‚˜๋ˆˆ js / ์ „์ฒด๋กœ ๋ฌถ์ธ js

 

1 ) map 

์›น ์ง€๋„ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด ๊ธฐ๋ณธ์ด ๋˜๋Š” ํด๋ž˜์Šค 

์ƒ์„ฑ์ž : OpenLayers Map(div, options)

div  ์ง€๋„๋ฅผ ๋ณด์—ฌ์ค„ ์˜์—ญ ์ƒ์„ฑ์„ ์œ„ํ•œ div์ง€์ •
options   Map๊ฐ์ฒด ์ƒ์„ฑ์„ ์œ„ํ•œ ์˜ต์…˜ ๋“ค๋กœ ์˜์—ญ, ์ขŒํ‘œ๊ณ„, ๋‹จ์œ„ ๋“ฑ์„ ๋ช…์‹œํ•˜๋Š” ๋ถ€๋ถ„

 

2 ) Layer

 

Layer๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์กฐ์ž‘ํ•˜๋Š” ํ”„๋กœํผํ‹ฐ ๋ฐ ํ•จ์ˆ˜๋กœ ๊ตฌ์„ฑ๋œ ํด๋ž˜์Šค.

WMS , WFS , GML , Vector Layer ๋“ฑ์„ ์ง€์›ํ•œ๋‹ค.
Layer๋ž€ ํ˜„์‹ค์„ธ๊ณ„ feature ์˜ ์ง‘ํ•ฉ์ด๋‹ค.
ํ˜•์ƒ(feature)์ด๋ž€ ํ˜„์‹ค์„ธ๊ณ„์˜ ๋Œ€์ƒ๋“ค์„ ํ‘œํ˜„
ex) ๊ฑด๋ฌผํ•˜๋‚˜ = feature / ์ด๋“ค์˜ ์ง‘ํ•ฉ = Layer
 Map ์ปจํ…Œ์ด๋„ˆ ์œ„์— ์—ฌ๋Ÿฌ๊ฐœ์˜ Layer๋ฅผ ๋“ฑ๋กํ•˜์—ฌ ๋ณด์—ฌ์ค„ ์ˆ˜ ์žˆ๋‹ค.

 

{OpenLayers.Strategy}.class

๋ฒกํ„ฐ ๋ ˆ์ด์–ด ๋‚ด์— ์กด์žฌํ•˜๊ณ  ์žˆ๋Š” feature๋ฅผ ์–ด๋–ค ์‹์œผ๋กœ ์ง€๋„์— ํ‘œํ˜„ํ•  ๊ฒƒ์ธ์ง€๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ์ „๋žต์œผ๋กœ zoom, level, Extent ๋“ฑ์˜ ๋ณ€ํ™”๋ฅผ ๋”ฐ๋ผ Feature๋“ค์ด ํ‘œํ˜„๋˜๋Š” ๋ฐฉ์‹์— ๋ณ€ํ•˜๊ฒŒ ๋œ๋‹ค.

์ข…๋ฅ˜๋กœ๋Š” BBOX, Cluster, Filter, Fixed, Paging, Refresh, Save ํ˜ผํ•ฉํ•˜์—ฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅ.

 

 

{OpenLayers.Filter}.class

๊ณต๊ฐ„ ๋ฐ ์†์„ฑ์„ ์กฐํšŒํ•  ๋•Œ ๊ธฐ์ค€์— ๋งŒ์กฑํ•˜๋Š” Feature๋ฅผ ์„ ํƒ

๋น„๊ต ์—ฐ์‚ฐ, ๋…ผ๋ฆฌ ์—ฐ์‚ฐ, ๊ณต๊ฐ„ ์—ฐ์‚ฐ, ํ•จ์ˆ˜ ๋“ฑ์˜ ์กฐ๊ฑด๋ฌธ์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค.

 

{OpenLayers.Symbolizer}.class

๋ฒกํ„ฐ ์‹ฌ๋ณผ์˜ ์ข…๋ฅ˜์— ๋”ฐ๋ผ ์Šคํƒ€์ผ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ œ๊ณตํ•˜๋Š” ํด๋ž˜์Šค

์‹ฌ๋ณผ์˜ ์ข…๋ฅ˜์—๋Š” Line, Point, Polygon, Raster, Text๊ฐ€ ์žˆ์–ด ๊ฐ ์œ ํ˜•๋ณ„๋กœ ์Šคํƒ€์ผ์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋„๋ก ํ”„๋กœํผํ‹ฐ ์ œ๊ณต

 

 

{OpenLayers.Style}.class

Symbolizer์˜ ํ•ด์‹œ ํ”„๋กœํผํ‹ฐ๋ฅผ ์ „๋‹ฌํ•˜์—ฌ Style ํด๋ž˜์Šค ์ƒ์„ฑ

ํ•˜๋‚˜์˜ ์Šคํƒ€์ผ์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

 

 

{OpenLayers.StyleMap}.class

Style ํด๋ž˜์Šค๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋œ ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๊ฐœ์ฒด๋ฅผ StyleMap์˜ ์ƒ์„ฑ์ž์— ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋‹ค. 

StyleMap์—๋Š” ๋„ค ๊ฐ€์ง€ ์ข…๋ฅ˜ ( “default” , “temporary”, “select” ,”delete”) ํƒ€์ž…์ด ์žˆ๋‹ค.

 

 

3) Controls

OpenLayers์—์„œ Control์€ ์ง€๋„ ์˜์—ญ ๋‚ด์˜ ์ง€๋„๋ฅผ ํ™•๋Œ€, ์ถ•์†Œ, ์ด๋™๊ณผ ๊ฐ™์€ ์กฐ์ž‘ ํ–‰์œ„๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋Š” ๊ฐ์ฒด์ด๋‹ค.

OpenLayer๋Š” ์•ฝ 40๊ฐœ์˜ ์ปจํŠธ๋กค์„ ์ง€์›

 

  • ์‚ฌ์šฉ์ž์™€ ์ง€๋„ ๊ฐ„์˜ ์ƒํ˜ธ์ž‘์šฉ์„ ์œ„ํ•œ ๋„๊ตฌ 
  • ๊ฐ€์žฅ ์ผ๋ฐ˜์ ์ด๋ฉฐ ์ฃผ์š”ํ•œ ์š”์†Œ์ด๋‹ค.
  • ์ข…๋ฅ˜๋Š” ์•ฝ 46๊ฐ€์ง€
control ์ถ”๊ฐ€ map.addControl();
control ์‚ญ์ œ map.removeControl();

 

 

4) view

์ง€๋„์˜ ํ•ด์ƒ๋„ ๋ฐ ํšŒ์ „ ๊ฐ™์€ ๋น„์ฃผ์–ผ ๊ด€๋ฆฌ ํด๋ž˜์Šค

EPSG:3857 ๊ตฌ๊ธ€ ์ขŒํ‘œ๊ณ„ = ๊ธฐ๋ณธ๊ฐ’

EPSG:4326 ๊ฒฝ์œ„๋„ ์ขŒํ‘œ๊ณ„

 


OpenLayers ์ง€๋„ ๋„์šฐ๊ธฐ 

 

1) div ์˜์—ญ ์„ค์ •

<div id="map" style="width: 1024px; height: 768px"></div>

 

2) OpenLayers๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด JS, CSS ํŒŒ์ผ

<link rel="stylesheet" href="./GIMap/Theme/default/style.css" type="text/css" />

<link rel="stylesheet" href="style.css" type="text/css" />

<script type="text/javascript" src="./GIMap/OpenLayers/OpenLayers.js"></script>

 

3) {OpenLayers.Map} class๋กœ  Map Object ์ƒ์„ฑ

     {OpenLayers.Layer} class๋กœ Layer ์ƒ์„ฑ

<script type="text/javascript">
  var map = new ol.Map({
    target: 'map',
    layers: [
      new ol.layer.Tile({
      source: new ol.source.OSM()
    })
  ],
  view: new ol.View({
    center: ol.proj.fromLonLat([37.41, 8.82]),
    zoom: 4
  })
});
</script>

'Basic' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[html] table colspan rowspan  (0) 2021.04.14
[java] equals ๊ณผ == ์˜ ์ฐจ์ด  (0) 2021.04.07
์ ˆ๋Œ€๊ฒฝ๋กœ ์ƒ๋Œ€๊ฒฝ๋กœ ์ฐจ์ด  (0) 2021.01.14
Simple jquery coding test site  (0) 2021.01.12
์ž๋ฃŒ๊ตฌ์กฐ (Data Structure)  (0) 2020.09.17