Summary

In this chapter, we have implemented, tested, and made improvements to a simple web-based application that displays shorelines, towns, and lakes within a given radius of a starting point. This application was the impetus for exploring a number of important concepts within geo-spatial application development, including:

  • The creation of a simple, but complete web-based geo-spatial application.
  • Using databases to store and work with large amounts of geo-spatial data.
  • Using a "black-box" map rendering module to create maps using spatial data selected from a database.
  • Examining the issues involved in identifying features based on their true distance rather than using a lat/long approximation.
  • Learning how to use spatial joins effectively.
  • Exploring usability issues in a prototype implementation.
  • Dealing with issues of data quality.
  • Learning how to pre-calculate data to improve performance.
  • Exploring how a geo-spatial application might be scaled to handle vast numbers of users and requests.

As a result of our development efforts, we have learned:

  • How to set up a database and import large quantities of data from Shapefiles and other datasources.
  • How to design and structure a simple web-based application to display maps and respond to user input.
  • That there are three steps in displaying a map: calculating the lat/long bounding box, calculating the pixel size of the map image, and telling the map renderer which tables to get its data from.
  • Given the (x,y) coordinate of a point the user clicked on within a map, how to translate this point into the equivalent latitude and longitude value.
  • Various ways in which true distance calculations, and selection of features by distance, can be performed.
  • That manually calculating distance for every point using the Great Circle distance formula is accurate, but very slow.
  • That angular distances (that is, differences in lat/long coordinates) is an easy approximation of distance but doesn't relate in any useful way to true distances across the Earth's surface.
  • That using projected coordinates makes true distance calculations easy, but is limited to data covering only part of the Earth's surface.
  • That we can use a hybrid approach to accurately and quickly identify features by distance, by calculating a lat/long bounding box to identify potential features and then doing a Great Circle distance calculation on these features to weed out the false positives.
  • How to set up a datasource to access and retrieve data from MySQL, PostGIS and SpatiaLite databases.
  • That displaying a country's outline and asking the user to click on a desired point works when the country is relatively small and compact, but breaks down for larger countries.
  • That issues of data quality can affect the overall usefulness of your geo-spatial application.
  • That you cannot assume that geo-spatial data comes in the best form for use in your application.
  • That very large polygons can degrade performance, and can often be split into smaller sub-polygons, resulting in dramatic improvements in performance.
  • That a divide-and-conquer approach to splitting large polygons is much faster than simply calculating the intersection using the full polygon each time.
  • That just because you can think of an optimization doesn't mean that you should do it. Only optimize after you have identified your application's true bottlenecks.
  • Making your code faster is worthwhile, but to achieve true scalability requires running multiple instances of your application on separate servers.
  • That you can use a load balancer to spread requests among your application servers.
  • That a dedicated database server will often meet the needs of multiple application servers.
  • That you can go beyond the capacity of a single database server by using database replication and separating out the read/write requests from the read-only requests, and using different servers for each one.
  • That the database replication capabilities of MySQL are much easier and often more stable than the equivalent PostGIS capabilities, which are not built in and require complex third-party support.

In the next chapter, we will explore the details of using the Mapnik library to convert raw geo-spatial data into map images.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.72.176