Hot answers tagged

6

Please note that Proj.4 and proj4js are not identical. If you download the latest version of proj4js, you find the defined projections in the lib/projections folder. Regarding EPSG codes, proj4js only has a few definitions, look into lib/global.js or see http://proj4js.org/ But it is possible to build all other definitions yourself if you take the proj4 ...


5

There are several problems here. First, let me quote from http://leafletjs.com/examples/wms/wms.html (emphasis mine): Also note that Leaflet supports very few coordinate systems: CRS:3857, CRS:3395 and CRS:4326 (See the documentation for L.CRS). If your WMS service doesn’t serve images in those coordinate systems, you might need to use Proj4Leaflet to ...


5

You have two choices Solution 1: You can change the reference to proj4js. OpenLayers 2.x default support is with Proj4js 1.1 whereas you use 2.x. <!doctype html> <html lang="en"> <head> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.min.js"></script> <script ...


5

There is nothing wrong with your GeoJSON. You just have to define the default projection and the destination projection in the source for on-the-fly projection. Also, there is no need to save the projection objects in variables, like ProjectionNL, you can use the EPSG code of any projection, after it has been defined by Proj4JS. Of course, you can change up '...


5

Effectively and contrary to what I intuited in the beginning, the coordinates of the points are well proyected. QGIS is showing the line in another position, because the layer is assigned with the EPSG:4326 CRS and is reprojecting on the fly to EPSG: 3857. This causes QGIS to calculate the curved (or projected) path from vertices of the geometry to the ...


4

