Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoJSON file or DB #26

Closed
autogestion opened this issue Sep 22, 2015 · 6 comments
Closed

GeoJSON file or DB #26

autogestion opened this issue Sep 22, 2015 · 6 comments

Comments

@autogestion
Copy link
Owner

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
Copy link
Contributor

Vegasq commented Sep 23, 2015

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
Copy link
Owner Author

@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""

  • name
  • type (choicefield - organization/district/county

class Polygon:

  • organization (one-to-one-field to Organization model , null=True)
  • layer (FK to Layer)
  • coordinates

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
Copy link
Owner Author

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
Copy link
Contributor

Vegasq commented Sep 24, 2015

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.

  • GEOS binary package to work with geo data.
  • PostreSQL to use it with django.contrib.gis.db.backends.postgis

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

Vegasq added a commit to Vegasq/corruption_tracker that referenced this issue Sep 24, 2015
@autogestion
Copy link
Owner Author

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

at top-level:

  • layer_id (Kharkiv, Lviv, Ukraine, Saltovka)
  • layer_type (organizations, districts)
  • set_default(1,0) - if we'll need to load pack of geojsons, one of them must be marked as primary

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

Vegasq added a commit to Vegasq/corruption_tracker that referenced this issue Sep 24, 2015
Vegasq added a commit to Vegasq/corruption_tracker that referenced this issue Sep 24, 2015
Vegasq added a commit to Vegasq/corruption_tracker that referenced this issue Sep 24, 2015
Vegasq added a commit to Vegasq/corruption_tracker that referenced this issue Sep 24, 2015
@autogestion
Copy link
Owner Author

All data is stored in Postgres

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants