This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'geo_ruby' | |
include GeoRuby::SimpleFeatures | |
module GmlHelper | |
def parse_gml(gml_str) | |
doc = Hpricot(gml_str) | |
coords = doc.search('gml:coordinates').inner_html.split(',') | |
unless coords.empty? or coords.nil? | |
if doc.search("gml:point").size == 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'geo_ruby' | |
GeoRuby::SimpleFeatures::Point.class_eval do | |
def as_sdo_geometry | |
"MDSYS.SDO_GEOMETRY(#{sdo_gtype},#{sdo_srid},SDO_POINT_TYPE(#{sdo_ordinate_array}),NULL,NULL)" | |
end | |
# dl01 see http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14255/sdo_objrelschema.htm#g1013735 | |
def sdo_gtype | |
d = @with_z ? 3 : 2 | |
l = @with_m ? (d==2 ? 3 : 4) : 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'schema_dev.rb' | |
require '../utils/sdo_geometry.rb' | |
include GeoRuby::SimpleFeatures | |
ProdDb.connection.execute("ALTER SESSION set NLS_DATE_FORMAT ='DD-MON-FXYYYY'") | |
params = { | |
:eno=>455129, | |
:sampleid=>'GA2476/006CAM002', | |
:geom_original => nil, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MarsHelper | |
def self.convert_params_spatial_values_to_georuby(h) | |
geom = nil | |
r = h | |
if h[:start_lat] and h[:end_lat] and h[:start_long] and h[:end_long] # linestring | |
if r[:start_depth] | |
geom = LineString.from_coordinates([[r[:start_long], r[:start_lat],r[:start_depth].abs*-1],[r[:end_long], r[:end_lat], r[:end_depth].abs*-1]], 8311, true) | |
else | |
geom = LineString.from_coordinates([[r[:start_long], r[:start_lat]], [r[:end_long], r[:end_lat]]], 8311) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Prod | |
class Sample < ProdDb | |
set_table_name :samples | |
set_sequence_name :autogenerated | |
set_primary_key :sampleno | |
set_date_columns :entrydate, :qadate, :acquiredate, :confid_until, :lastupdate | |
belongs_to :survey, :foreign_key => :eno | |
has_many :sampledata, :foreign_key => :sampleno | |
comma :sampledata do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
repo_url=$1 | |
read -s -p "Enter Password: " password | |
echo "Saving original proxy ... " | |
orig_proxy=$HTTP_PROXY | |
echo "getting username: $USERNAME" | |
echo "seeding the proxy with sweet love ..." | |
echo -ne '##### (33%)\r' | |
sleep 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script/generate nifty_scaffold tile url:string file:string lon:decimal lat:decimal zoom:decimal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddTiles < ActiveRecord::Migration | |
def self.up | |
Tile.create(:file => '1.jpg', :lon => 134, :lat => -26, :zoom => 1) | |
Tile.create(:file => '2.jpg', :lon => 122, :lat => -26, :zoom => 2) | |
Tile.create(:file => '3.jpg', :lon => 145, :lat => -26, :zoom => 2) | |
end | |
def self.down | |
Tile.delete_all | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tile < ActiveRecord::Base | |
attr_accessible :url, :file, :lon, :lat, :zoom, :url_params | |
def url_params | |
"?lon=#{lon}&lat=#{lat}&zoom=#{zoom}" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% title "Tiles" %> | |
<table> | |
<tr> | |
<th>Tile Url</th> | |
</tr> | |
<% for tile in @tiles %> | |
<tr> | |
<td><%=link_to "#{tiles_path}/show/#{tile.url_params}", "#{tiles_path}/show/#{tile.url_params}" %></td> | |
</tr> |