That's a cut and paste error. Should I have a crs element? 

Sent from Samsung Mobile

-------- Original message --------
From: "Frank Broniewski <b...@metrico.lu>" <b...@metrico.lu> 
Date:  
To:  
Subject: Re: [Community] geoJSON 
 
Hi,

it does look OK to me, but you have line breaks in your GeoJson. Is this

a copy&paste error? If not, you should maybe remove them because that 
could really screw up the OL parser (see the "ftype": "N
  AT" and "name": "Department o
  f Conservation" pieces in your example)

Frank

Am 2013-07-16 06:32, schrieb Robert Sanson:
> I am working on a Python server-side script to take an uploaded GPX
file, parse it to do some spatial queries, and then format it into
geoJSON to return it to an OpenLayers client.
>
> How critical is the order of the id, properties and geometry elements
in the geoJSON features?
>
> Here are some snippets of Python code:
>
> import json, geojson
>
> #create list to hold geojson features
>   fl = []
>
> #For each waypoint
> for wpt in gpx.waypoints:
>      #create geojson point based on the lat/longs in the GPX file
re-projected to a cartesian coordinate system
>      gw = geojson.Point([str(x) +"," + str(y)])
>
>      #Prepare my attributes
>      attr =
{"date":wpt.comment,"fid":fid,"ftype":ftype,"fsize":fsize,"name":name,"postal1":postal1,"postal2":postal2,"postal3":postal3,"postalrd":postalrd,"postal4":postal4,"town":town,
>                     
"pcode":pcode,"homeph":homeph,"busph":busph,"mobile":mobile,"email":email,"elevation":str(wpt.elevation),"gheight":str(height),"htdiff":str(htdiff),"colour":colour}
>
>      #create the geoJSON feature and add it to the list
>      gf = geojson.Feature(id=wpt.name,properties=attr,geometry=gw)
>       fl.append(gf)
>
> #finally put together in a feature collection
>   fc = geojson.FeatureCollection(fl)
>   print geojson.dumps(fc)
>
> Here is an example output by my script:
>
> {"type": "FeatureCollection", "features": [{"geometry": {"type":
"Point", "coordinates": ["1455676.30192,5249213.99569"]}, "type":
"Feature", "properties": {"town": "Hokitika", "postal1": null,
"postal2": null, "postal3": "Private Bag 701", "postal4": null, "name":
"Department of Conservation", "busph": "037568282", "mobile": null,
"colour": "brown", "fsize": 1035820.0, "gheight": "355.379", "pcode":
"7810", "ftype": "NAT", "fid": "WS00041", "htdiff": "13.4206970215",
"date": "04-NOV-12 11:19:34AM", "elevation": "368.8", "homeph": null,
"email": "westco...@doc.govt.nz", "postalrd": null}, "id": "045"},
{"geometry": {"type": "Point", "coordinates":
["1455737.89165,5249119.87719"]}, "type": "Feature", "properties":
{"town": "Hokitika", "postal1": null, "postal2": null, "postal3":
"Private Bag 701", "postal4": null, "name": "Department of
Conservation", "busph": "037568282", "mobile": null, "colour": "brown",
"fsize": 1035820.0, "gheight": "381.533", "pcode": "7810", "ftype": "N
>   AT", "fid": "WS00041", "htdiff": "-1.23302001953", "date":
"04-NOV-12 11:19:41AM", "elevation": "380.3", "homeph": null, "email":
"westco...@doc.govt.nz", "postalrd": null}, "id": "046"}, {"geometry":
{"type": "Point", "coordinates": ["1456220.5418,5248259.03474"]},
"type": "Feature", "properties": {"town": "Hokitika", "postal1": null,
"postal2": null, "postal3": "Private Bag 701", "postal4": null, "name":
"Department of Conservation", "busph": "037568282", "mobile": null,
"colour": "brown", "fsize": 1035820.0, "gheight": "606.078", "pcode":
"7810", "ftype": "NAT", "fid": "WS00041", "htdiff": "46.5215087891",
"date": "04-NOV-12 11:20:59AM", "elevation": "652.6", "homeph": null,
"email": "westco...@doc.govt.nz", "postalrd": null}, "id": "047"},
{"geometry": {"type": "Point", "coordinates":
["1456236.64781,5248056.9161"]}, "type": "Feature", "properties":
{"town": "Hokitika", "postal1": null, "postal2": null, "postal3":
"Private Bag 701", "postal4": null, "name": "Department o
>   f Conservation", "busph": "037568282", "mobile": null, "colour":
"brown", "fsize": 1035820.0, "gheight""ftype": "NAT", "fid": "WS00041", 
"htdiff": "36.7909545898", "date":
"04-NOV-12 11:24:44AM", "elevation": "785.0", "homeph": null, "email":
"westco...@doc.govt.nz", "postalrd": null}, "id": "048"}, {"geometry":
{"type": "Point", "coordinates": ["1447818.17744,5244104.27075"]},
"type": "Feature", "properties": {"town": "", "postal1": "", "postal2":
"", "postal3": "", "postal4": "", "name": "", "busph": "", "mobile": "",
"colour": "brown", "fsize": 0, "gheight": "377.242", "pcode": "",
"ftype": "", "fid": "", "htdiff": "52.3581481934", "date": "04-NOV-12
11:37:05AM", "elevation": "429.6", "homeph": "", "email": "",
"postalrd": ""}, "id": "049"}]}
>
> Does this look correct?
>
> Is there some other way to prepare the properties rather than using a
dictionary?
>
> I am having trouble getting OpenLayers to consume this
>
> Many thanks,
>
> Robert Sanson
>
>
> This email and any attachments are confidential and intended solely
for the addressee(s). If you are not the intended recipient, please
notify us immediately and then delete this email from your system.
>
> This message has been scanned for Malware and Viruses by Websense
Hosted Security.
> www.websense.com
> _______________________________________________
> Community mailing list
> Community@lists.gispython.org
> http://lists.gispython.org/mailman/listinfo/community
>
>


-- 
Frank BRONIEWSKI

METRICO s.à r.l.
géomètres
technologies d'information géographique
rue des Romains 36
L-5433 NIEDERDONVEN

tél.: +352 26 74 94 - 28
fax.: +352 26 74 94 99
http://www.metrico.lu
_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

Reply via email to