Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graticule integration #52

Merged
merged 13 commits into from
Jul 9, 2017
Merged

Conversation

mridulnagpal
Copy link
Member

No description provided.

@jywarren
Copy link
Member

jywarren commented Jul 3, 2017

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
Member Author

@jywarren
Copy link
Member

jywarren commented Jul 3, 2017

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
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
Copy link
Member

jywarren commented Jul 3, 2017 via email

@mridulnagpal
Copy link
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
Copy link
Member

jywarren commented Jul 5, 2017

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
Member Author

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

@jywarren
Copy link
Member

jywarren commented Jul 6, 2017

Try adding this to package.json --

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

then run npm update

@mridulnagpal
Copy link
Member Author

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

@jywarren
Copy link
Member

jywarren commented Jul 7, 2017

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
Member Author

My bad, corrected this

//
// expect(blurredLocation.gridSystem.getCellSize().rows).toBe(72.8);
// expect(blurredLocation.gridSystem.getCellSize().cols).toBe(118.3);
//
Copy link
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
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

};

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
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
Member Author

Choose a reason for hiding this comment

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

Sure thing

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
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
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

function addGrid() {
layer = L.latlngGraticule({
showLabel: true,
zoomInterval: [
Copy link
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
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
Member Author

Done Please have a look.

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

jywarren commented Jul 9, 2017

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