[Nodeshot] restfull( geojson, OpenLayers, Django) potential nodeshot improvements

Giuseppe De Marco peppelinux at yahoo.it
Sat Jul 27 23:08:02 CEST 2013


> nemesis ha scritto:

> Yes, geodjango is in use. We use it to be able to do spatial queries and define areas and might be used to save links as lines too.

> I don't know the answer to the other questions because I started studying geodjango in the recent months and I'm no expert about it.


I used geoDjango always with postgis, I never tried to use geoDjango without postgis. In my last projects I use pure Django.

I developed in postgis and after more then a year I decided that I really don't need it unless if I must save shapes/raster on DB or unless if I must do spatial queries on entities saved in DB. So in the last two webgis that I developed I decided to avoid postgis because I've found some pure python alternatives (ogr+wkt).

I've dump from postgis just the  spatial_ref_sys table. I use it for supporting reprojection and srs definitions; but nodeshot uses only EPSG 4326, so I really don't think that reprojections could be usefull, neither all the other stuffs coming with postgis.

It's a nice play but is very huge to backup and clone on other system with different software versioning, it could also oversize your DB more than you need and could became a cumbersome entertainer for DBA/sysadmin tasks. For this reason I decided that when I must use postGIS this must be decoupled, in settings.py I use flags to activate/deactivate postgis features in views.py.

> If you have a proposal to optimize thing go ahead and install it as
    you prefer and then let me see the result.

I've installed it some days ago, I've not saved entities on DB yet so I've not understand how "lines" are managed. I can say that in projects that I'm developing I've found geoJSON very flexible and helpfull in most cases, I'm constantly replacing shapes file with geojson dumps and I render them with OpenLayers. I produce geoJSON objects with django models class methods, they simply returns a dictionary with all attributes and geometries dumped from a CharField that contains WKT polygons and others informations.

as you can see from the next example geoJSON is very similar to WKT and viceversa. 
the geomet python library could also improve the task:

<a popular example: from geojson to WKT>
from geomet import wkt
point = {'type': 'Point', 'coordinates': [116.4, 45.2, 11.1]}
wkt.dumps(point, decimals=4)

'POINT (116.4000 45.2000 11.1000)'

<//a popular example>

geoJSON it's faster to implement with OpenLayers, it could mangle the geometry and infinite attributes. Drawing the nodeshot lines with geoJSON could speeds up the querying of them, getting distance and other stuffs played directly in Openlayers, client side.

<code>

vectorLayer = new OpenLayers.Layer.Vector("Lines");

var myGeoJSON = { "type": "FeatureCollection",
    "features": 
    [

        { "type": "Feature", "properties": { "LENGTH": 756.304000}, "geometry": { "type": "LineString", "coordinates": [ [ 18.105018, 59.231027 ], [ 18.104176, 59.230737 ], [ 18.103928, 59.230415 ], [ 18.103650, 59.230336 ], [ 18.103028, 59.230463 ], [ 18.102491, 59.230418 ], [ 18.101976, 59.230237 ], [ 18.100893, 59.230110 ], [ 18.100117, 59.230016 ], [ 18.097715, 59.230262 ], [ 18.096907, 59.230376 ], [ 18.096637, 59.230405 ], [ 18.096578, 59.230428 ], [ 18.096429, 59.230450 ], [ 18.096336, 59.230479 ], [ 18.096108, 59.230534 ], [ 18.095971, 59.230600 ], [ 18.095925, 59.230633 ], [ 18.095891, 59.230665 ], [ 18.094000, 59.231676 ], [ 18.093864, 59.231720 ] ] } }
        ,                   
        { "type": "Feature", "properties": { "LENGTH": 1462.390000}, "geometry": { "type": "LineString", "coordinates": [ [ 17.877073, 59.461653 ], [ 17.877116, 59.461598 ], [ 17.876936, 59.461507 ], [ 17.876936, 59.461323 ], [ 17.876773, 59.461098 ], [ 17.876430, 59.460885 ], [ 17.876413, 59.460553 ], [ 17.876576, 59.460280 ], [ 17.876575, 59.460078 ], [ 17.876762, 59.460060 ], [ 17.877371, 59.460042 ], [ 17.877808, 59.460046 ], [ 17.878641, 59.460046 ], [ 17.879010, 59.460078 ], [ 17.879337, 59.460044 ], [ 17.879526, 59.459878 ], [ 17.879749, 59.459563 ], [ 17.880058, 59.459538 ], [ 17.880435, 59.459503 ], [ 17.887550, 59.453608 ], [ 17.887696, 59.453430 ], [ 17.887971, 59.453150 ], [ 17.888221, 59.452843 ], [ 17.888246, 59.452721 ], [ 17.888435, 59.452609 ], [ 17.888470, 59.452568 ], [ 17.888517, 59.452410 ] ] } }
        
            ]
        };

map.addLayer(vectorLayer);
vectorLayer.addFeatures(geojson_format.read(myGeoJSON));

</code>

in the previous example "var myGeoJSON" could be fetched also with an ajax GET, but even if we need realtime updates ajax just increases the number of connections to the server, so, if lines remains costant for all the navigation we could avoid ajax connections.

If I could obtain a old backup of nodeshot datas I'd do a setup of the initial entities to re-create a simil-production platform. I could analyze, with your help, the features that we could enhance and other that we could introduce together.

What improvements nodeshot needs ?
I started with OpenLayers stuffs but if we should go deeply, with fun... why not ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ml.ninux.org/pipermail/nodeshot/attachments/20130727/a32b9c65/attachment-0001.html>


More information about the Nodeshot mailing list