nofxx-postgis_adapter 0.1.8 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest.txt CHANGED
@@ -12,24 +12,20 @@ lib/postgis_functions.rb
12
12
  lib/postgis_functions/bbox.rb
13
13
  lib/postgis_functions/class.rb
14
14
  lib/postgis_functions/common.rb
15
- lib/postgis_functions/linestring.rb
16
- lib/postgis_functions/point.rb
17
- lib/postgis_functions/polygon.rb
18
15
  postgis_adapter.gemspec
19
16
  rails/init.rb
20
17
  script/console
21
18
  script/destroy
22
19
  script/generate
23
- spec/acts_as_geom_spec.rb
24
- spec/common_spatial_adapter_spec.rb
25
20
  spec/db/database_postgis.yml
26
21
  spec/db/models_postgis.rb
27
22
  spec/db/schema_postgis.rb
23
+ spec/postgis_adapter/acts_as_geom_spec.rb
24
+ spec/postgis_adapter/common_spatial_adapter_spec.rb
28
25
  spec/postgis_adapter_spec.rb
29
26
  spec/postgis_functions/bbox_spec.rb
30
- spec/postgis_functions/linestring_spec.rb
31
- spec/postgis_functions/point_spec.rb
32
- spec/postgis_functions/polygon_spec.rb
27
+ spec/postgis_functions/class_spec.rb
28
+ spec/postgis_functions/common_spec.rb
33
29
  spec/postgis_functions_spec.rb
34
30
  spec/spec.opts
35
31
  spec/spec_helper.rb
data/README.rdoc CHANGED
@@ -247,6 +247,13 @@ the geometric column is a point:
247
247
  geom: <%= Point.from_x_y(123.5,321.9).to_yaml %>
248
248
 
249
249
 
250
+ === Annotate
251
+
252
+ If you are using annotate_models, check out this fork which adds geometrical annotations for PostgisAdapter and SpatialAdapter:
253
+
254
+ http://github.com/nofxx/annotate_models
255
+
256
+
250
257
  == Geometric data types
251
258
 
252
259
  Ruby geometric datatypes are currently made available only through
@@ -256,11 +263,6 @@ of a future release of the Spatial Adapter to support additional
256
263
  geometric datatype libraries, such as Ruby/GEOS, as long as they
257
264
  can support reading and writing of EWKB.
258
265
 
259
- == Annotate
260
-
261
- If you are using annotate_models, check out this fork which adds geometrical annotations for PostgisAdapter and SpatialAdapter:
262
-
263
- http://github.com/nofxx/annotate_models
264
266
 
265
267
 
266
268
  === Warning
@@ -14,7 +14,6 @@ module PostgisFunctions
14
14
  # acts_as_geom :geom
15
15
  def acts_as_geom(*columns)
16
16
  cattr_accessor :postgis_geoms
17
-
18
17
  geoms = columns.map do |g|
19
18
  geom_type = get_geom_type(g)
20
19
  case geom_type
@@ -25,13 +24,15 @@ module PostgisFunctions
25
24
  when :line_string
26
25
  send :include, LineStringFunctions
27
26
  end
28
- {g => geom_type}
27
+ g
29
28
  end
30
- self.postgis_geoms = {:geoms => geoms}#, :opts => options}
29
+ self.postgis_geoms = {:columns => geoms}#, :opts => options}
31
30
  end
32
31
 
33
32
  def get_geom_type(column)
34
33
  self.columns.select { |c| c.name == column.to_s}.first.geometry_type
34
+ rescue ActiveRecord::StatementInvalid => e
35
+ nil
35
36
  end
36
37
  end
37
38
  end
@@ -10,9 +10,6 @@ require 'postgis_adapter/common_spatial_adapter'
10
10
  require 'postgis_functions'
11
11
  require 'postgis_functions/common'
12
12
  require 'postgis_functions/class'
13
- require 'postgis_functions/point'
14
- require 'postgis_functions/linestring'
15
- require 'postgis_functions/polygon'
16
13
  require 'postgis_functions/bbox'
17
14
  require 'postgis_adapter/acts_as_geom'
18
15
 
@@ -20,13 +17,12 @@ include GeoRuby::SimpleFeatures
20
17
  include SpatialAdapter
21
18
 
22
19
  module PostgisAdapter
23
- VERSION = '0.1.8'
20
+ VERSION = '0.2.1'
24
21
  end
