how to setup a new edge rails project with a geostack 0

Edgerails: If I want to run edgerails with all my geostack development tools it can get quite long winded. So I have tried to compile this post hoping to it will inspire me to create a script to automate it … something like railify which I forked from Nicolás Sanguinetti with that very intent. Also given that rails and several other projects are moving to git I decided to try the git submodules for tracking remote git repos.

To get edge rails working as a git submodule checkout this excellent post. Except I am going to grab edgerails from my local fork to save me time and money.


$ rails geostack -d postgresql
$ cd geostack/
$ cat /c/apps/Rails/templates/dot-gitignore > .gitignore
$ touch log/.gitignore
$ git init
$ git status
$ git add .
$ git commit -m "Initial commit"
$ cd /c/apps/Rails/_rails/
$ git pull origin
$ cd /c/NetBeansProjects/geostack/
$ git submodule add /c/apps/Rails/_rails/ vendor/rails
Initialized empty Git repository in c:/NetBeansProjects/geostack/vendor/rails/.git/

lets see what we did

$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD …” to unstage)
#
# new file: .gitmodules
# new file: vendor/rails

all good to commit and initialize the submodules

$ git commit -m "Use git submodules to track HEAD of local _rails repository."
Created commit 327f3b8: Use git submodules to track HEAD of local _rails repository.
2 files changed, 4 insertions(+), 0 deletions(-)
create mode 100644 .gitmodules
create mode 160000 vendor/rails
$ git submodule init
Submodule 'vendor/rails' (c:/apps/Rails/_rails/.git) registered for path 'vendor/rails'
git submodule update

Lets now get the plugins. Starting with spatial_adapter2 which I forked to add geo_scaffold (discussed later)

$ git submodule add git@github.com:sabman/spatial_adapter2.git vendor/plugins/spatial_adapter2
$ git commit -m "Import of spatial_adapter2 from github"

or if u don’t care about tracking it just do:

$ ruby script/plugin install git://github.com/sabman/spatial_adapter2.git

then ym4r_gm again 2 options:

$ git submodule add git://github.com/bitbckt/ym4r-gm.git vendor/plugins/ym4r_gm
$ git commit -m "ym4r_gm added"
or
$ ruby script/plugin install git://github.com/bitbckt/ym4r-gm.git

next the good old geokit

$ ruby script/plugin install git://github.com/ptb/geokit.git

finally seeing as I’m too slack to test unless its TDD we get rspec and rspec_on_rails.
First I update my local git fork of rspec and rspec-rails so we don’t have to keep cloning the huge remote repo

cd /c/apps/Rails/my_plugins/rspec
git pull
cd /c/apps/Rails/my_plugins/rspec-rails
git pull
git add .
git commit -m "update"
#Add git submodules for the local projects
git submodule add /c/apps/Rails/my_plugins/rspec vendor/plugins/rspec
git submodule add /c/apps/Rails/my_plugins/rspec-rails vendor/plugins/rpec_on_rails
git status
git diff --cached
git commit -m "Import the RSpec & Rspec-rails plugins' current HEAD as a submodule."
# and finalize
$ git add .
$ git commit -m "added required plugins"

next create a PostGIS database and setup database config

createdb -T template_postgis geostack_development -U postgres
development:
adapter: postgresql
encoding: UTF8
database: geostack_development
username: postgres
password: secret
test:
adapter: postgresql
encoding: UTF8
database: geostack_test
username: postgres
password: secret
production:
adapter: postgresql
encoding: UTF8
database: geostack_production
username: geostack
password:

… and my ugly hack to ensure our test database rake task create the correct database we are going to modify the default databases.rake file from rails. don’t look

$ find ./vendor/rails/ -type f -iname databases.rake | xargs -i cp {} ./lib/tasks/databases.rake.orig
$ sed 's/^.*`createdb .* -U "#{.*}"/& -T template_postgis /' ./lib/tasks/databases.rake.orig > ./lib/tasks/databases.rake
rm ./lib/tasks/databases.rake.orig

