Cute Happy Ghost
본문 바로가기
QGIS·Geo

geoserver,openlayers활용하여 heatmap지도에 표출하기

by JENN_tech7 2022. 9. 27.
728x90
SMALL

baseUrl은 geoserver서버주소와 작업공간을 넣어줌

openlayers소스 사용해서 넣어주면 된다

typeName에 저장소와 발행한 레이어명 넣어주기

geoserver에서 json으로 불러올거니까 kml파일이 아닌 geojson format으로 형식맞춰주기

visible, zIndex는 option

blur는 진하기 정도, radius는 heatmap 원형의 크기를 나타냄

var baseUrl = "http://210.***.***.***/geoserver/dabio";

layer_heat = new ol.layer.Heatmap({
      source: new ol.source.Vector({
         url: baseUrl+'/wfs?service=WFS&version=1.0.0&request=GetFeature&typeName=dabio:layer_heat&&outputFormat=application%2Fjson',
         crossOrigin : 'anonymous',
         format: new ol.format.GeoJSON()
      }),
      visible: false,
      type: 'heatmap',
      blur:30,
      radius: 20,
      zIndex: 85,
      layerId:'layer_heat',
});

 

 

이런식으로 잘 나오는 것을 볼 수 있음

 

 

 

참고 ref

https://openlayers.org/en/v4.6.5/examples/heatmap-earthquakes.html?q=heatmap 

 

Earthquakes Heatmap

Demonstrates the use of a heatmap layer. This example parses a KML file and renders the features as a ol.layer.Heatmap layer.

openlayers.org

 

728x90
LIST

댓글