25
22
 
26
23
  #tables to ignore in migration : relative to PostGIS management of geometric columns
27
24
  ActiveRecord::SchemaDumper.ignore_tables << "spatial_ref_sys" << "geometry_columns"
28
25
 
29
-
30
26
  #add a method to_yaml to the Geometry class which will transform a geometry in a form suitable to be used in a YAML file (such as in a fixture)
31
27
  GeoRuby::SimpleFeatures::Geometry.class_eval do
32
28
  def to_fixture_format
@@ -34,7 +30,6 @@ GeoRuby::SimpleFeatures::Geometry.class_eval do
34
30
  end
35
31
  end
36
32
 
37
-
38
33
  ActiveRecord::Base.class_eval do
39
34
  require 'active_record/version'
40
35
 
@@ -234,7 +234,7 @@ module PostgisFunctions
234
234
 
235
235
  def simplify!(tolerance=0.1)
236
236
  #FIXME: not good..
237
- self.geom = simplify
237
+ self.update_attribute(get_column_name, simplify)
238
238
  end
239
239
 
240
240
  #
@@ -424,6 +424,357 @@ module PostgisFunctions
424
424
  m = "'#{m}'" if m
425
425
  postgis_calculate("Relate", [self, other], m)
426
426
  end
427
+
428
+ #
429
+ # Transform the geometry into a different spatial reference system.
430
+ #
431
+ # Return geometry ST_Transform(geometry g1, integer srid);
432
+ # Returns a new geometry with its coordinates transformed to spatial reference system referenced by the SRID integer parameter. The destination SRID must exist in the SPATIAL_REF_SYS table.
433
+ # ST_Transform is often confused with ST_SetSRID(). ST_Transform actually changes the coordinates of a geometry from one spatial reference system to another, while ST_SetSRID() simply changes the SRID identifier of the geometry
434
+ # Requires PostGIS be compiled with Proj support. Use PostGIS_Full_Version to confirm you have proj support compiled in.
435
+ #
436
+ # If using more than one transformation, it is useful to have a functional index on the commonly used transformations to take advantage of index usage.
437
+ #
438
+ # Prior to 1.3.4, this function crashes if used with geometries that contain CURVES. This is fixed in 1.3.4+
439
+ # This method implements the OpenGIS Simple Features Implementation Specification for SQL.
440
+ # This method supports Circular Strings and Curves
441
+ #
442
+ def transform(new_srid)
443
+ postgis_calculate("Transform", self, new_srid)
444
+ end
445
+
446
+ #
447
+ # LINESTRING
448
+ #
449
+ #
450
+ #
451
+ module LineStringFunctions
452
+
453
+ #
454
+ # Returns the 2D length of the geometry if it is a linestring, multilinestring,
455
+ # ST_Curve, ST_MultiCurve. 0 is returned for areal geometries. For areal geometries
456
+ # use 'perimeter'. Measurements are in the units of the spatial reference system
457
+ # of the geometry.
458
+ #
459
+ # Returns Float
460
+ #
461
+ def length
462
+ dis = postgis_calculate(:length, self).to_f
463
+ end
464
+
465
+ #
466
+ # Returns the 3-dimensional or 2-dimensional length of the geometry if it is
467
+ # a linestring or multi-linestring. For 2-d lines it will just return the 2-d
468
+ # length (same as 'length')
469
+ #
470
+ # Returns Float
471
+ #
472
+ def length_3d
473
+ dis = postgis_calculate(:length3d, self).to_f
474
+ end
475
+
476
+ #
477
+ # Calculates the length of a geometry on an ellipsoid. This is useful if the
478
+ # coordinates of the geometry are in longitude/latitude and a length is
479
+ # desired without reprojection. The ellipsoid is a separate database type and
480
+ # can be constructed as follows:
481
+ #
482
+ # SPHEROID[<NAME>,<SEMI-MAJOR AXIS>,<INVERSE FLATTENING>]
483
+ #
484
+ # Example:
485
+ # SPHEROID["GRS_1980",6378137,298.257222101]
486
+ #
487
+ # Defaults to:
488
+ #
489
+ # SPHEROID["IERS_2003",6378136.6,298.25642]
490
+ #
491
+ # Returns Float length_spheroid(geometry linestring, spheroid);
492
+ #
493
+ def length_spheroid(spheroid = EARTH_SPHEROID)
494
+ dis = postgis_calculate(:length_spheroid, self, spheroid).to_f
495
+ end
496
+
497
+ #
498
+ # Return the number of points of the geometry.
499
+ # PostGis ST_NumPoints does not work as nov/08
500
+ #
501
+ # Returns Integer ST_NPoints(geometry g1);
502
+ #
503
+ def num_points
504
+ postgis_calculate(:npoints, self).to_i
505
+ end
506
+
507
+ #
508
+ # Returns geometry start point.
509
+ #
510
+ def start_point
511
+ postgis_calculate(:startpoint, self)
512
+ end
513
+
514
+ #
515
+ # Returns geometry end point.
516
+ #
517
+ def end_point
518
+ postgis_calculate(:endpoint, self)
519
+ end
520
+
521
+ #
522
+ # Takes two geometry objects and returns TRUE if their intersection
523
+ # "spatially cross", that is, the geometries have some, but not all interior
524
+ # points in common. The intersection of the interiors of the geometries must
525
+ # not be the empty set and must have a dimensionality less than the the
526
+ # maximum dimension of the two input geometries. Additionally, the
527
+ # intersection of the two geometries must not equal either of the source
528
+ # geometries. Otherwise, it returns FALSE.
529
+ #
530
+ #
531
+ # Returns Boolean ST_Crosses(geometry g1, geometry g2);
532
+ #
533
+ def crosses? other
534
+ postgis_calculate(:crosses, [self, other])
535
+ end
536
+
537
+ #
538
+ # Returns a float between 0 and 1 representing the location of the closest point
539
+ # on LineString to the given Point, as a fraction of total 2d line length.
540
+ #
541
+ # You can use the returned location to extract a Point (ST_Line_Interpolate_Point)
542
+ # or a substring (ST_Line_Substring).
543
+ #
544
+ # This is useful for approximating numbers of addresses.
545
+ #
546
+ # Returns float (0 to 1) ST_Line_Locate_Point(geometry a_linestring, geometry a_point);
547
+ #
548
+ def locate_point point
549
+ postgis_calculate(:line_locate_point, [self, point]).to_f
550
+ end
551
+
552
+ #
553
+ # Return a derived geometry collection value with elements that match the
554
+ # specified measure. Polygonal elements are not supported.
555
+ #
556
+ # Semantic is specified by: ISO/IEC CD 13249-3:200x(E) - Text for
557
+ # Continuation CD Editing Meeting
558
+ #
559
+ # Returns geometry ST_Locate_Along_Measure(geometry ageom_with_measure, float a_measure);
560
+ #
561
+ def locate_along_measure(measure)
562
+ postgis_calculate(:locate_along_measure, self, measure)
563
+ end
564
+
565
+ #
566
+ # Return a derived geometry collection value with elements that match the
567
+ # specified range of measures inclusively. Polygonal elements are not supported.
568
+ #
569
+ # Semantic is specified by: ISO/IEC CD 13249-3:200x(E) - Text for Continuation CD Editing Meeting
570
+ #
571
+ # Returns geometry ST_Locate_Between_Measures(geometry geomA, float measure_start, float measure_end);
572
+ #
573
+ def locate_between_measures(a, b)
574
+ postgis_calculate(:locate_between_measures, self, [a,b])
575
+ end
576
+
577
+ #
578
+ # Returns a point interpolated along a line. First argument must be a LINESTRING.
579
+ # Second argument is a float8 between 0 and 1 representing fraction of total
580
+ # linestring length the point has to be located.
581
+ #
582
+ # See ST_Line_Locate_Point for computing the line location nearest to a Point.
583
+ #
584
+ # Returns geometry ST_Line_Interpolate_Point(geometry a_linestring, float a_fraction);
585
+ #
586
+ def interpolate_point(fraction)
587
+ postgis_calculate(:line_interpolate_point, self, fraction)
588
+ end
589
+
590
+ #
591
+ # Return a linestring being a substring of the input one starting and ending
592
+ # at the given fractions of total 2d length. Second and third arguments are
593
+ # float8 values between 0 and 1. This only works with LINESTRINGs. To use
594
+ # with contiguous MULTILINESTRINGs use in conjunction with ST_LineMerge.
595
+ #
596
+ # If 'start' and 'end' have the same value this is equivalent to 'interpolate_point'.
597
+ #
598
+ # See 'locate_point' for computing the line location nearest to a Point.
599
+ #
600
+ # Returns geometry ST_Line_Substring(geometry a_linestring, float startfraction, float endfraction);
601
+ #
602
+ def line_substring(s,e)
603
+ postgis_calculate(:line_substring, self, [s, e])
604
+ end
605
+
606
+ ###
607
+ #Not implemented in postgis yet
608
+ # ST_max_distance Returns the largest distance between two line strings.
609
+ #def max_distance other
610
+ # #float ST_Max_Distance(geometry g1, geometry g2);
611
+ # postgis_calculate(:max_distance, [self, other])
612
+ #end
613
+ end
614
+
615
+
616
+ ####
617
+ ###
618
+ ##
619
+ #
620
+ # POINT
621
+ #
622
+ #
623
+ module PointFunctions
624
+
625
+ #
626
+ # Returns a float between 0 and 1 representing the location of the closest point
627
+ # on LineString to the given Point, as a fraction of total 2d line length.
628
+ #
629
+ # You can use the returned location to extract a Point (ST_Line_Interpolate_Point)
630
+ # or a substring (ST_Line_Substring).
631
+ #
632
+ # This is useful for approximating numbers of addresses.
633
+ #
634
+ # Returns float (0 to 1) ST_Line_Locate_Point(geometry a_linestring, geometry a_point);
635
+ #
636
+ def where_on_line line
637
+ postgis_calculate(:line_locate_point, [line, self]).to_f
638
+ end
639
+
640
+ #
641
+ # Linear distance in meters between two lon/lat points.
642
+ # Uses a spherical earth and radius of 6370986 meters.
643
+ # Faster than 'distance_spheroid', but less accurate.
644
+ #
645
+ # Only implemented for points.
646
+ #
647
+ # Returns Float ST_Distance_Sphere(geometry pointlonlatA, geometry pointlonlatB);
648
+ #
649
+ def distance_sphere_to(other)
650
+ dis = postgis_calculate(:distance_sphere, [self, other]).to_f
651
+ end
652
+
653
+ #
654
+ # Calculates the distance on an ellipsoid. This is useful if the
655
+ # coordinates of the geometry are in longitude/latitude and a length is
656
+ # desired without reprojection. The ellipsoid is a separate database type and
657
+ # can be constructed as follows:
658
+ #
659
+ # This is slower then 'distance_sphere_to', but more precise.
660
+ #
661
+ # SPHEROID[<NAME>,<SEMI-MAJOR AXIS>,<INVERSE FLATTENING>]
662
+ #
663
+ # Example:
664
+ # SPHEROID["GRS_1980",6378137,298.257222101]
665
+ #
666
+ # Defaults to:
667
+ #
668
+ # SPHEROID["IERS_2003",6378136.6,298.25642]
669
+ #
670
+ # Returns ST_Distance_Spheroid(geometry geomA, geometry geomB, spheroid);
671
+ #
672
+ def distance_spheroid_to(other, spheroid = EARTH_SPHEROID)
673
+ postgis_calculate(:distance_spheroid, [self, other], spheroid).to_f
674
+ end
675
+
676
+ #
677
+ # The azimuth of the segment defined by the given Point geometries,
678
+ # or NULL if the two points are coincident. Return value is in radians.
679
+ #
680
+ # The Azimuth is mathematical concept defined as the angle, in this case
681
+ # measured in radian, between a reference plane and a point.
682
+ #
683
+ # Returns Float ST_Azimuth(geometry pointA, geometry pointB);
684
+ #
685
+ def azimuth other
686
+ #TODO: return if not point/point
687
+ postgis_calculate(:azimuth, [self, other]).to_f
688
+ rescue
689
+ ActiveRecord::StatementInvalid
690
+ end
691
+
692
+ #
693
+ # True if the geometry is a point and is inside the circle.
694
+ #
695
+ # Returns Boolean ST_point_inside_circle(geometry, float, float, float)
696
+ #
697
+ def inside_circle?(x,y,r)
698
+ postgis_calculate(:point_inside_circle, self, [x,y,r])
699
+ end
700
+
701
+ end
702
+
703
+ ###
704
+ ##
705
+ #
706
+ # Polygon
707
+ #
708
+ #
709
+ module PolygonFunctions
710
+
711
+ #
712
+ # The area of the geometry if it is a polygon or multi-polygon.
713
+ # Return the area measurement of an ST_Surface or ST_MultiSurface value.
714
+ # Area is in the units of the spatial reference system.
715
+ #
716
+ # Returns Float ST_Area(geometry g1);
717
+ #
718
+ def area
719
+ postgis_calculate(:area, self).to_f
720
+ end
721
+
722
+ #
723
+ # Returns the 2D perimeter of the geometry if it is a ST_Surface, ST_MultiSurface
724
+ # (Polygon, Multipolygon). 0 is returned for non-areal geometries. For linestrings
725
+ # use 'length'. Measurements are in the units of the spatial reference system of
726
+ # the geometry.
727
+ #
728
+ # Returns Float ST_Perimeter(geometry g1);
729
+ #
730
+ def perimeter
731
+ postgis_calculate(:perimeter, self).to_f
732
+ end
733
+
734
+ #
735
+ # Returns the 3-dimensional perimeter of the geometry, if it is a polygon or multi-polygon.
736
+ # If the geometry is 2-dimensional, then the 2-dimensional perimeter is returned.
737
+ #
738
+ # Returns Float ST_Perimeter3D(geometry geomA);
739
+ #
740
+ def perimeter3d
741
+ postgis_calculate(:perimeter3d, self).to_f
742
+ end
743
+
744
+ #
745
+ # True if the LineString's start and end points are coincident.
746
+ #
747
+ # This method implements the OpenGIS Simple Features Implementation
748
+ # Specification for SQL.
749
+ #
750
+ # SQL-MM defines the result of ST_IsClosed(NULL) to be 0, while PostGIS returns NULL.
751
+ #
752
+ # Returns boolean ST_IsClosed(geometry g);
753
+ #
754
+ def closed?
755
+ postgis_calculate(:isclosed, self)
756
+ end
757
+ alias_method "is_closed?", "closed?"
758
+
759
+ #
760
+ # True if no point in Geometry B is outside Geometry A
761
+ #
762
+ # This function call will automatically include a bounding box comparison
763
+ # that will make use of any indexes that are available on the geometries.
764
+ # To avoid index use, use the function _ST_Covers.
765
+ #
766
+ # Do not call with a GEOMETRYCOLLECTION as an argument
767
+ # Do not use this function with invalid geometries. You will get unexpected results.
768
+ #
769
+ # Performed by the GEOS module.
770
+ #
771
+ # Returns Boolean ST_Covers(geometry geomA, geometry geomB);
772
+ #
773
+ def covers? other
774
+ postgis_calculate(:covers, [self, other])
775
+ end
776
+
777
+ end
427
778
 
