I am building a web application in which members will be able to find other members in their area. This is your typical "nearest neighbor" search which I'll perform using their latitude and longitude. I'll do the geocoding using one of these searches:
1. Search by street address + city + region + postal code + country
2. Search by postal code + country
3. Search by city + country
I plan to use OpenStreetMap data imported into a PostgreSQL 9.1 database using PostGIS 1.5.3. I'll use Nominatim as my geocoder because my users can be anywhere in the world. The problem is that I only have a small 8-CPU Debian 7 VPS server (on linode.com) with 1-GB of RAM while the compressed planet OSM file is around 30-GB. I'm afraid I won't be able to load that much data with so little RAM. And even if I can load it, it will take forever. What I really need is a server with 16-GB of memory but they're very expensive and I'd only need a server that size to initialize my geocoding server and perhaps to do quarterly updates.
Here are my questions:
- Which loader should I be using to put the data in an optimal format for the geocoding queries shown above? I've loaded a small Illinois .pbf file using osm2pgsql but there is also Osmosis and Imposim. I've read that Imposim is good if you have limited memory but I read that osm2pgsql might be best if I'm geocoding.
- Can I reduce the loading time with one of these loaders by only loading those elements that are needed to perform the above geocoding queries? If so, which elements are needed for the loader in question? osm2pgsql mentions "import styles" while Imposim has a mapping file.
- Would it perhaps be a good idea to spin up an Amazon EC2 or RDS server to download the planet file and load the data into a database and then back that data up, copy the backup over to my linode, and restore it there? This would save me the cost of upgrading to a more powerful linode.
Thanks for your response!