<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=375564121-06032010><FONT face=Arial
color=#0000ff size=2>Hi,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=375564121-06032010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=375564121-06032010><FONT face=Arial
color=#0000ff size=2>i would think, that you have to use geojson instead of
json, to get the geometry for the features.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=375564121-06032010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=375564121-06032010><FONT face=Arial
color=#0000ff size=2>Arnd</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>Von:</B> users-bounces@openlayers.org
[mailto:users-bounces@openlayers.org] <B>Im Auftrag von
</B>Hugo<BR><B>Gesendet:</B> Samstag, 6. März 2010 19:14<BR><B>An:</B>
openlayers<BR><B>Betreff:</B> [OpenLayers-Users] Make vector layer from
JSON<BR></FONT><BR></DIV>
<DIV></DIV>Hello all,<BR><BR>I'm trying to create a vector layer based on a php
query (which includes the_geom) encoded in JSON. Until the moment i haven't been
able to achieve this.<BR>Following, is the relevant part of the code:<BR><BR>var
connect = new Ext.data.Connection();<BR>connect.request({<BR>
url: 'mfbase/geoquery.php',<BR> params:
{<BR> species:
species,<BR> datai:
datai,<BR> dataf:
dataf<BR> },<BR> success:
function(response){<BR> var resp =
response.responseText;<BR> var json = new
OpenLayers.Format.JSON();<BR> var data =
json.read(resp);<BR>
//console.log(data[0].the_geom);<BR>
<BR> var querylayer1 = new
OpenLayers.Layer.Vector(<BR>
'Query1',<BR>
{<BR>
isBaseLayer: false,<BR>
projection: wgs,<BR>
geometryName:
'the_geom',<BR>
}<BR> );<BR>
<BR>
querylayer1.addFeatures(data);<BR>
map.addLayer(querylayer1);<BR> }<BR>})<BR clear=all><BR>Any
suggestions are more than welcomed :)<BR>Thanks to you
all!<BR><BR>Cheers,<BR><BR><BR>-- <BR>Hugo
Martins<BR>FMV-UTL<BR>CIISA-Epidemiologia e Saúde Pública Veterinária<BR>Av. da
Universidade Técnica<BR>1300-477 Lisboa<BR>N 38°42'49.54", W
9°11'43.42"<BR></BODY></HTML>