428
779
  end
429
780
 
@@ -435,4 +786,4 @@ end
435
786
 
436
787
 
437
788
  #x ST_SnapToGrid(geometry, geometry, sizeX, sizeY, sizeZ, sizeM)
438
- # ST_X , ST_Y, SE_M, SE_Z, SE_IsMeasured has_m?
789
+ # ST_X , ST_Y, SE_M, SE_Z, SE_IsMeasured has_m?
@@ -18,9 +18,8 @@
18
18
  #
19
19
  #
20
20
  module PostgisFunctions
21
- # EARTH_SPHEROID = "'SPHEROID[\"GRS-80\",6378137,298.257222101]'"
22
-
23
- EARTH_SPHEROID = "'SPHEROID[\"IERS_2003\",6378136.6,298.25642]'"
21
+ EARTH_SPHEROID = "'SPHEROID[\"GRS-80\",6378137,298.257222101]'" # SRID => 4326
22
+ #EARTH_SPHEROID = "'SPHEROID[\"IERS_2003\",6378136.6,298.25642]'" # SRID =>
24
23
 
25
24
  def postgis_calculate(operation, subjects, options = nil)
26
25
  subjects = [subjects] unless subjects.respond_to?(:map)
@@ -29,12 +28,13 @@ module PostgisFunctions
29
28
  raise StandardError, "#{e}"
