Map projections and GIS

From DreamsteepWiki

Jump to: navigation, search

PROJECTIONS

EPSG_CODES

SPATIAL REFERENCES


postgis reproject

you can also feed it a list/file with x,y-pairs, or do some formatting:
cs2cs +init=epsg:900913 +to +init=epsg:4326 -f "%.2f"
500738 6859019
4.50    52.32 0.00

Another option is to use the spatial functions of a postgres/postgis db
if you have that laying around,
eg. tranform from a 4326 point to a 28992 point:
SELECT AsText(Transform(GeomFromText('POINT(5.172167 52.245417)', 4326),
28992))
or the other way around
SELECT AsText(Transform(GeomFromText('POINT(140313.905612639
473062.480785896)', 28992), 4326)) 


EXTENTS OF COMMON PROJECTIONS

//READ THIS FOR A GOOD EXPLANATION OF OPENLAYERS 
http://docs.openlayers.org/library/spherical_mercator.html

WGS84 (4326)

-180,-90 ,180,90

GOOGLE (9-0-0-9-1-3)

-20037508.34, -20037508.34, 20037508.34, 20037508.34


OPENLAYERS PROJECTION LINKS


http://docs.openlayers.org/library/spherical_mercator
http://docs.openlayers.org/library/spherical_mercator#reprojecting-vector-data
http://docs.openlayers.org/library/spherical_mercator#serializing-projected-data


OPENLAYERS UNITS

    <script type="text/javascript">
    
        var map, layer;
		var url = "./tiles/";
        
        var metersPerUnit = 111319.4908;  //value returned from mapguide
        var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit; 
        OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit; 
        OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;        
        OpenLayers.DOTS_PER_INCH = 96;

        //tiled version
        function initTiled(){
 			extent = new OpenLayers.Bounds(101.67878348734, 3.132684839649,101.7437229312, 3.1830671108767) ;
	        tempScales =[500, 1012.88403, 2051.86812, 4156.60889, 8420.32553, 17057.62652, 34554.79499, 70000 ]
			
            var mapOptions = {
                maxExtent: extent, 
                scales: tempScales
            };
            map = new OpenLayers.Map( 'map', mapOptions );
            
			 var params = {
              mapdefinition: 'Library://TM/aug-08/Malaysia map  LL WGS84.MapDefinition',
              basemaplayergroupname: "Base Layer Group"
            }
			
            var options = {
              units: "dd",
              singleTile: false,
			  useHttpTile : true 
            }
            var layer = new OpenLayers.Layer.MapGuide( "Tiled Map", url, params, options );
		  	map.addLayer(layer);
            
	        map.zoomToMaxExtent();
			
	        map.addControl(new OpenLayers.Control.MousePosition());            
            map.addControl(new OpenLayers.Control.Scale());        
        }
    </script>


ESRI PROJECTIONS

FROM A FILE

# Create a spatial reference object
spatialRef = gp.CreateObject("spatialreference")

# Use a projection file to define the spatial reference's properties
spatialRef.CreateFromFile(r"c:\program files\arcgis\Coordinate Systems\" +                             "Projected Coordinate Systems\Continental\North America\North America Equidistant Conic.prj")

.prj

.AUX INFO folder


DEFINE PROJECTION

PROJECT RASTERS PROJECT FEATURES

REPROJECTING DATA

Personal tools