2011-10-09 2 views
1

이것이 제 GeSJON 결과입니다. PasteBin 하지만로드 할 때 방화 상자에 넣은 결과는 기능이 null입니다. 왜 그게 내 결과에 오류가 있습니까? JSON의 좌표는 투영 WGS84로 작성되었으며, 코드에서는 externalProjection을 WGS84로 설정했습니다. 그렇다면 왜 "feature is null"이라는 리턴을 얻습니까? 샘플 OpenLayer 코드가 제대로 작동OpenLayers => 기능이 null입니다

$(document).ready(function() { 
var wgs84 = new OpenLayers.Projection('EPSG:4326'); 
var layer = null; 
var map = new OpenLayers.Map('map',{projection: wgs84}); 
    layer = new OpenLayers.Layer.OSM("Simple OSM Map"); 
    var baseProjection = layer.projection; 
    map.addLayer(layer); 
    map.setCenter(new OpenLayers.LonLat(10,10), 4); 
    map.events.register("moveend", null, function(){ 

     if(map.zoom == 10) 
     { 
     var bounds = map.getExtent(); 
     console.log(bounds); 
     var ne = new OpenLayers.LonLat(bounds.right,bounds.top).transform(map.getProjectionObject(),wgs84); 
     var sw = new OpenLayers.LonLat(bounds.left,bounds.bottom).transform(map.getProjectionObject(),wgs84); 
     var vectorLayer = new OpenLayers.Layer.Vector(); 
     map.addLayer(vectorLayer); 
     $.getJSON('ajax.php?a=markers&type=json&sw=('+sw.lon+','+sw.lat+')&ne=('+ne.lon+','+ne.lat+')',function(data){ 
     //$.getJSON('test.json',function(data){ 
      var geojson_format = new OpenLayers.Format.GeoJSON({ 
       'externalProjection': wgs84, 
       'internalProjection': baseProjection 
       }); 
      vectorLayer.addFeatures(geojson_format.read(data)); 
     }); 
     } 
    }); 
}); 

답변

2

, 문제는 GeoJSON에 있습니다 : 내지도를 관리하는 데 사용할 코드는 당신이 로 "coordninates"

을 조정 맞춤법이 틀린