Discussion:
[Community] Shapely 1.2.17 release
Sean Gillies
2013-01-27 18:53:02 UTC
Permalink
Dear all,

Shapely 1.2.17 has been tagged and an sdist has been uploaded to PyPI:

https://github.com/Toblerity/Shapely/issues/42 (source release, closed)

Here is the issue for windows binaries:

https://github.com/Toblerity/Shapely/issues/43 (windows binaries, open)

Changes:

- Avoid circular import between wkt/wkb and geometry.base by moving calls
to GEOS serializers to the latter module.
- Set _ndim when unpickling (issue #6).
- Don't install DLLs to Python's DLL directory (#37).
- Add affinity module of affine transformation (#31).
- Fix NameError that blocked installation with PyPy (#40, #41).

Thank you, everyone, and especially Mike Toews: the affine
transformations are a great addition. Fixing the DLL installation bug
took priority over getting the manual updated, but we'll get that done
before the next release.

--
Sean Gillies
Robert Sanson
2013-07-16 04:32:10 UTC
Permalink
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": "westcoast at 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": "NAT", "fid": "WS00041", "htdiff": "-1.23302001953", "date": "04-NOV-12 11:19:41AM", "elevation": "380.3", "homeph": null, "email": "westcoast at 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": "westcoast at 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 of Conservation", "busph": "037568282", "mobile": null, "colour": "brown", "fsize": 1035820.0, "gheight": "748.209", "pcode": "7810", "ftype": "NAT", "fid": "WS00041", "htdiff": "36.7909545898", "date": "04-NOV-12 11:24:44AM", "elevation": "785.0", "homeph": null, "email": "westcoast at 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
Frank Broniewski
2013-07-16 06:38:19 UTC
Permalink
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": "westcoast at 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": "westcoast at 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": "westcoast at 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": "748.209", "pcode": "7810", "ftype": "NAT", "fid": "WS00041", "htdiff": "36.7909545898", "date": "04-NOV-12 11:24:44AM", "elevation": "785.0", "homeph": null, "email": "westcoast at 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 at 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
Robert Sanson
2013-07-17 20:58:52 UTC
Permalink
Dear T?nis

Yes, that was it.

Many thanks,

Robert

>>> T?nis K?rdi<Tonis.Kardi at regio.ee> 16/07/2013 10:20 p.m. >>>
Hello, seems like the list rejected my mail, but i'll forward it tou
You still.. hope it helps.

All the best,
T?nis K?rdi
________________________________________
Saatja: T?nis K?rdi
Saadetud: 16. juuli 2013. a. 13:11
To: gispython.org community projects
Teema: Vs: [Community] geoJSON

.. {"geometry": {"type": "Point", "coordinates":
["1456220.5418,5248259.03474"]} ..

Not really sure, but coordinates should be without the double quotes
like
{"geometry": {"type": "Point", "coordinates":
[1456220.5418,5248259.03474]}
methinks. And I'd put types all lowercased aswell, that is
"type":"point" or "type":"linestring".

all the best,
t?nis k.
________________________________________
Saatja: Robert Sanson [Robert.Sanson at asurequality.com]: nimel
community-bounces at lists.gispython.org
[community-bounces at lists.gispython.org]
Saadetud: 16. juuli 2013. a. 7:32
To: gispython.org community projects
Teema: [Community] geoJSON

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": "westcoast at 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":
"westcoast at 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":
"westcoast at 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": "748.209", "pcode": "7810",
"ftype": "NAT", "fid": "WS00041", "htdiff": "36.7909545898", "date":
"04-NOV-12 11:24:44AM", "elevation": "785.0", "homeph": null, "email":
"westcoast at 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
Robert Sanson
2013-07-16 08:30:37 UTC
Permalink
That's a cut and paste error. Should I have a crs element?


Sent from Samsung Mobile

-------- Original message --------
From: "Frank Broniewski <brfr at metrico.lu>" <brfr at 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": "westcoast at 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":
"westcoast at 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": "westcoast at 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":
"westcoast at 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 at 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 at lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20130716/70f6b881/attachment.htm>
Loading...