Enabling tiger geocoder in version 2.1

I used homebrew to upgrade to the latest postgis version. (2.1)

brew unlink postgis brew install postgis 

Then I created a migration to change the postgis extension to 2.1

 rails g migration alter_postgis_version def change execute %q{ALTER EXTENSION postgis UPDATE TO "2.1.0";} end 

Edit:

Run the brew command in the first comment and now I get the following error when migrating:

 PG::UndefinedObject: ERROR: type "geometry" does not exist: CREATE EXTENSION postgis_tiger_geocoder;/me/.rvm/gems/ruby-2.0.0- p247@freight _alert/gems/activerecord4.0.0/ lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `exec' 

I have postgis configured according to the postgis scheme, so if I run

 $: set search_path = "$user", postgis,public; $: \d List of relations Schema | Name | Type | Owner ---------+--------------------------+----------+------------------- postgis | geography_columns | view | me postgis | geometry_columns | view | me etc.. $: \d geometry_columns View "postgis.geometry_columns" Column | Type | Modifiers -------------------+------------------------+----------- f_table_catalog | character varying(256) | f_table_schema | character varying(256) | f_table_name | character varying(256) | f_geometry_column | character varying(256) | coord_dimension | integer | srid | integer | type | character varying(30) | 

However, if I try to run:

 $: CREATE EXTENSION postgis_tiger_geocoder; ERROR: type "geometry" does not exist 

This makes no sense to me, since geometry_columns is in the list of relations.

+6
source share
2 answers

Let's move on to this. Sent after I reinstalled geos, gdal and libspatialite (also re-throwing them). I can’t say that this is a recipe for copy / paste, but play with it and see if you can make it work:

 brew reinstall gdal brew unlink gdal && brew link gdal brew reinstall geos brew unlink geos && brew link geos brew reinstall libspatialite brew unlink libspatialite && brew link libspatialite 

You may need to do this in a different order or redo one by one to get the libraries in order. Do not delete postgis-2.0.x, as you will need (both) libraries for a soft upgrade.

+1
source

Make sure the postgis schema is in your search_path directory. Then reconnect to your database and try again. It should look something like this.

 ALTER DATABASE mydb SET search_path = public, postgis; 

We found a small error in postgis_tiger_geocoder, so you might want to use it 2.1.1 or manually cut the bootloader described here:

http://www.postgresonline.com/journal/archives/317-CREATE-SCHEMA-IF-NOT-EXISTS-in-9.3-and-tiger-geocoder.html

+2
source

Source: https://habr.com/ru/post/952079/


All Articles