30
29
  end
31
30
 
32
-
33
31
  private
34
32
 
35
-
33
+ def get_column_name
34
+ @geo_column ||= postgis_geoms[:columns].first
35
+ end
36
+
36
37
  # Construct the postgis sql query
37
- # TODO: ST_Transform() ?? # Convert between distances. Implement this?
38
38
  #
39
39
  # Area return in square feet
40
40
  # Distance/DWithin/Length/Perimeter — in projected units.
@@ -49,7 +49,7 @@ module PostgisFunctions
49
49
  :id => t[:id] }
50
50
  end
51
51
 
52
- fields = tables.map { |f| "#{f[:uid]}.geom" } # W1.geom
52
+ fields = tables.map { |f| "#{f[:uid]}.#{get_column_name}" } # W1.geom
53
53
  conditions = tables.map { |f| "#{f[:uid]}.id = #{f[:id]}" } # W1.id = 5
54
54
  tables.map! { |f| "#{f[:class]} #{f[:uid]}" } # streets W1
55
55
 
@@ -57,17 +57,16 @@ module PostgisFunctions
57
57
  # Data => SELECT Func(A,B)
58
58
  # BBox => SELECT (A <=> B)
59
59
  #
60
- if type == :bbox
61
- opcode = nil
62
- s_join = " #{options} "
63
- else
60
+ unless type == :bbox
64
61
  opcode = type.to_s
