# Simple Coordinate Reference System #210

Closed
opened this Issue Jul 25, 2011 · 9 comments

Projects
None yet
7 participants
Contributor

### tcoats commented Jul 25, 2011

 I'd like to use Leaflet to display images (similar to Zoomify). While it is currently possible to add an image overlay, it is displayed using accurate coordinates. Ideally a simple coordinate reference system could be used to define a 1:1 pixel LatLot reference. In Summary: 1:1 Coordinate Reference System

Contributor

### Majiir commented Nov 9, 2011

 I'd like this functionality as well. I looked into using image overlays, but my application is really better suited to using some sort of tile layer. My map is (potentially) infinite and non-repeating; think infinite flatland.

### robinvanemden commented Nov 30, 2011

 Second that! Would be great to have a 1:1 pixel reference.
Contributor

### Majiir commented Jan 3, 2012

 It's actually possible to accomplish this without any modifications to the source. It requires a couple new classes, but it's nothing too difficult. This creates new `Projection` and `CRS` classes for using unbound coordinates. For reasons I have yet to discover, `LngLat` coordinates do not map directly to `Point` coordinates, but there isn't any wrapping to cause trouble. ```L.Projection.NoWrap = { project: function (latlng) { return new L.Point(latlng.lng, latlng.lat); }, unproject: function (point, unbounded) { return new L.LatLng(point.y, point.x, true); } }; L.CRS.Direct = L.Util.extend({}, L.CRS, { code: 'Direct', projection: L.Projection.NoWrap, transformation: new L.Transformation(1, 0, 1, 0) });``` When creating our `Map`, we must reference the new `CRS` and also set `worldCopyJump` to `false`. `var map = new L.Map('map', {worldCopyJump: false, crs: L.CRS.Direct});` Finally, when creating a layer, we set `continuousWorld` to `true`. `var layer = new L.TileLayer(url, {continuousWorld: true});` Here is an example: link It's not exactly clean, but it should suffice for most purposes.

Closed

Closed

Member

### mourner commented Jul 25, 2012

 Wanted to refactor projections code so it doesn't need to use the ugly `worldCopyJump` and `continuousWorld` options and instead delegates everything to CRS, using bounding box and wrap settings from it, but there are some open questions regarding this, so I'll postpone it to 0.5 so there are less chances of breaking anything.

### cfis commented Jul 25, 2012

 A thought to consider while doing that. Remove the LatLng class. Instead just use Point. Also, all geometries should have an associated CRS. The way the geometry is interpreted is dependent on the CRS.

### rawsyntax commented Nov 11, 2012

 @Majiir I had a look at your example and am using this for some indoor maps. The X coordinate lines up perfectly (top left 0), however the Y coordinate is off by some factor. Any idea how the `scheme:'tms'` option would affect this? My problem seems to be in `_getWrapTileNum` which is commented as not accurate for nonstandard projections
Contributor

### Majiir commented Nov 15, 2012

 @rawsyntax Unfortunately I can't be much help to you; I didn't understand my code much when I wrote it, and by now I understand it even less. Is there a reason you need a specific scheme? If you're working with a flat coordinate system in Leaflet, it might be easier to do any kind of translation on the application end.
Member

### mourner commented Dec 12, 2012

 The included `CRS.Simple` is now much more usable out of the box (it has different default scaling and transformation now), and `LatLng` clamping/wrapping and `worldCopyJump` are now disabled by default. See `debug/map/simple-proj.html` for an example. So now I think it's safe to close the issue. The only thing left that bugs me is `continuousWorld` option that's still needed, but it will be handled separately later.

### jordan314 commented Dec 12, 2012

 I just wanted to add that CRS.Simple support is in the master branch not the hosted 0.4.5 branch. Also don't try and use the hosted CSS with the master branch JS. :) Thanks Mourner!