ok all done… geo_scaffold in action:

$ ruby script/generate geo_scaffold Hotspot name:string description:text location:point
mime_types Mime::Type.register "application/vnd.google-earth.kml+xml", :kml
mime_types Mime::Type.register "application/rss+xml", :georss
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/hotspots
exists app/views/layouts/
exists test/functional/
exists test/unit/
create app/views/hotspots/index.html.erb
create app/views/hotspots/show.html.erb
create app/views/hotspots/new.html.erb
create app/views/hotspots/edit.html.erb
create app/views/hotspots/index.kml.builder
create app/views/hotspots/index.georss.builder
create app/views/hotspots/show.kml.builder
create app/views/hotspots/show.georss.builder
create app/views/layouts/hotspots.html.erb
create public/stylesheets/geo_scaffold.css
create public/images/google_earth16x16.gif
create public/images/google_earth32x32.gif
create public/images/feed-icon16x16.png
create public/images/feed-icon32x32.png
create public/images/kml_icon16x16.png
create public/images/feed-icon16x16.gif
create public/images/bullet.gif
create public/images/header_backdrop.png
create public/images/Globe2.png
create public/javascripts/geo_scaffold.js
create app/controllers/hotspots_controller.rb
create app/helpers/hotspots_helper.rb
route map.resources :hotspots
dependency geo_model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/hotspot.rb
create test/unit/hotspot_test.rb
create test/fixtures/hotspots.yml
create db/migrate
create db/migrate/20080429142617_create_hotspots.rb
exists db/migrate
create db/migrate/20080429142618_add_index_to_hotspots.rb

Run migrations and go!

$ rake db:migrate
$ mongrel_rails start

And here is the result tada!
geoscaffold 4 index

Barcamp Canberra & Australia 2020 Summit 3

barcamp canberra
I had a most insightful weekend. On Saturday while Australia’s 2020 summit was on, a few kilometers away Canberra’s first barcamp was also in progress. When the initial outcomes of the summit were released it didn’t come as a surprise that some of the discussion streams in the 2020 summit overlapped with what the open source enthusiasts, techies and futurists were talking about at the barcamp.

Here are some interesting snippets from the various summit streams that also overlapped with topics at Barcamp:

Many submissions in this stream highlighted the need for improved access to appropriate technologies in order to improve customer services, business productivity and the delivery of government services.

intellectual property law to keep pace with technology, to ensure greater sharing without infringing the rights of others

Creative Commons licensing was brought up several times during the Barcamp in relation to access to tax payer funded government data. CC is currently seen as the most logical alternative to current licensing schemes for access to information in government. All presentations at Barcamp itself are offcourse available under CC licence to the world.

But licensing alone cannot change things. Government also needs to change the way it makes this data available. The trend toward Sematic Web and open interfaces and APIs needs to be adopted in government if this particular aim is to become a reality. My interaction with government thus far has seen a marked resistance to emerging technologies, sometimes due to practical reasons such as cost and risk. However, under the submission for “Towards a Creative Australia” there is a point under top ideas to “Develop new investment and support models” which if adopted as a policy can encourage IT departments in Government to overcome these inhibitions:

Fund creative endeavours through a 1% creative dividend from all Government Departments for expenditure on arts (including design, performance, installation)

Perhaps this can be extended to the idea of making data available for creative endeavours by the public. It should be trivial to design these systems such that they monitor the quantity and nature of their usage. According to the summit

It was agreed that comprehensive improvements in environmental data and statistics were necessary to enable better management

If IT departments in government get rewarded for sharing their data the quality of the data is also likely to improve – many eyeballs are better than two.

At the Barcamp my faviourite talk of the day would have to be beautiful web typography 7 tips on desucking the web by Simon Pascal http://klepas.org/ apparently he has also submitted a new OpenStreeMap (http://www.openstreetmap.org/) logo, really looking forward to seeing that.

