2016-12-13 6 views
1

나는 현재 Openlayers2을 사용하여지도를 개발 중입니다. 이지도는 여러 가지 정보를 보여주고있다사용자 정의 div 태그를 오픈 레이어에 삽입하십시오.

이미 톤

  • OpenLayers.Layer.Vector 사용하여 이미지 캔버스를 통합 관리

    ->에 대한 기본 이미지와 벡터

  • OpenLayers.StyleMap 및 OpenLayers를 .Style -> 캔버스 및 텍스트

텍스트를 통합하는 여러 개의 상자를 삽입해야합니다.

상자는 각각 길이가 다른 텍스트에 적응해야합니다.

:

내가 대신

정보는 JSON에서 통합 (적응하기 어려운 취급이 매우 무거운) 캔버스의, 사업부처럼 사용자 정의 HTML 태그를 삽입하는 지금 싶습니다 JSON의

{ 
 
    
 
     "type": "FeatureCollection", 
 
     "features": [{ 
 
      "type": "Feature", 
 
      "geometry": { 
 
       "type": "Point", 
 
       "coordinates": [ 
 
        589200.0, 
 
        2402900.0 
 
       ] 
 
      }, 
 
      "properties": { 
 
       "activation": "true", 
 
       "info": "one for example short text" 
 
    
 
      } 
 
     }, { 
 
      "type": "Feature", 
 
      "geometry": { 
 
       "type": "Point", 
 
       "coordinates": [ 
 
        603700.0, 
 
       2408300.0 
 
       ] 
 
      }, 
 
      "properties": { 
 
      "activation": "true", 
 
       "info": My other very long text \n with lines \r different messages and so on\n and it has to fit in.." 
 
    
 
      } 
 
     }] 
 
    }
,

그것은 기존의 맵이며, 해결책은 버전 3

내가 desesperately 그물에 맞게 할 수있는 솔루션을 검색하고 함께하지 않을 것이다, 그래서 우리는 성공을하지 않고, Openlayer 2 stucked된다 , 그러나 나는 그것으로 소중한 시간을 잃어 가고있다.

new OpenLayers.Layer.Vector("Vector", { 
 
      layername: "myText", 
 
      resolutions: [100, 50, 25, 10], 
 
      styleMap: textStyleMap, 
 
      isBaseLayer: false, 
 
      visibility: false, 
 
      strategies: [new OpenLayers.Strategy.Fixed({ 
 
       preload: true 
 
      })], 
 
      protocol: new OpenLayers.Protocol.HTTP({ 
 
       url: "myText.json", 
 
       format: new OpenLayers.Format.GeoJSON() 
 
      }) 
 
     })

내가 스타일 맵의 어떤 종류를 사용할 수 있습니다

정보는이 방법을로드? 누구에게 문제의 해결책이 있습니까?

감사합니다.

답변