2017 © Pedro Peláez
 

symfony-bundle iris-geocoder-bundle

French IRIS INSSE code address Geocoder

image

munso/iris-geocoder-bundle

French IRIS INSSE code address Geocoder

  • Friday, May 19, 2017
  • by Jacquot-Renaud
  • Repository
  • 2 Watchers
  • 0 Stars
  • 53 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

iris-geocoder-bundle

Symfony bundle to reverse geocoding from address to French IRIS Areas ., (*1)

Based on : https://github.com/garaud/pyris writed in python., (*2)

Installation

Requirements

You have to install postgreSQL and PostGIS. For Debian:, (*3)

    sudo apt-get install postgresql postgis

You have to be a PostgreSQL superuser to create the postgis extension for your database. If it's not the case, you can do:, (*4)

    su
    su - postgres
    psql DATABASENAME -c "CREATE EXTENSION postgis;"

Download the last available IRIS shape file at the URL : https://www.data.gouv.fr/fr/datasets/contour-des-iris-insee-tout-en-un/, (*5)

Configuration

Create a database and add a new doctrine connection in app/config.yml Symfony Documentation, (*6)

doctrine:
    dbal:
        connections:
            #[...] 
            psql:
                driver: pdo_pgsql
                host:     "%psql_database_host%"
                port:     "%psql_database_port%"
                dbname:   "%psql_database_name%"
                user:     "%psql_database_user%"
                password: "%psql_database_password%"
                charset:  UTF8

Add 'geometry' mapping column type:, (*7)

doctrine:
    dbal:
        types:
            geometry: Jsor\Doctrine\PostGIS\Types\GeometryType

Add a new doctrine entity_manager for the connection recently added:, (*8)

    orm:
        entity_managers:
            #[...]
            geocodage:
                connection: psql 
                mappings:
                    MunsoIRISGeocoderBundle: ~
                dql:
                    numeric_functions:
                        ST_MakePoint: Jsor\Doctrine\PostGIS\Functions\ST_MakePoint
                        ST_Contains: Jsor\Doctrine\PostGIS\Functions\ST_Contains
                        ST_SetSRID: Jsor\Doctrine\PostGIS\Functions\ST_SetSRID

Customization

If you have already a postgresSQL connection configured on your project, you could edit entity_manager name used., (*9)

If the columns mapped in your *.shp file does not fit with IrisItem entity, you can create your own entity by editing munso.iris_geocoder.entity_name parameter., (*10)

    munso.iris_geocoder.entity_manager.name: 'geocodage'
    munso.iris_geocoder.entity_name: 'MunsoIRISGeocoderBundle:IrisItem'

Import

Import your shape into postgresSQL database by running the command:, (*11)

    php bin/console munso:iris:import-shape path/to/file.shp 

The .shx and .dbf files must be in the same directory than the *.shp file. The SQL table will be truncated unless you use --append option., (*12)

Usage

## IRIS Code by address, (*13)

Use service munso.iris_geocoder:, (*14)

   $IrisItem = $this->get('munso.iris_geocoder')->getIRISByAddress('2b Allée Forain Francois verdier');

The Versions

19/05 2017

dev-master

9999999-dev https://github.com/Munso-Agency/iris-geocoder-bundle

French IRIS INSSE code address Geocoder

  Sources   Download

MIT

The Requires

 

by Renaud Jacquot

geocoder iris insee