Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am working on a vector map library where you can add plain image and vector layers to a map. The map itself consists of an infinite coordinate system and each layer is a coordinate system of it's own.

However I'm uncertain how layers should be added to the map coordinate system.


The current implementation places the layer's center around given coordinates and scales the layer to a given size:

map.add(new layer(image="url", cx, cy, width, height)) -> Figure1


Another option would be to place the layer's origin (bottom left corner) to the given coordinates:

map.add(new layer(image="url", ox, oy, width, height)) -> Figure2


The third option would be to let the user provide 2 coordinates i.e. bottom left and top right so that width and height can be omitted:

map.add(new layer(image="url", {x, y}, {x, y})) -> Figure3

This Polymaps example uses the third approach


Question:

What would you recommend: Are there any conventions, how layers (image or vector) are usually positioned on a map?

share|improve this question
    
Why is the map coordinate system infinite? The earth isn't. –  CL. Oct 15 '12 at 8:50
    
How does the layers' metadata specifiy coordinate systems? –  CL. Oct 15 '12 at 8:50
    
@CL. Why infinite? - The map uses an infinite Cartesian coordinate system for low level representation, so that the map can display virtually any 2D Data and not only earth (there are also technical reasons). For geographic coordinate systems, a higher level interface can be used. How specify coordinate system? I am not sure what you mean, but a layer can be any data, e.g. the image from the Polymaps example. –  taffer Oct 15 '12 at 15:10
add comment

1 Answer

up vote 1 down vote accepted

Objects in vector layers have their coordinates specified in some coordinate system, so you do not need to set their position explicitly when adding them to a map. (If the layer and the map use different coordinate systems or projections, it is necessary to convert the coordinates, but this would usually be more complex than a simple affine transform.)

Bitmap layers need to be georeferenced to specify the mapping from pixel to map coordinates. Typically, this is done by choosing some control points and specifying the map coordinates of those points. This is similar to your third option, but the control points are usually not at the corners of the bitmap, and it is common to use three or more to be able to reduce errors.

share|improve this answer
1  
So, they did it wrong in the polymaps example? –  taffer Oct 16 '12 at 7:00
1  
It's not wrong, but if all you have are the positions of some features visible in the image, you'd have to compute the positions of the image corners from those. If you want your libray to be user-friendly, it should do this automatically. –  CL. Oct 16 '12 at 8:37
    
Georeferencing sounds like an interesting option for future versions (is georeferencing used [polymaps.org/ex/transform.html](here)?, but as of now I prefer a simple and stupid solution, like the one used by Polymaps. What do you think is the most straightforward way to "throw an image on a map"? –  taffer Oct 17 '12 at 16:33
    
Affine transforms are needed when you have to rotate images (because the plane that made the aerial photo dared to fly not parallel to lon/lat lines, and nobody corrected that later). –  CL. Oct 17 '12 at 17:41
    
All three of your options can be recalculated to each other, so just choose the one that is most straightforward to implement, and add user-friendly wrappers later. –  CL. Oct 17 '12 at 17:42
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.