<!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.6002.18332" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=Arial size=2>If you are going to be creating valid GeoJSON from
geoDjango then just use the OpenLayers.Format.GeoJSON format reader. If you are
just getting JSON with some non-GeoJSON mix of attributes and geo properties,
then you will need to write a function to parse the output of
OpenLayers.Format.JSON into OpenLayers.Feature objects. The best practice in
that case would be to actually sub-class the OpenLayers.Format.JSON parser into
your custom parser, but you could also just do that function in your application
logic.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>To handle requests to the server, I would recommend
using a GeoExt.data.FeatureStore with a GeoExt.data.ProtocolProxy created from
an OpenLayers.Layer.Vector with an HTTP protocol. Here is an
example:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>var vectorLyr = new
OpenLayers.Layer.Vector('layer',{<BR>protocol: new
OpenLayers.Protocol.HTTP({<BR>
url:
'http://myserver.com/geo',<BR>
format: new
OpenLayers.Format.GeoJSON()<BR>
})<BR>});</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>var featStore = new
GeoExt.data.FeatureStore({<BR>fields:['foo',{name:'bar',type:'int'}],<BR>proxy:new
GeoExt.data.ProtocolProxy({protocol:vectorLyr.protocol})<BR>});</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>now you can hook the feature store up to a grid or
other data view, etc... </FONT></DIV>
<DIV><FONT face=Arial size=2>You can use normal Ext.data.Store load methods and
options to update the store or you can go the other way and use an
OpenLayers.Strategy within the vector layer to have it reload itself at
appropriate times.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Matt Priour</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><FONT face=Arial></FONT><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=andrew@source3.com
href="mailto:andrew@source3.com">Andrew Parker</A> </DIV>
<DIV><B>Sent:</B> Thursday, February 03, 2011 7:56 AM</DIV>
<DIV><B>To:</B> <A title=users@geoext.org
href="mailto:users@geoext.org">users@geoext.org</A> </DIV>
<DIV><B>Subject:</B> [Users] Best way to enter feature properties using a json
server backend?</DIV></DIV></DIV>
<DIV><FONT face=Arial size=2></FONT><BR></DIV>Hello Mike:<BR><BR>I am planning
to do the same thing as you, however, you are a month <BR>ahead of me. My
initial plan is to use geodjango to obtain attribute <BR>data from a postGIS
database and feed it back to GeoEXT/OpenLayers via JSON.<BR><BR>I do not yet
know how to do this but I thought this may give you some <BR>ideas how to
proceed. Perhaps we can work together to figure this out?<BR><BR>--
<BR>Andrew Parker<BR>Source3 Computing,
LLC<BR><BR><BR><BR>_______________________________________________<BR>Users
mailing list<BR><A href="mailto:Users@geoext.org">Users@geoext.org</A><BR><A
href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</A><BR></BODY></HTML>