Skip to content

Graticule integration - #52

Merged
jywarren merged 13 commits into
publiclab:masterfrom
mridulnagpal:graticule-integration
Jul 9, 2017
Merged

Graticule integration#52
jywarren merged 13 commits into
publiclab:masterfrom
mridulnagpal:graticule-integration

Conversation

@mridulnagpal

Copy link
Copy Markdown
Member

No description provided.

@jywarren

jywarren commented Jul 3, 2017

Copy link
Copy Markdown
Member

Hi, Mridul - when it's running, can you push a copy to your gh-pages branch too so we can try it out? Thanks!

@mridulnagpal

Copy link
Copy Markdown
Member Author

@jywarren

jywarren commented Jul 3, 2017

Copy link
Copy Markdown
Member

This is looking really good. We need to make a couple follow up issues:

  1. let's tweak the grid resolution per zoom level so that multiple grid squares are shown for each zoom level (this may take some manual tweaking) -- and this will be what sets add setZoomByPrecision() method #44's setZoomByPrecision() - even if we don't do an algorithmic approach, we could actually literally do a look up table... worth considering. This can be a separate issue and separate PR.
  2. we need to highlight the center grid square now (I think this'll be the hard part, but if you look in how Graticule is implemented, it shouldn't be too hard). This can be in a separate issue.
  3. Can you require the Graticule plugin via npm using your package.json ?, instead of directly including the source? check if it's available on npmjs.org. This should be done in this PR. Thank you!

Thank you, Mridul!!! This is great progress.

@mridulnagpal

Copy link
Copy Markdown
Member Author

I don't find it on npm I tried earlier as well that's why we need it in source, also we will be altering the code for graticulate, thus we need it anyways.

@jywarren

jywarren commented Jul 3, 2017 via email

Copy link
Copy Markdown
Member

@mridulnagpal

Copy link
Copy Markdown
Member Author

I think this is only appllicable to npm packages that are registered and this one is not. I am getting several errors. I tried all of the solutions on that page

@jywarren

jywarren commented Jul 5, 2017

Copy link
Copy Markdown
Member

Can you post what you tried? I'm sure this works without npm registration; see how the PublicLab.Editor is doing this: https://github.com/publiclab/PublicLab.Editor/blob/master/package.json#L28

I had to fork and adjust that library, so i linked directly to the URL of my modded fork, specifying a branch with #branchname.

@mridulnagpal

Copy link
Copy Markdown
Member Author

I did npm install --save-dev git://github.com/Leaflet/Leaflet.Graticule.git#master and got error
image

@jywarren

jywarren commented Jul 6, 2017

Copy link
Copy Markdown
Member

Try adding this to package.json --

"leaflet-graticule": "git://github.com/Leaflet/Leaflet.Graticule.git#master"

then run npm update

@mridulnagpal

Copy link
Copy Markdown
Member Author

I actually tried that earlier, same issue appears to occur again
image

@jywarren

jywarren commented Jul 7, 2017

Copy link
Copy Markdown
Member

Ack! it's because it's git://github.com/Leaflet/Leaflet.Graticule.git, not git://github.com/Leaflet/Graticule.git! That really got me.

But also it needs a package.json -- so i forked, opened a new branch & PR, and you can now:

"leaflet-graticule": "git://github.com/jywarren/Leaflet.Graticule.git#patch-1"

until they accept my PR: Leaflet/Leaflet.Graticule#1

@mridulnagpal

Copy link
Copy Markdown
Member Author

My bad, corrected this

//
// expect(blurredLocation.gridSystem.getCellSize().rows).toBe(72.8);
// expect(blurredLocation.gridSystem.getCellSize().cols).toBe(118.3);
//

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to write a test for this? Or shall we just depend on Graticule? I'm not sure, does Graticule have tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will have to depend on graticule for that

Comment thread src/blurredLocation.js
};

options.zoom = options.zoom || 6;
options.map = options.map || new L.Map('map',{zoomControl:false}).setView([options.location.lat, options.location.lon], options.zoom);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you break this up onto multiple lines? For readability.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing

Comment thread src/blurredLocation.js Outdated
lat: 41.011234567,
lon: -85.66123456789
};
var stamenTerrain = L.tileLayer("https://a.tiles.mapbox.com/v3/jywarren.map-lmrwb2em/{z}/{x}/{y}.png").addTo(options.map);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why this name? Maybe something more generic, like tileLayer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was just a default, will change to tileLayer

Comment thread src/core/gridSystem.js Outdated
function addGrid() {
layer = L.latlngGraticule({
showLabel: true,
zoomInterval: [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this repeated? Maybe use an options parameter?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mridulnagpal

Copy link
Copy Markdown
Member Author

Done Please have a look.

@jywarren
jywarren merged commit 99ef13b into publiclab:master Jul 9, 2017
@jywarren

jywarren commented Jul 9, 2017

Copy link
Copy Markdown
Member

Great!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants