# Coordinates Tutorial

This topic explains coordinates for users new to GIS. Experienced users may begin with the Projections Quick Reference topic.

Overview

Drawings and images come to us for use in Manifold from many different sources. Drawings come in many different sizes using different scales. Images can be everything from a photograph scanned on a desktop scanner at 1200 DPI , where one pixel is less than a thousandth of an inch in size, to a data set acquired by satellite where every pixel is supposed to represent a square kilometer of the Earth’s surface.

It’s obvious that if we want to use different drawings or images together in a map we will often ask the system to enlarge or reduce them in some way so their scales match up. If we want to use drawings or images together in a map, we will also need some way of specifying the desired geographic position of the images so that Manifold can draw them correctly aligned together with drawings or other images in a map window.

In the illustration above showing Highway 101 in Palo Alto, we will have to not only match the sizes of the drawing and the image but also to place each in correct geographic context in a Map. This will allow us to add other drawings and images and see them correctly overlaid as well.

Coordinates in Drawings

Drawings are for the most part simply lists of the X,Y coordinates needed to draw the objects they contain. Let’s consider a simple example to see how this works:

Imagine taking a sheet of paper and sketching the layout of a chair, a side table and a table with our computer setup and telephone.

If we drew this on a piece of graph paper with a fine grid, we could measure the X, Y coordinate of every corner point of every rectangle by counting the little boxes from the origin in the lower left corner of the paper.

For example, the lower left corner of the table is forty units in the X direction and 20 units in the Y direction so the coordinates of this spot are 40,20. The four coordinate pairs needed to draw the table rectangle might be:

40,20

80,20

80,50

40,50

We could measure off each and every coordinate location in our example drawing above and create a file containing the coordinates necessary to drawn a plan of our office setup. Digital drawings in almost any format are simply vast collections of numbers like these that specify the location of every coordinate needed to create the drawing in a "connect the dots" fashion.

Specifying Size

The list of coordinates will allow us to reproduce the drawing in the future, but it does not tell us the size of the paper used or what each "unit" is intended to represent in real life. For example, if we originally used graph paper with a one millimeter mesh to measure coordinates and then one day re-created our drawing using graph paper that had a 1/8-th inch mesh the two drawings would not be the same size. Likewise, it makes a big difference if each unit is supposed to represent one inch or one centimeter. A table 30 inches deep is passable while one 30 millimeters deep is not so good.

Units of measure don’t matter if we simply want an abstract view of the arrangement but they matter a lot if we wanted to combine this drawing with a different drawing to compare the relative sizes of tables, or if we wanted to use the drawing to make measurements that we would apply in real life.

We could add some metadata ("data about the data") to the drawing by writing in a note: "one drawing unit equals one inch" to tell us the scale. This would allow us to make measurements in our drawing and to compare those measurements to real life. "Smart" drawing formats used to save digital drawings will save the intended scale together with the lists of coordinates. This allows programs that read such formats to automatically reckon the correct scale. Surprisingly many formats fail to take this simple step.

Specifying Location

Looking at our sample drawing we may wonder why the chair is drawn above the table and not the other way around. We can specify which way our desk arrangement faces in "real life" by assuming that North is always up in the drawing. To do this, we can assume that Y coordinates going in the positive direction are headed North and that positive X coordinates are headed East.

We could also add metadata that specify where the drawing is located on the Earth.

For example, we could attach a note that the origin in the lower left-hand corner is precisely located at the longitude/latitude location of -122.1635, 37.4452. A mapping system could then know where to place it on a map of the Earth. If we could layer the drawing into a map, we could zoom far in and see that the desk is located at the old Microsoft Silicon Valley ISV center in Palo Alto.

"Smart" formats used for drawings and maps use a variety of ways to specify where a drawing should be located. One way is to use a standard geographic projection for drawing coordinates and to embed a note on the projection and projection parameters used within the drawing format. See the Projections topic for details on projections.

When importing a drawing from a format that does not provide information on the desired geographic location, we can georegister the drawing to the desired location. See the Georegistration topic for information on how to do this.

Coordinates in Manifold Drawings

Every drawing in Manifold includes embedded information about scale and location that describes the intended use of the X,Y coordinates it contains. This information is attached to the drawing when it is created or imported and can be seen at any time by looking at the drawing’s coordinate properties. If a drawing is imported from some "smart" mapping format the required information will automatically be imported with the drawing.

Drawings created using degrees, radians and other angular units are assumed to be Earth geographic degrees and will be displayed with the drawing centered on a 0,0 origin at the intersection of the Prime Meridian and the Equator.

Unless some other projection is specified, drawings created using any linear units of measure (inches, meters, kilometers, etc) will be created using Orthographic projection with the lower left-hand corner, the origin, also centered at the intersection of the Prime Meridian and the Equator.

Computer Aided Design (CAD) packages such as AutoCAD are used to create blueprints and other drawings without tying those drawings to specific geographic locations. We can do this in Manifold, as well.

We may wish to create drawings without specifying where they are located on Earth. For example, we might wish to use Manifold to create generic drawings of proposed factory layouts. We will probably want to specify the scale of the drawing, but perhaps we will not want to specify the geographic location of the drawings since we don't know in which location they will be used. No problem!

All drawings in Manifold, even drawings that are intended as CAD documents using meters as a unit of measure, are created by default using the Orthographic ("view from space") projection using a 0,0 origin at the intersection of the Prime Meridian and the Equator. This convention does not get in the way of CAD usage while it does provide a simple means of georegistration CAD drawings in a geographic context should the need arise.

If we are using Manifold as a CAD editor, it really doesn’t matter where the system thinks is the default geographic location of the drawings. The geographic location of the 0,0 origin of the drawing remains a theoretical matter buried in the drawing properties as long as we are doing "pure" CAD. It doesn’t surface as a consideration unless we wish to place the drawing somewhere within a geographic map. At that point it becomes a handy default placement.

So long as we are doing "pure" CAD, the only thing that matters is that the scale is accurate and that all the drawings are based on the same common position of the X, Y origin. There is no deformation from projection factors either, since the drawings used in our CAD project share a common meaning for their coordinates.

Suppose we create our desktop drawing in a Manifold drawing view using one inch per unit. We've illustrated a red cross at the lower left corner to emphasize the idea that the drawing uses internal coordinates based on X,Y displacement from that origin. Manifold does not actually show red crosses at the coordinate origin of drawings.

If we look at this drawing in a map it appears the same; however, if we switch the cursor X,Y readout indicator in the status bar to read in Latitude/Longitude instead of in X/Y coordinates, we'll see that the system thinks the lower left corner is at the intersection of the Prime Meridian and the Equator.

Suppose we create another drawing to show the arrangement of cubicles in the office room in which our desktop lives:

If we open this drawing in Map view it too will appear with the lower left-hand corner georeferenced to our map origin.

If we opened both drawings together in the Map view we would see the above situation. The scale is correct, since our desk set is supposed to fit in one of the cubicles. Now that we are looking at two drawings at the same time we need to show where they are positioned in relation to each other. To do this we simply select the desk set drawing objects and move them to where they are supposed to be:

There, that’s better! Now we show our desk set where it belongs, in the second cubicle over by the left-hand doorway. Doing the edit in this way changes the internal coordinates used to make the desk set drawing so that every time we open it the desk set will appear in the right location when overlaid on the cubicle plan.

Notes: We’ve added the drop shadows and drawing outlines in the illustrations above to make it more clear in this documentation what is going on. Manifold does not show drawings in maps with drop shadows.

Normally, if we wish to create drawings for use in geographic maps we would begin with some geographic basemap drawing as a template. If desired we can always take CAD-style drawings originally created in a non-geographic CAD environment and see them in a geographic setting if we choose.

We can do all the CAD style editing we wish in a map using multiple drawings as multiple layers without ever caring that the lower left corner happens to be georeferenced to a spot off the coast of Africa. However we can exploit this default georegistration when mixing up drawings originally intended for CAD settings with drawings that have geographic content.

To see this effect, we can simply insert a world basemap drawing into the Map view we are using to view our "CAD" drawings.

The first effect is that we wouldn’t see our CAD drawings any more because they would be a tiny dot off the coast of Africa and too small too see when the whole world is in view. (A drawing the size of our desk set is invisible at the scale of the entire world!). However, we could zoom far into that point and, like magic, see our desktop drawings appear in the size of our office setup at exactly zero latitude and longitude, apparently floating in the ocean off Africa.