65
62
  opcode = "ST_#{opcode}" unless opcode =~ /th3d|pesinter/
66
- s_join = ","
67
63
  fields << options if options
64
+ fields = fields.join(",")
65
+ else
66
+ fields = fields.join(" #{options} ")
68
67
  end
69
68
 
70
- sql = "SELECT #{opcode}(#{fields.join(s_join)}) "
69
+ sql = "SELECT #{opcode}(#{fields}) "
71
70
  sql << "FROM #{tables.join(",")} " if tables
72
71
  sql << "WHERE #{conditions.join(" AND ")}" if conditions
73
72
  #p sql; sql
@@ -94,7 +93,7 @@ module PostgisFunctions
94
93
 
95
94
  # Get a unique ID for tables
96
95
  def unique_identifier
97
- @u_id ||= "W1"
96
+ @u_id ||= "T1"
98
97
  @u_id = @u_id.succ
99
98
  end
100
99
 
@@ -1,21 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  Gem::Specification.new do |s|
2
- s.name = "postgis_adapter"
3
- s.version = "0.1.8"
4
+ s.name = %q{postgis_adapter}
5
+ s.version = "0.2.1"
6
+
4
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
5
8
  s.authors = ["Marcos Piccinini"]
6
- s.date = "2008-12-16"
7
- s.description = "Postgis Adapter for Activer Record"
9
+ s.date = %q{2009-01-10}
10
+ s.description = %q{Postgis Adapter for Activer Record}
8
11
  s.email = ["x@nofxx.com"]
