[OpenLayers-Users] trouble parsing a php result for attributes plus geometry

karlg karl.geog at gmail.com
Sun Feb 19 00:13:17 EST 2012


Hello - Any help on this is much appreciated - several hours at it already...

I use OpenLayers.Request.GET() to retrieve a single MULTILINESTRING result
with associated attributes, Cost and Length. If I have the PHP simply return
the 5th item in the single row array (a GeoJSON string) I can add the
feature to a map just fine. 

But I want to get the values for Cost and Length as well, and have them
appear elsewhere on the calling page. So I return json_encode($string), and
Firebug shows me 

Hard to copy properly into this forum, but very odd, but each field appears
twice. I try to parse it with this function, and get back the full string as
above when I do alert(response); But alert(cost)' gives me undefined when I
try to read the attributes from the response text.


I'm at my wits end and have scoured the web for examples of what I'm trying
to do and found none specific to PHP calls to databases and handling more
than collections of geometries. I can make geometries appear on the map --
it's the associated attribute data that's got me tearing hair.
Thanks in advance

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/trouble-parsing-a-php-result-for-attributes-plus-geometry-tp4484609p4484609.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list