We can make the desk set more visible by editing coordinates properties of our desk set drawing so that one unit is equal to 100 kilometers instead of 1 inch:

Suddenly the drawing appears as if our desk is 8000 kilometers wide instead of 80 inches wide. If we view this drawing in a map view together with a world map, we would see the lower corner of the desk is now 4000 kilometers (40 units x 100 kilometers per unit) to the right of the origin. Note that we haven't changed the data in the drawing (it still contains numbers like 40,20, etc), we have simply changed the way we want the system to interpret that data.

Because the default georegistration for drawings is to the 0,0 world Longitude/Latitude origin, this convention is a useful way of doing "quick and dirty" georegistration. Through a process of zooming in, selecting objects in a drawing, zooming out and moving the objects we can move objects to any position we desired. The Georegistration topic describes faster and far easier ways of accomplishing georegistration in Manifold, but this "thought experiment" is nonetheless a useful way of understanding how coordinates work in drawings

Coordinates in Images

Images consist of adjacent pixels arranged in rows. There are no "coordinates" within images except those that may be inferred from the size of the image and its placement at some geographic location, if desired.

Just as the raw numbers within a drawing do not tell us what size the drawing is unless we know what size (inch, meter, etc.) the units used represent, we don’t know what the intended size is of an image unless we know how big the pixels are supposed to be. If we have an image that is 600 pixels wide and 900 pixels high, we don’t know what the intended size of the image is unless we know the physical size represented by each pixel. We can specify what size the pixels are supposed to be using any one of several methods.

In the case of scanned or other photographic images, the size of the pixels is usually specified by the dots per inch (DPI) resolution at which the image was created. If it was scanned at 300 DPI, there are supposed to be 300 pixels per inch so that each pixel is 1/300 inch in size. An image that is 600 pixels wide and 900 pixels tall that was scanned at 300 DPI is intended to be two inches wide by three inches tall.

DPI is fine for small images that have many pixels per inch. For images representing very large sizes we will most often specify the size of each pixel in meters or kilometers. For example, the very best commercial space satellite photographs will display an area one meter square for each pixel. If we had an image from such a satellite that was 600 pixels wide by 900 pixels tall, it would represent an area that was 600 meters by 900 meters.

When creating or importing an image in Manifold, we will be prompted to tell the system what size this image is supposed to be, either by specifying DPI or by specifying the size of each pixel. By default, Manifold will import images in geographic image formats using whatever scale factor is specified for the image. For non-geographic formats, Manifold will import the image using the screen resolution (typically, about 72 DPI) for the image. We can change this property at any time to rescale the image without losing any accuracy.

Until the image is georeferenced in a more sophisticated way, Manifold places it geographically with the lower left hand corner at the 0,0 origin at the intersection of the Prime Meridian and the Equator. Manifold’s internal accuracy is so high that a 1200 DPI image can use the same system of 0,0 origin as drawings do by default and still be able to assign a specific lat/lon coordinate to each pixel, even though different pixels are only 1/1200 inch apart.

It is slightly ludicrous to think of a photographic image (like the detail above) being built up pixel-by-pixel using latitude and longitude coordinates; however, because Manifold does this internally when an image is used in a map it gives us great flexibility. We can mix images and drawings in a "CAD style" environment and know that an image scanned at 600 DPI from a letter-sized or A4-sized paper sheet photo will look exactly the correct size when layered in a map that includes a drawing made on the same scale.

Note that whereas drawings are made up of coordinates, images are made of pixels that are coordinate-free: coordinates of pixels are simply implied by the announced size of the pixels, their arrangement adjacent to each other in rows and the location of the image overall. While it is possible to reproject a drawing to change the coordinate values without any significant loss of accuracy, it is not possible to reproject an image without adding or deleting pixels. See Projections and Images for visual examples of this effect.

For this reason, to maintain accuracy we would not normally re-project an image that represents a raster data set because re-projecting the image changes the actual data by virtue of the interpolation necessary to change the shape of the image data into a new projection. If we are using the image for purely visual effect, of course, or if the interpolation is acceptable to us for the intended use of the raster data then we should feel free to re-project the image to match the desired map's projection.