Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenLayers => feature is null
    primarykey
    data
    text
    <p>This is my GeoJSON result. <a href="http://pastebin.com/5cnYi9J1" rel="nofollow">PasteBin</a> But when I load it, the result I get in firebug is feature is null. Why's that, are there any errors in my result? The coords in the JSON is written in projection WGS84, and in the code I also have set the externalProjection as WGS84. So why do I get the return "feature is null"? The code I use to manage my map is :</p> <pre><code>$(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&amp;type=json&amp;sw=('+sw.lon+','+sw.lat+')&amp;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)); }); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload