Mapping With Drupal - Alan Palazzolo [8]
Although Spherical Mercator is the projection that is most common in web mapping, there are a theoretically limitless number of other map projections. It is important to understand a bit about projections from a technical standpoint and the effects they can have on your maps and your map users. Other map projections are covered in more depth in Appendix B. In addition to this, there is some useful information online:
Wikipedia has a thorough article on map projections.
Mapthematics has a really interesting visualization of the effects of projection.
Mapthematics also has an in-depth look at projections.
Mapthematics provides a list of projections and details about each.
Kartoweb has an even more in-depth look at projections.
Wikipedia has a good overview of the World Geodetic System projection.
Further reading is listed in Appendix A.
Coordinate Systems
A coordinate system is a way of referring to a location with a set of numbers. The coordinates that are most important for web-based maps are latitude and longitude. Latitude is the angular distance north or south from the equator. Latitudes north of the equator are positive; latitudes south of the equator are negative. Longitude is the east-west position of a point, and is also expressed as an angle. The latitude of zero runs north-south through the Royal Observatory at Greenwich in the UK. Places east of this have positive values and west are negative.
When setting up maps in Drupal, developers run into a surprising number of problems caused by mixing up latitude and longitude or mixing positive and negative values for latitude. If you ever come across your map of public toilets in Paris unexpectedly showing you some ocean west of the continent of Africa (Figure 2-6), this is the point where both latitude and longitude are zero, which usually means that your map is not receiving the location data or there is some projection issue.
Figure 2-6. The location of 0,0 shown on OpenStreetMap
Latitude and longitude are normally measured in degrees, minutes, and seconds. A sphere has 360 degrees. Each degree can be divided into 60 minutes (referring to the angle, not time). Each minute can be divided into 60 seconds. For example, New York City is at 40° 43′ 0″ North, 74° 0′ 0″ West. This is often turned into a pair of decimal numbers for web mapping or mathematical calculations: 40.716667, -74.
Longitude first
Most of us usually recite coordinates as latitude first, then longitude second. This order is arbitrary and makes things harder for web-based mapping, so often you will see APIs using longitude first.
Web mapping, specifically, tile-based mapping (see Mapping Terms for more details on tile-based mapping) presents a unique problem: how does one take into account, map tile positions, viewport positions, and actual map coordinates? Computer applications, specifically with HTML and CSS, make the assumption that the position that is most top and left is a (0,0) point, and that positive numbers represent going down and right respectively. This means that tile sets are usually formed like Z/X/Y.png. The Z is the zoom level, and the X and the Y represent where the tile image fits into the map starting from top left. This then leads to web mapping libraries basing a lot of calculations on this top/left or x,y system. Also, when you start to look at latitude and longitude, the longitude value would be on the x-axis and latitude would be on the y-axis, and computers usually use a Cartesian x,y coordinate system. So, that is why we often see longitude first in web mapping.
Data Storage
There are a number of open source and proprietary storage systems for geospatial data, and there are just as many standards for how to represent the data. We will go through some of the basics here, but this is a large topic that we cannot cover completely. The Open Geospatial Consortium (OGC) is a well-established body that helps define many of the open standards used in geographic information systems. It is helpful to understand these concepts as you