Hi, Try this
var theObj = { "type":"Feature", "id":"OpenLayers.Feature.Vector_107", "properties": {"icon":"icon_1.jpg"}, "geometry": {"type":"Point", "coordinates":[26.015625, 18.6328125]}, "crs": {"type":"OGC", "properties": {"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"} } }; alert(theObj["properties"]["icon"] + "\n" + theObj["geometry"]["type"]); or alert(theObj.properties.icon + "\n" + theObj.geometry.type); Arnd -----Ursprüngliche Nachricht----- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von ngreen Gesendet: Samstag, 20. Februar 2010 12:24 An: users@openlayers.org Betreff: Re: [OpenLayers-Users] OL + database It's always good to know what options are available, but in this case GeoServer etc. definitely qualify as an unnecessary complication. OL is sufficient for this job. What I needed was this: http://openlayers.org/dev/examples/vector-formats.html and this: http://www.w3schools.com/php/php_ajax_database.asp I've trimmed the code from the vector-formats example down to just geojson. That works nicely. The simple ajax script lets me interact with the database as needed and it's quite easy to convert the geojson string into php variables and vice versa. The only thing I haven't figured out is how to access specific parts of the geojson string within OL. Eg. if you copy this into the vector-formats example above: {"type":"Feature", "id":"OpenLayers.Feature.Vector_107", "properties":{"icon":"icon_1.jpg"}, "geometry":{"type":"Point", "coordinates":[26.015625, 18.6328125]}, "crs":{"type":"OGC", "properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}} You can see that everything gets pulled into OL by the script. On my own page I can return the id and coordinates via feature.id and feature.geometry.x /y, but so far have had no luck trying to access other parts, eg. "properties":{"icon":"icon_1.jpg"}. Any geojson'ers know how to get at these? -- View this message in context: http://n2.nabble.com/OL-database-tp4588879p4602384.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users