This post will cover installing MapFig Studio on CentOS 6x64
MapFig Studio is a light-weight (12 MB), Open Source PHP application for creating, editing, managing, and deploying maps across the internet
MapFig Studio is not a GIS server like GeoServer (or MapServer, etc...), nor is it intended to be.
MapFig Studio is designed to provide users of any skill level with the ability to easily create, manage, and deploy leaflet maps on websites.
In addition to standard map deployment options of HTML, iframe, and URL, MapFig Studio also comes bundled with integrated plugins for WordPress, Drupal, Joomla, and Omeka so your maps can be easily imported, managed, and displayed in your CMS.
Before deciding if you want to install your own MapFig Studio, you may want to try it first using MapFig's Free Public Cloud Studio
The basic account is free and no credit card is required. The basic account also includes the plugins for WordPress, Drupal, and Joomla and all of the features that 99% of users will want in order to add some maps to their websites.
Here is a quick example I just made for this post (click the marker):
And below, moving from left to right, we can pop-up one marker with another, use a standard pop-up (with Google Directions), as well as modal pop-up. We've also switched our base layer to from MapQuest to Stamen Toner. You can use any map provider you wish to as well as create custom groups (the drop-down at top right of map)
OK, I'm a sysadmin, not a designer, I'm sure you can make something nicer.
I will be installing MapFig Studio on a VPS with 256 MB of RAM, but you can easily install MapFig Studio on a shared hosting or cPanel account.
MapFig Studio's resource requirements are similar to PHP application such as WordPress or Drupal.
We designed the application using SuPHP so MapFig Studio can be run on inexpensive shared hosting accounts as well as on dedicated environments.
If you prefer mod_ruid2 this can be used in place and you can skip the SuPHP section.
The only requirements for MapFig Studio are PHP 5.x, SuPHP, PostgreSQL 9, and GDAL.
MapFig does offer managed hosting, but you can get all of the same features and functionality hosting it yourself or with any provider.
In this tutorial I am going to use the CentOS 6.5 repo (and because I happen to like CentOS 6). For production, you should consider CentOS 7, which provides PHP 5.4, or installing/compiling PHP>=5.4 on your distribution.
The same procedure below can be followed on any RHEL/CentOS distribution.
Install Apache and start it. If you elected to use Webmin, you can do this via Servers > Apache Web Server
[root@demos opt]# yum install httpd httpd-tools [root@demos opt]# service httpd start
Unless you want to build from source, the PostgreSQL and EPEL repositories will be needed for PostgreSQL as well as GDAL.
[root@demos opt]# wget http://yum.pgrpms.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm [root@demos opt]# rpm -i pgdg-centos94-9.4-1.noarch.rpm [root@demos opt]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm [root@demos opt]# rpm -i epel-release-latest-6.noarch.rpm
A full guide to installing and configuring PostgreSQL on CentOS is available here
[root@demos opt]# yum install postgresql94 postgresql94-devel postgresql94-libs postgresql94-server postgresql94-contrib
It's also a good idea to create some symlinks to the PostgreSQL pre-9.x locations as some libs still seem to look for it there:
[root@demos opt]# ln -s /usr/pgsql-9.4/bin/pg_config /usr/bin [root@demos opt]# ln -s /var/lib/pgsql/9.4/data /var/lib/pgsql [root@demos opt]# ln -s /var/lib/pgsql/9.4/backups /var/lib/pgsql
Create the MapFig database and user who will own the database:
postgres=# create user mapfig with password 'secret'; CREATE ROLE postgres=# create database mapfig owner=mapfig;
Install GDAL using yum, this will pull in deps from the epel repo.
[root@demos opt]# yum install gdal gdal-devel gdal-libs
Add the web user (I'll call mine 'mapfig') who will own installation:
[root@demos opt]# useradd mapfig [root@demos opt]# passwd mapfig Changing password for user mapfig. New password: Retype new password: passwd: all authentication tokens updated successfully.
Install PHP via yum.
[root@demos opt]# yum install php php-devel php-pgsql
Edit your php.ini file under /etc/php.ini to enable short tags (there are some short tags in the current download, we will remove these and update when completed.)
[root@demos opt]# vi /etc/php.ini short_open_tag = On
[root@demos opt]# service httpd restart
Install SuPHP using the centoshelp.org repo (or any other method you prefer):
If you are using mod_ruid2, you can skip these sections.
[root@demos opt]# rpm -ivh http://rpm.centoshelp.org/el6/mod_suphp/mod_suphp-0.7.1-1.el6.cosh.x86_64.rpm
In /etc/suphp.conf, change:
[handlers] ;Handler for php-scripts x-httpd-php=php:/usr/bin/php-cgi ;Handler for CGI-scripts x-suphp-cgi=execute:!self
[handlers] [handlers] ;Handler for php-scripts x-httpd-php="php:/usr/bin/php-cgi" ;Handler for CGI-scripts x-suphp-cgi="execute:!self"
:+1: Thank you to Kieran O’Shea
[root@demos opt]# mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.disable
Add the following lines to your httpd.conf and bounce Apache:
DirectoryIndex index.html index.html.var index.php AddType x-httpd-php .php .php3 .php4 .php5
[root@demos opt]# service httpd restart
To keep things simple, I am going to be installing MapFig Studio into /var/www/html
Chown the installation directory (/var/www/html) to the web user you created in step 6 above.
[root@demos opt]# chown -Rf mapfig:mapfig /var/www/html
In your httpd.conf, uncomment the line below
At the bottom of your httpd.conf, add your vhost as shown below
<VirtualHost *:80> ServerAdmin email@example.com DocumentRoot /var/www/html/ ServerName maps.mydomain.com ErrorLog logs/ maps.mydomain.com-error_log CustomLog logs/ maps.mydomain.com-access_log common
AccessFileName .htaccess ### suPHP ### suPHP_Engine on suPHP_UserGroup mapfig mapfig suPHP_AddHandler x-httpd-php AddHandler x-httpd-php .php .php3 .php4 .php5 <Directory /var/www/html/> Options +Indexes FollowSymlinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
[root@demos opt]# service httpd restart
Start an SSH session and su to the web user your created and use wget to pull down MapFig Studio:
[root@demos opt]# su - mapfig [root@demos opt]$ cd /var/www/html [mapfig@demos html]$ wget http://cdn.mapfig.com/MapFig-Studio/MapFig-Studio.zip Saving to: MapFig-Studio.zip 100%[======================================>] 12,754,146 3.79M/s in 3.3sUnzip MapFig Studio and move contents into our doc root at /var/www/html
[mapfig@demos html]$ unzip -q MapFig-Studio.zip [mapfig@demos html]$ mv /var/www/html/MapFigStudio/* /var/www/html
Before beginning the installation process, you must manually update the mail.config.php file located in the includes directory.
If you took my advice above and installed Webmin, you will have a working Postfix mail server.
Change the MAIL_HOST, MAIL_USERNAME, and MAIL_PASSWORD below to your own mail server.
NOTE: this does not to be an account on the local mail server, it can be an email account hosted anywhere.
[mapfig@demos html]$ cd includes [mapfig@demos html]$ vi mail.config.php
<?PHP define("MAIL_SMTPAUTH", true); define("MAIL_SMTPSECURE", "tls"); define("MAIL_HOST", "mail.yourdomain.com"); define("MAIL_PORT", 587); define("MAIL_USERNAME", "firstname.lastname@example.org"); define("MAIL_PASSWORD", "YourPassword"); define("MAIL_FROM", "email@example.com"); define("MAIL_FROM_NAME", "Verify Mapfig"); define("WELCOME_EMAIL_SUBJECT", "Mapfig Studio Registration Confirmation!"); define("MAIL_TEMPLATE_DIRECTORY", dirname(__FILE__)."/../templates/emails/"); ?>
Navigate to your vhost name (or IP) and begin installing:
Install Screen 1: Have your DB information and click "Let's Go"
Install Screen 2: Enter the DB user name and password from "Step 4: Create the MapFig Database" above.
Install Screen 3: Click "Run the Install"
Install Screen 4: Enter your information in the fields provided (these can be changed later)
Install Screen 6: Activate Email is sent to the address you entered in Screen 4 above.
Install Screen 7: Click on the "Verify Account" button to verify account and you will then be able to log into MapFig Studio.
If, for any reason you forgot to do this, you will get "Email not verified" when attempting log in for the first time.
To fix this, connect to your mapfig database as postgres (or as user you created) and update the activationkey field of the users table to '' as shown below, substituting your own email for the one below:
postgres=# \c mapfig You are now connected to database "mapfig" as user "postgres". mapfig=# update users set activationkey = '' where email = 'firstname.lastname@example.org';
This post will cover setting Google for your namesever resolvers in CentOS.
It's a simple task, but my OnApp does not set them for my CentOS templates for some reason.
If they have not been set, the first time you will likely notice is when you go to use yum and it throws PYCURL errors.
Log in as root via SSH and issue 'vi /etc/resolv.conf' to edit your resolv.conf file:
[root@david etc]# vi /etc/resolv.conf
If, like me, you have no nameserver resolvers set, you will see something like this:
# Automatically generated by OnApp (3.0.8) domain davidghedini.com ~ ~
Hit "i" for insert and add the Google Nameservers (220.127.116.11 and 18.104.22.168) as shown below, one per line:
# Automatically generated by OnApp (3.0.8) domain davidghedini.com nameserver 22.214.171.124 nameserver 126.96.36.199
Hit Escape and then ':wq' to save your changes
I'm very happy to wrapping up our MapFig Studio project.
It has monopolized a good deal of my time the past three months.
It won't change the world, but it will allow anyone to easily create and deploy leaflet maps (and for developers and web designers it could save a lot of time as well).
MapFig Studio is free, Open Source (GPLv3) application for creating, editing, and deploying leaflet maps.
The application supports Markers, Lines, Squares, and Polygons.
Maps can be exported via iframe code, HTML, BootStrap, or called via URL or API.
The Studio includes CMS plugins for WordPress, Drupal, Joomla, and Omeka to allow you to import, manage, and display of maps within your CMS!
The server is tile-agnostic, allowing users to select any provider(s)
The Studio bundles a large number of leaflet plugins (measure, search, cluster, export, playback, etc...), and also includes Image Overlays, IntroBox Slider, InfoSlider, Legend, Password-Protection, SVG Maps.
One of the my favourite features is being able to cross reference object (insert link to one object from another) via a custom drop down in tinymce we made.
Maps can be table-based or free-hand or both
The Studio also includes multi-user support, Projects, and Collaboration.
You can download the full app via our CSN
You can also download via our new MapFig Website
A free, public cloud is available which you can use to try it out before downloading. The free account requires only an email address and has limited features, but should give you a feel for the application
You can self-register at https://studio.mapfig.com/register.php
You can also use the public cloud service rather than self-hosting.
The public cloud is being provided to us by VooServers
An installer is included. Copy the files to your server, navigate to the directory and enter the required information.
Documentation is still in progress but available at docs.mapfig.come.
Commercial support and Managed Cloud Service is also available.
Please check out our WordPress Plugins at our WordPress Plugin Page
These are in queue at WordPress.org, but you can download and start using them now.
One is free and the other two are paid. I really recommend the Premium version. It is only $5 and, IMHO, it is the simplest and best leaflet plugin you will find for WordPress.. You can download a free 14 day trial and no registration or credit card is required.