Tuesday, 3 January 2017

javascript - OpenLayers: transfer from custom projection to map projection


I am building a web application with OpenLayers that contains a map that allows insert, edit and remove points, my map is now using “EPSG:4326" projection.


I have shapefiles and xlsx files that contain polygons and points that I need to insert as layer in the map. The problem is that the shapefiles use EPSG:2309 projection, this is Israel tm grid projection that OpenLayers doesn't recognize.



How do I transfer these points/polygons to the EPSG:4326 projection?


I found this: http://spatialreference.org/ref/epsg/2039/html/ But I don't know if its can be helpful, or how...



Answer



In Openlayer you can specify a specific projection (see the documentation --> http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js)


I found the projection definition in postGIS (EPSG:2309 "Israel / Israeli TM Grid")


You can then use the code below :


Proj4js.defs["EPSG:2309"] = "+proj=tmerc +lat_0=31.73439361111111 +lon_0=35.20451694444445 +k=1.0000067 +x_0=219529.584 +y_0=626907.39 +ellps=GRS80 +towgs84=-48,55,52,0,0,0,0 +units=m +no_defs ";

Reprojection will be allowed.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...