9
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
10
- s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "init.rb", "install.rb", "lib/postgis_adapter.rb", "lib/postgis_adapter/acts_as_geom.rb", "lib/postgis_adapter/common_spatial_adapter.rb", "lib/postgis_functions.rb", "lib/postgis_functions/bbox.rb", "lib/postgis_functions/class.rb", "lib/postgis_functions/common.rb", "lib/postgis_functions/linestring.rb", "lib/postgis_functions/point.rb", "lib/postgis_functions/polygon.rb", "postgis_adapter.gemspec", "rails/init.rb", "script/console", "script/destroy", "script/generate", "uninstall.rb"]
11
- s.test_files = ["spec/acts_as_geom_spec.rb", "spec/common_spatial_adapter_spec.rb", "spec/db/database_postgis.yml", "spec/db/models_postgis.rb", "spec/db/schema_postgis.rb", "spec/postgis_adapter_spec.rb", "spec/postgis_functions/bbox_spec.rb", "spec/postgis_functions/linestring_spec.rb", "spec/postgis_functions/point_spec.rb", "spec/postgis_functions/polygon_spec.rb", "spec/postgis_functions_spec.rb", "spec/spec.opts", "spec/spec_helper.rb"]
13
+ s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "init.rb", "install.rb", "lib/postgis_adapter.rb", "lib/postgis_adapter/acts_as_geom.rb", "lib/postgis_adapter/common_spatial_adapter.rb", "lib/postgis_functions.rb", "lib/postgis_functions/bbox.rb", "lib/postgis_functions/class.rb", "lib/postgis_functions/common.rb", "postgis_adapter.gemspec", "rails/init.rb", "script/console", "script/destroy", "script/generate", "spec/db/database_postgis.yml", "spec/db/models_postgis.rb", "spec/db/schema_postgis.rb", "spec/postgis_adapter/acts_as_geom_spec.rb", "spec/postgis_adapter/common_spatial_adapter_spec.rb", "spec/postgis_adapter_spec.rb", "spec/postgis_functions/bbox_spec.rb", "spec/postgis_functions/class_spec.rb", "spec/postgis_functions/common_spec.rb", "spec/postgis_functions_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "uninstall.rb"]
12
14
  s.has_rdoc = true
