[OpenLayers-Users] GeoJSON layer on top of google

Christopher Schmidt crschmidt at metacarta.com
Sat Jun 28 11:32:42 EDT 2008


On Sat, Jun 28, 2008 at 04:39:19PM +0200, Adorian Ardelean wrote:
> Hi,
> 
> I am trying to load a GeoJSON file in a layer on top of a google map
> (OpenLayers 2.6).
> 
> I used for now:
> var colfeatures = new OpenLayers.Layer.GML("specimens", "geojson.php",
> {format: OpenLayers.Format.GeoJSON});
> map.addLayer(colfeatures);
> 
> Entities show up on the map somewhere close to 0,0. For other vector
> entities (coordinates) I push through code this is solved with
> 
> var g = new OpenLayers.Projection("EPSG:4326");
> var p = new OpenLayers.Projection("EPSG:900913");
> 
> and .tranform(g,p)
> 
> but I do not know how to apply this directly on features read from GeoJSON.
> Is there a way to loop through all entities in colfeatures and apply
> transform(g.p) or can somebody suggest me a better approach?
{format: OpenLayers.Format.GeoJSON} ->
 { format: OpenLayers.Format.GeoJSON, 
   projection: new OpenLayers.Projection("EPSG:4326")
 }

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list