You should leave your map in the default google coordinate EPSG: 3857 : map = new ol.Map({ loadTilesWhileAnimating: true, // adds default controls controls: ol.control.defaults().extend([ //adds a scalebar new ol.control.ScaleLine({ // units: ol.control.ScaleLineUnits....


4

Check the proj definition stored in the spatial_ref_sys, it should be different from the one used in the proj4js definition. For example, mine is the following: +proj=utm +zone=30 +ellps=intl +towgs84=-87,-98,-121,0,0,0,0 +units=m +no_defs Also epsg.io gives the one with the towgs84 parameters, so I'd change the Proj4js def.


4

I solved the problem by using a custom proj4.js definition for EPSG:31467. I replaced "+datum=potsdam" with "+towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.70" to achieve a 7 parameter Helmert Transformation instead of the used simple 3 parameter translation: proj4.defs["EPSG:31467"] = "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel ...


4

Solution direct from the owner of OL4. All you have to do is configure the projection with a custom getPointResolution function: var projection = new ol.proj.Projection({ code: 'EPSG:27700', getPointResolution: function(r) { return r; }, units: 'm' });


4

Here's the great circle geometry with EPSG:4326 and the great circle geometry with EPSG:3857/3395 so it appears QGIS is producing an accurate representation of the EPSG:4326 straight line in an EPSG:3857 projection. Different to OpenLayers but both are inaccurate in both projections, although QGIS in consistently inaccurate. This is the code I used to ...


3

I managed to fix my problem and just wanted to post the answer incase someone runs into this problem in the future. I ended up downloading the latest version of proj4js and this fixed the problem. OpenLayers recognized my custom projection after this.


3

Yes, it is a meaningful difference, there will be some difference in reprojecting. Those 7 parameters define a datum shift (translation + rotation + scaling). If the postgis reprojection is better than the other one, just add those parameters to the Proj4js definition. You can find additional information on the towgs84 param here https://trac.osgeo.org/...


3

This looks ok. If you run into reprojecting problems, try the spherical version, as I explained here: Manipulating Azimuthal Equidistant Projections in QGIS


3

Neither +proj=igh or +proj=goode are currently supported by proj4.js but mproj does support +proj=goode Demo here https://jsfiddle.net/3bjo7rsL/ and the code below. Error catching is needed to handle "off the world" transforms at the edges. <!DOCTYPE html> <html> <head> <link href="https://cdn.rawgit.com/openlayers/openlayers.github....


2

proj4.js uses string and array functions (e.g. .split(), .map()) which are not built in to older browsers. es5-shim (https://github.com/es-shims/es5-shim) fixes this; just load this JavaScript library before anything else (it is benign for newer browsers).


2

I have realised that proj4js doesn't work in IE below version 9


2

The coordinates you're passing in are latitude and longitude values so the input coordinate reference system (CRS) should be 'EPSG:4326' or some other geographic CRS instead.


2

I was accidentally loading pro4j twice, once trough potree, and once manually (for openlayers). Turned out one of the two was still on version 2.2.1...


2

Can I use a lambert 93 image overlay on top of an OSM tiles layer ? Leaflet is not able to reproject images. In other words: you can not display tiles/images which use different spatial reference systems. If not possible, can I convert my lambert 93 image.png to be usable with OSM tiles layers using tools such as gdalwrap ? Sure! Just remember the EPSG ...


2

You forgot to include the most important part of the message! L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet this isn't a complaint, its a reminder that you should use Proj4Leaflet if you are interested in supporting a basemap in a custom projection. live demo - http://jsbin.com/cemaqiv/edit?...


2

Edit: You have to add a new ol.proj.Projection in order to use your custom projection, you can't just use the proj4js-name or variable you gave your projection as an OpenLayers projection. Make sure your new OL-projection has a correct extent and make sure you use a correct center in ol.View (depending on what your projection is). projCode = 'BLAH'; // ...


2

You need to re-project your data to WGS-84 (4326) as that is the GeoJSON standard. All software using GeoJSON expects the data in that projection. Since the GeoJSON is in Lat/ Long decimal degrees, your UTM Meters coordinates won't show up where you expect them. " The coordinate reference system for all GeoJSON coordinates is a geographic coordinate ...


2

Starting from the Raster Reprojection Tutorial I found that the projection parameters you are using are for Mollweide Sphere. The Reprojection Example uses parameters for World Mollweide (ESRI:54009). Combining this example with OpenStreetMap Reprojection Example you can get a working reprojected map to Mollweide. See this codepen or the following code ...


2

Just found the answer on OpenLayers Github The reason is the 'import' syntax used to bring OL and Proj4JS into scope. With this syntax, one has to make sure OL is aware of Proj4JS by using the ol.proj.setProj4 function. Correct code is : import proj4 from 'proj4/dist/proj4'; import proj from 'ol/proj'; proj.setProj4(proj4); // <=== Add this line ...


2

Based on the input from @mike and @gabriel I came up with the following solution to handle this clientside when rendering the features (so not modifying the geometry of the original feature): Basically I make use of the Style object and the geometry-function (which returns a geometry to render). Runtime it will check if the area of a polygon is over a ...


2

transform converts the point in place so no new point is returned. See the documentation: Transform the LonLat object from source to dest. This transformation is in place: if you want a new lonlat, use .clone() first. So you want something like: var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286); lonLat.transform(epsg4326, EPSG27700); ...


1

Does it work if you omit the +title parameter? Like the following: proj4.defs("EPSG:42304", "+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"); I can't see 'title' in the parameter list at http://proj4.org/parameters.html#parameter-list . Omitting it results in a string that perfectly matches ...


1

proj4() expects a projection definition, not just an ellipsoid. From http://proj4js.org/ you might read that WGS84 is the only named projection defined in proj4js. You have to use the listed EPSG codes or define the projection in full. So your command might be: var firstProjection = "+proj=longlat +ellps=GRS80 +no_defs"; var secondProjection = "+proj=...


1

It seems like there is no way to add WMS layer in Robinson projection, because proj4js doesn't support this kind of projection, see #191.


1

In general it is best to allow the WMS and Leaflet determine the CRS of your requests (using the map projection) than to override it using a parameter in the WMS options. So in your case the options should be: var ortoOpt = { layers: ["0"], format: "image/png", transparent: true, request: "GetMap", version: "1.3.0", service: "...


Only top voted, non community-wiki answers of a minimum length are eligible