autogestion / corruption_tracker

BSD 3-Clause "New" or "Revised" License
11 stars 11 forks source link

GeoJSON file or DB #26

Closed autogestion closed 8 years ago

autogestion commented 9 years ago

A summary of the previous series:

There was an idea that service will consists of 2 parts - mobile app that don't need live internet connection and web-platform. First just gets claims, second shows them. GeoJSON was conceived as mediator beetwen them, it would contain a polygon id, by which web-platform would recognize which polygon was claimed. We could update GeoJSON, put it at server and in mobile app update and they would stay synced.

Main idea was to store in GeoJSON information which must be same in mobile app and web-platform. All ather atributes had to be stored in server db

If there are real benefits of kicking GeoJSON off the server, we have to know how common data would be stored in mobile app and how they would stay synchronized with server. We could not change something on server before it comes to mobile app which is offline

Or we should change the whole vision of service

Vegasq commented 9 years ago

Mobile app don't need geojson, it overhead requirements. We need very small part of information. Backend don't need geojson. geojson required by javascript lib to draw map.

We can generate this format dynamicly, and provide it to lib. But it's incorrect to think that we need this file and should keep it on client and server parts.

blank flowchart - new page

autogestion commented 9 years ago

@Vegasq agree with you. Lets implement your step-by-step plan

In this case, we need two more models:

class Layer : """this could be set of polygons of organizations for district, or polygons of districts from whole sity view, or polygons of cities from whole country view""

class Polygon:

All aditional info would be stored in Organization model

Also leaflet.js provides functionality to draw polygons, this could be included to django admin using django-leaflet package - https://github.com/makinacorpus/django-leaflet#leaflet-map-forms-widgets and could be tested here http://umap.openstreetmap.fr/en/ by clicking 'create a map'

GeoJSON could be used as fixture, as alternative way to get some polygons into DB

autogestion commented 9 years ago

At all, transition from upper Layer to lower could be done in such way: User click on polygon of county, js send to server request with polygon/layer id, server agregates polygons of lower level Layer and return them as json to js. Js reload map, make zoom in and draw polygons from gotten json. Same to go down to organizations level

If it is right way, Layers have to be ordered hierarchically. By using FK to self, maybe

Vegasq commented 9 years ago

Also leaflet.js provides functionality to draw polygons, this could be included to django admin using django-leaflet package - https://github.com/makinacorpus/django-leaflet#leaflet-map-forms-widgets

Lets postpone it. If we want to use their native tools, we will have two new binary requirements.

I think we can handle it, but in different patchset, and after discrussion about new requirements.

autogestion commented 9 years ago

Looks like we'll stay with GeoJSON file for a while, and it have to contain:

at top-level:

at polygon-level:

This values would be parsed by initiate_db comand ( https://github.com/autogestion/corruption_tracker/blob/master/claim/management/commands/initiate_db.py and stored to database

autogestion commented 8 years ago

All data is stored in Postgres