question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help Add the Option for 'ol/layer/Graticule' to Specify the Projection to Draw

See original GitHub issue

Is your feature request related to a problem? Please describe. I want to draw TWD67 (the graticule for Taiwan), except for the hard-coded EPSG:4326.

Describe the solution you’d like So it would help If there is a option, like ‘projection’ for Graticule Class.

PoC After studying Graticule class, I found it is not hard to parametrize the ‘draw projection’. I did write a PoC (the whole code is copied from v6.2.1., except for those marked “@@” ) and works well. To be short:

  1. parameterize for ‘draw projection’:
    • This requires to alter not only ol/layer/Graticule, but also ol/geom/flat/geodesic (for meridian and parallel functions)
  2. require the ‘projection’ option as a Projection and not a ProjectionLike

Demo web (Please zoom out to level 5~6 to see this is a “local” graticule)

Request I’m new to OL. For code coherence, It would better If any contributor can help review and code the idea.

Many thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dayanuyimcommented, Apr 12, 2020

Thanks! These are what I am looking for!

1reaction
mike-000commented, Apr 12, 2020

If you set up a projection using the constructor you must add it before it can be looked by code using getProjection (but getProjection takes projectionLike so you can pass the projection without having to add it)

const TWD67 = new Projection({
  code: 'EPSG:3828',
  extent: [ 145616.57, 2419514.81, 356704.34, 2803869.61 ],
  worldExtent: [119.99, 21.87, 122.06, 25.34 ],
  units: 'm',
});
addProjection(TWD67);

Alternatively you could simply look up the projection already defined by registering proj4 and set an extent

const TWD67 = getProjection('EPSG:3828');
TWD67.setExtent([ 145616.57, 2419514.81, 356704.34, 2803869.61 ]);
TWD67.setWorldExtent([119.99, 21.87, 122.06, 25.34 ]);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Define Projection (Data Management)—ArcGIS Pro
ArcGIS geoprocessing tool that overwrites the coordinate system information (map projection and datum) stored with a dataset.
Read more >
Help adding projection and coordinate system to drawing
1. Open the Settings tab in the Toolspace · 2. Right-click on the DWG and "Edit drawing settings" · 3. Select a projection...
Read more >
Specifying Coordinates - PGF/TikZ Manual
A coordinate is a position on the canvas on which your picture is drawn. TikZ uses a special syntax for specifying coordinates. Coordinates...
Read more >
Introducing Coordinate Systems and Map Projections
Why should you care about coordinate systems and map projections? ... A map projection is an integral part of a projected coordinate system...
Read more >
How to choose a projection
To help make this choice (repeating what was said above), look at the area of interest on a globe and see if its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found