On Oct 2, 2009, at 14:00, Christian Schanz wrote:

> Hello,
>
> I need a function that returns a featurecollection which is created
> from a GeoJSON.
> So I think that I need to do something like the following:

I do this (uses prototype.js):
var vector_layer = new OpenLayers.Layer.Vector('A Layer',{
         sphericalMercator: true,
       });
new Ajax.Request("YOUR_URL_HERE", {
   onSuccess: function(response){
     route_json= new OpenLayers.Format.GeoJSON()
     vector_layer.addFeatures(route_json.read(response.responseText));
     }
   }
);


However, for some reason it's not actually displaying on the map, even  
though
map.zoomToExtent(vector_layer.getDataExtent()) zooms to where the  
layer *should* be.


> And as a second question: Should my GeoJSON generating server insert a
> mime-type at the beginning of the
> response or is this not needed?

Shouldn't be needed.

d.

_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to