13
- s.homepage = "http://github.com/nofxx/postgis_adapter"
15
+ s.homepage = %q{http://github.com/nofxx/postgis_adapter}
14
16
  s.rdoc_options = ["--main", "README.rdoc"]
15
17
  s.require_paths = ["lib"]
16
18
  s.rubyforge_project = %q{postgis_adapter}
17
19
  s.rubygems_version = %q{1.3.1}
18
- s.summary = "Postgis Adapter for Activer Record"
20
+ s.summary = %q{Postgis Adapter for Activer Record}
19
21
 
20
22
  if s.respond_to? :specification_version then
21
23
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -23,16 +25,16 @@ Gem::Specification.new do |s|
23
25
 
24
26
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
27
  s.add_runtime_dependency(%q<activerecord>, [">= 2.0.2"])
26
- s.add_development_dependency(%q<newgem>, [">= 1.1.0"])
28
+ s.add_development_dependency(%q<newgem>, [">= 1.2.3"])
27
29
  s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
28
30
  else
29
31
  s.add_dependency(%q<activerecord>, [">= 2.0.2"])
30
- s.add_dependency(%q<newgem>, [">= 1.1.0"])
32
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
31
33
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
32
34
  end
33
35
  else
34
36
  s.add_dependency(%q<activerecord>, [">= 2.0.2"])
35
- s.add_dependency(%q<newgem>, [">= 1.1.0"])
37
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
36
38
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
37
39
  end
38
40
  end
@@ -1,4 +1,4 @@
1
1
  adapter: postgresql
2
- database: postgis_plugin_test
2
+ database: postgis_plugin
3
3
  username: postgres
4
4
  password:
@@ -53,4 +53,5 @@ class Street < ActiveRecord::Base
53
53
  end
54
54
 
55
55
  class CommonGeo < ActiveRecord::Base
56
+ acts_as_geom :geom
56
57
  end
@@ -54,33 +54,30 @@ ActiveRecord::Schema.define() do
54
54
  t.point "geom", :null => false, :with_m => true, :with_z => true
55
55
  end
56
56
 
57
- create_table "table_srid_line_strings", :force => true do |t|
58
- t.line_string "geom", :null => false , :srid => 123
57
+ create_table "table_srid_line_strings", :force => true do |t|
58
+ t.line_string "geom", :null => false , :srid => 4326
59
59
  end
60
60
 
61
61
  create_table "table_srid4d_polygons", :force => true do |t|
62
- t.polygon "geom", :with_m => true, :with_z => true, :srid => 123
62
+ t.polygon "geom", :with_m => true, :with_z => true, :srid => 4326
63
63
  end
64
64
 
65
- create_table :cities do |t|
66
- t.string :data, :limit => 100
67
- t.integer :value
68
- t.polygon :geom,:null=>false,:srid=>123
69
- end
70
-
71
- create_table :positions do |t|
72
- t.string :data, :limit => 100
73
- t.integer :value
74
- t.point :geom,:null=>false,:srid=>123
75
- end
76
-
77
- create_table :streets do |t|
78
- t.string :data, :limit => 100
79
- t.integer :value
80
- t.line_string :geom,:null=>false,:srid=>123
81
- end
82
-
65
+ create_table :cities do |t|
66
+ t.string :data, :limit => 100
67
+ t.integer :value
68
+ t.polygon :geom,:null=>false,:srid=>4326
69
+ end
83
70
 
71
+ create_table :positions do |t|
72
+ t.string :data, :limit => 100
73
+ t.integer :value
74
+ t.point :geom,:null=>false,:srid=>4326
75
+ end
84
76
 
77
+ create_table :streets do |t|
78
+ t.string :data, :limit => 100
79
+ t.integer :value
80
+ t.line_string :geom,:null=>false,:srid=>4326
81
+ end
85
82
 
86
83
  end