[OpenLayers-Users] Adding a GeoJSON Layer

Christopher Schmidt crschmidt at metacarta.com
Sun Mar 30 15:24:44 EDT 2008


On Sun, Mar 30, 2008 at 06:11:05PM +0100, Bjorn Sandvik wrote:
> Hi,
> 
> I'm looking at possibilities of using OpenLayers for thematic mapping 
> (thematicmapping.org), and I think GeoJSON might be a suitable format 
> for choropleth maps.
> 
> I'm able to generate GeoJSON on the server using PHP, and my country 
> polygons are rendered in OpenLayers when I'm pasting the GeoJSON code 
> on: http://www.openlayers.org/dev/examples/vector-formats.html
> 
> My question: What is the best way to load and render a GeoJSON layer in 
> OpenLayers?

new OpenLayers.Layer.GML("My GeoJSON Layer", "/file.geojson", 
  {format: OpenLayers.Format.GeoJSON}); 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list