Futurist Janine (http://www.futurejourneys.com) spoke about her projects that merge virtual and physical space. She mentioned these guys who are involved with some very interesting projects. For example http://blasttheory.co.uk/bt/work_cysmn.html which allows on-line gamers to share their space with people in the physical world. Interaction between these two groups takes many forms for example may be chased by people in the virtual world. The project is related and I suspect may even be connected with a talk at this years Where2.0 — Beg, Borrow and Steal: Make a Simple GPS Game. Looking forward to that next month.

Another talk that I missed but later caught up on slideshare was Ruth’s Gordan Ramsy’s Kitchen.

There were lots more talks all very interesting you can check em out on the wiki. ANU’s generosity has to be commended for letting the community use their facilities on the weekend. And it goes without saying UnOrganisers and sponsors rule!

top 10 ideas from 2020 summit 0

2020Summit
Last weekend the 2020 Summit was held in Canberra where government and leading Australian minds got together to come up with ideas to address future issues that Australia faces. Here’s my biased top 10 ideas:

  1. “national financial literacy program in schools”
  2. “environmental considerations will be fully integrated into economic decision making in Australia”
  3. “robust emissions trading system and a suite of complementary measures will be driving a low carbon revolution with Government taking the lead working in partnership with business and the community”
  4. “make government funding of certain public or research projects conditional on providing open public access to reports and data”
  5. “require carbon neutrality for all new buildings constructed beyond 2020″
  6. “federal government should commission a total soil and hydrological survey of north and north-west Australia by 2010, to inform future production opportunities”
  7. “in classrooms across Australia, children should be encouraged to grow something real”
  8. “encourage student exchange between schools in urban and regional areas”
  9. “delivering “fast fruit” to primary schools”
  10. “provision of micro-finance on a nation-wide scale”

Others that I liked:

  • “exploit broadband and emerging IT technologies to enable new forms of citizen involvement”
  • “an online Citizens’ Cabinet”
  • “open access to Government information (complete reform of FOI laws) and strengthen protections of free press in order to facilitate a more open and publicly accountable government”
    – I wonder if they know about http://openaustralia.org - ruby/rails app :)
  • “reciprocal relationships of both citizen and government”
  • “digitise the collections of major national institutions by 2020″
  • “one-stop shop” for the delivery of government and community services..
  • “australia’s ecological systems will be improved. The health of our river and groundwater systems will be managed to achieve ecological sustainability, supporting food and fibre production and resilient communities. Australia will also have become a global leader in tropical water system conservation and sustainability.

On this last point citizen collaboration and participation can make this task more achievable. Australia can learn a great deal from projects like http://eol.org. Getting a complete inventory of our Biological and Ecological resources can be better accomplished if we allow channels for ordinary Australians to contribute to our Biodiversity data inventory.

FOSS4G 2009 and the winner is … Sydney! 0

suits
Sydney Australia
… woohoo! its about bloody time the FOSS4G conference came down under. So what’s gonna be so cool about it? Going by the press release the conference will have the usual suspects - the passionate community of users and developers - but some of them may be disguised in suits.

Yes you heard me SUITS!… understanding the business drivers for Geospatial Open Source is critical for greater uptake of FOSS4G in the enterprise; apart from saving thousands on license fees, better quality software and standards compliance there is now the added bonus of passion. Passion can make a huge difference to the culture of an organisation and there is no question about users of Open Source technology being passionate. If you ask a developer in your company: “please code up this application using such and such (proprietary) software” vs. “please code up this application using such and such (open source) software” then most developers are likely to be more passionate about open source than proprietary - as it gives them greater exposure and if they get to contribute a feature back to the community they get their name in the hall of fame which can lead to greater things. Even Microsoft understand this

So going by the theme of the conference User Driven FOSS4G there are likely to be managers interested in attending the conference. I should say I’m on the local organising committee and am really excited about working with the community and OSGeo to make FOSS4G 2009 worthy of its name and reputation i.e. a conference where great GeoSpatial ideas blossom and coffee flows freely. In the mean time lets make sure that FOSS4G 2008 is a success.

UPDATE: here is a an article on open source development in Australia and a list of some cool Australian’s doing open source

Google Earth on Rails 0

There is a little post on getting Google Earth and Rails apps talking to each other at: GE-Rails. There is even a hint on using merb instead or Rails

template-postgis database 0

Create a template_postgis database
Some might find this useful for creating PostGIS databases without having to be PostgreSQL
super users. The idea is to create a template_postgis database, install plpgsql and postgis into
it, and then use this database as a template when creating new PostGIS databases.

$ psql template1
\c template1
CREATE DATABASE template_postgis WITH TEMPLATE = template1 ENCODING = 'UTF8';
 
-- next set the 'datistemplate' record in the 'pg_database' table for
-- 'template_postgis' to TRUE indicating its a template
UPDATE pg_database SET datistemplate = TRUE WHERE datname =
'template_postgis';
\c template_postgis
CREATE LANGUAGE plpgsql;
\i /usr/share/postgresql/contrib/lwpostgis.sql;
\i /usr/share/postgresql/contrib/spatial_ref_sys.sql;
 
-- windows 
-- C:\Program Files\PostgreSQL\8.2\share\contrib\lwpostgis.sql
-- C:\Program Files\PostgreSQL\8.2\share\contrib\spatial_ref_sys.sql
 
GRANT ALL ON geometry_columns TO PUBLIC;
GRANT ALL ON spatial_ref_sys TO PUBLIC;
 
-- vacuum freeze: it will guarantee that all rows in the database are
-- "frozen" and will not be subject to transaction ID wraparound
-- problems.
VACUUM FREEZE;

Now non-super user’s can create PostGIS databases using template_postgis:

$ createdb my_gisdb -W -T template_postgis

Can Government learn interoperability from Web2.0? 0

One of our contributers Shoaib gave a talk at an Australian Government agency. Here are his slides. Best viewed with his talk notes.

There’s still hope for Australia’s spatial industry 0

The ASIBA last week release a set of recommendations for the Australian government. These recommendations were based on a economic study evaluating what the spatial industry in Australia is worth. A staggering 6-12 billion dollars is the figure mentioned.

But lets look at the recommendations: I quite like the aims of some of these: government initiatives to commercialise OZ spatial information R&D; government policy that improves the quality, quantity, currency and accuracy of spatial data; management of digital rights and information sharing and a whole-of-government approach to licensing of geodata.

There are a number of initiatives already in the pipe-line to address some of these issues for example to address constraints on information sharing, OSDM is developing a whole-of-government approach for licensing of spatial data. There is also a push to use existing standards for discovery of spatial data where applicable such as OGC’s CSW whose most well known implementation is FAO’s GeoNetwork. There are also projects that look to make taxpayer funding research data free. The question now is how long will it be before we start seeing the fruits of all the good intentions from the government and traditional Spatial industry. How long is a piece of string?

Meanwhile neogeography projects such as OSM continue to flourish and so do the related standards such as GeoRSS. Another recommendation that will hopefully see greater support for such open and community driven initiatives in Australia is that

… priorities are user driven, not ‘producer’ driven

Hopefully this means that the OZ government’s inacceassable silo’s of geodata that’s currently begging to be freed may one day become available in formats that ease their use online and amongst the developer community. This would no doubt lead to the emergence of new industries, a responsibility that governments have towards their nation.

Slides for RailsConf Europe 2007 0

Rails GIS Hack Slides are now available for download at rails.nomad-labs. Also on SlideShare Enjoy!

Bremerhaven 2

In case you are wondering why I’m not at foss4g2007 I’m in Bremerhaven, Germany visiting AWI.

Next Page »