Links

   Quran Explorer - Interactive Audio Recitations & Translations

Friday, April 11, 2014

Asset Tracking via GPS

Implemented using a combination of Traccar and OpenGTS (and Google Earth)


On OpenGTS side i only needed
track.war (Web interface)
events.war (data retrieval by robots, GoogleEarth etc)
gprmc.war (http interface for (some)GPS devices)

Traccar was the actual 'engine' running the protocols and accepting connections and eventualy pushing them into the DB.


Process:
1. Build OpenGTS then dump the database
2. Update Traccars traccar.cfg to point to the opengts db
3. Run the service and wait for connections


Contact me for a demo link

PostGIS example tutorial


Fellow geekerati and Random Googlers!!!

The following is the process(with a few slight variations each time) that i always take whenever i have a postGIS related project. 
And.... need i say?... it has never let me down.


1. INITIALIZATION - Create a spatially-enabled database
====================

NOTE: tavevo is the database name. change accordingly

a. confirm postgis version
    #psql -d tavevo -c "SELECT postgis_full_version();"
    POSTGIS="1.5.3" GEOS="3.2.1-CAPI-1.6.1" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.8" USE_STATS

b. #psql -d tavevo < /usr/sesame/systems/sesame/postgis-1.5/postgis.sql
    Load the PostGIS object and function definitions into your database

c. #psql -d tavevo < /usr/sesame/systems/sesame/postgis-1.5/spatial_ref_sys.sql
    For a complete set of EPSG coordinate system definition identifiers,
    you can also load the spatial_ref_sys.sql definitions file and populate the spatial_ref_sys table.
    This will permit you to perform ST_Transform() operations on geometries.


2. CREATE ROLE/USER
#sudo su postgres
CREATE ROLE gisgroup NOSUPERUSER NOINHERIT CREATEDB NOCREATEROLE;
CREATE ROLE admin LOGIN PASSWORD '@dm1n' NOINHERIT;
GRANT gisgroup TO admin;


3. PERMISSIONS
Connect:
#psql -U postgres tavevo

Give permissions:
ALTER TABLE geometry_columns OWNER TO admin;
ALTER TABLE spatial_ref_sys OWNER TO admin;
ALTER TABLE water_meter OWNER TO admin;

--TESTING
--GRANT ALL ON TABLE geometry_columns TO admin;
--GRANT ALL ON TABLE spatial_ref_sys TO admin;
--GRANT ALL ON TABLE water_meter TO admin;



4. Create SCHEMA
CREATE SCHEMA gis_schema AUTHORIZATION admin;


5. GIVE OWNERSHIP TO admin
ALTER DATABASE tavevo OWNER TO "admin";


6. UPLOAD DATA

    a. COAST ADMINISTRATIVE

        Generate SQL:
                #shp2pgsql -I -s 32633 KEN-1.shp coast_admin > coast_admin.sql
                Shapefile type: Polygon
                Postgis type: MULTIPOLYGON[2]

        Execute SQL:
                #psql -U admin -d tavevo < coast_admin.sql

    b. COAST BOUNDARIES

        Generate SQL:
            #shp2pgsql -I -s 32633 KEN-1_boundaries.shp coast_boundaries > /usr/sesame/systems/tavevo/database/coast_boundaries.sql
            Shapefile type: Arc
            Postgis type: MULTILINESTRING[2]

        Execute SQL:
            #psql -U admin -d tavevo < coast_boundaries.sql

    c. KENYA - ADMINISTRATIVE
        Generate SQL:
            #shp2pgsql -I -s 32633 KEN.shp kenya_admin > /usr/sesame/systems/tavevo/database/kenya_admin.sql
            Shapefile type: Polygon
            Postgis type: MULTIPOLYGON[2]
        Execute SQL:
            #psql -U admin -d tavevo < kenya_admin.sql

Thursday, March 27, 2014

Add Mezzanine to an existing Django Project

 

I dont take any credit for the following content.. Its here solely for (my) future reference and has been taken directly from the Mezzanine FAQs page

 

How can I add Mezzanine to an existing Django project?

Mezzanine is a Django project made up of multiple Django apps, and is geared towards being used as the basis for new Django projects, however adding Mezzanine to an existing Django project should be as simple as adding the necessary settings and urlpatterns.
Mezzanine contains a project_template directory, which it uses to create new projects. In here you’ll find the necessary settings.py and urls.py modules, containing the project-level setup for Mezzanine. Of particular note are the following settings:
  • INSTALLED_APPS
  • TEMPLATE_CONTEXT_PROCESSORS
  • MIDDLEWARE_CLASSES
  • PACKAGE_NAME_GRAPPELLI and PACKAGE_NAME_FILEBROWSER (for django-grappelli and django-filebrowser integration)
  • The call to mezzanine.utils.conf.set_dynamic_settings at the very end of the settings.py module.

Tuesday, March 4, 2014

Fixing Django ImportError in production

Hi,

"TemplateSyntaxError: Caught ImportError while rendering: No module named blahblahblah"  

In Development all imports work perfectly untill u move to production....

I 'lost' almost 16 man-hours trying to troubleshoot this. This is almost always a path issue.. There are several options one of them adding the path using os.path but the one that worked for me is to fully qualify the module name.

This means prefixing the project name to the module name such that if your project name was 'my_project' and the missing module/app is 'registration_app' you'll need to use my_project.registration_app EVERYWHERE in your .py files..



Wednesday, February 19, 2014

To understand Recursion - Part II

Hi all (again),

I assembled a (again) very nice and practical introduction to Recursion !!
Here is the link