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

Downloaded JSON has only lat, no lon #1353

Open
jywarren opened this issue Feb 13, 2023 · 14 comments
Open

Downloaded JSON has only lat, no lon #1353

jywarren opened this issue Feb 13, 2023 · 14 comments
Labels

Comments

@jywarren
Copy link
Member

Hi, all, not sure when this happened, but I created and downloaded a JSON file and it was this:

{"avg_cm_per_pixel":9.765205126141716,"collection":
[
{"id":246,"src":"https://archive.org/download/texas-barnraising//IMG_0137.JPG","tooltipText":"IMG_0137","image_file_name":"IMG_0137.JPG","nodes":[{"lat":30.24656835091466},{"lat":30.24669606967037},{"lat":30.246681528559265},{"lat":30.246802763541005}],"cm_per_pixel":8.844274048278852},
{"id":244,"src":"https://archive.org/download/texas-barnraising//IMG_0128.JPG","tooltipText":"IMG_0128","image_file_name":"IMG_0128.JPG","nodes":[{"lat":30.24661665249983},{"lat":30.24664503656851},{"lat":30.246701804681287},{"lat":30.246730188725383}],"cm_per_pixel":5.5115729012365255},
{"id":232,"src":"https://archive.org/download/texas-barnraising//IMG_0807%20(2).JPG","tooltipText":"IMG_0807%20(2)","image_file_name":"IMG_0807%20(2).JPG","nodes":[{"lat":30.24684989876675,"lon":-97.74413697207335},{"lat":30.247082694639825,"lon":-97.74389014505901},{"lat":30.246596047697814,"lon":-97.74386020327914},{"lat":30.24687811716672,"lon":-97.74360684083737}
],"cm_per_pixel":14.939768428909769}]}

Notice none of the first two image's coordinates have longitudes. How do you think this happened? Let's dig in and investigate! Thanks!!

@jywarren jywarren added the bug label Feb 13, 2023
@segun-codes
Copy link
Collaborator

segun-codes commented Feb 14, 2023

Interesting.. I will look into this or well, @7malikk do you want to do this? Thanks!

@7malikk
Copy link
Collaborator

7malikk commented Feb 14, 2023

@segun-codes You can go ahead, I did some findings though, after resolving issue #1352 I tried the following:

Trial 1

latLng

Result of Trial 1

image

Trial 2

t-2latLng

Result of Trial 2

image

Trial 3

t-3latLng

Result of Trial 3

image

As seen in these trials, there are consistent lon values, @jywarren
@segun-codes Give it a try as well

@jywarren
Copy link
Member Author

jywarren commented Feb 14, 2023

(Oops moving this comment to this PR, i had meant to comment there - #1354)

@jywarren
Copy link
Member Author

Sorry for commenting in the wrong place!

@jywarren
Copy link
Member Author

jywarren commented Feb 14, 2023

OK, not sure if this is related at all - 2 observations:

image

I found that in this collection: https://archive.org/details/sanborn-1885

See the individual files here: https://archive.org/download/sanborn-1885

one of the longitudes was recorded as "lng" not "lon" -- different libraries use lng or lon, so maybe there's an issue there? But so strange that it was just one corner!!!

I also uploaded a new mapknitter.json file there (just generated), so I'm not sure when the "lng" was introduced. But I had moved one corner so maybe that one was converted to "lng"?

I think we should double check everywhere we're using "lng" vs "lon" and maybe that's somewhere the cause of the issue!

@jywarren
Copy link
Member Author

And you can try it out live at https://publiclab.github.io/Leaflet.DistortableImage/examples/archive - it's running the latest code!

@segun-codes
Copy link
Collaborator

segun-codes commented Feb 14, 2023

Hi @7malikk, @jywarren, I just observed that layer.getCorners() in generateExportJson() does not return corners for some images e.g., IMG_0807 and IMG_0725 from https://archive.org/details/texas-barnraising/. You may want to try them out too.

IMG_0807
IMG_0807

IMG_0725
IMG_0725

@segun-codes
Copy link
Collaborator

segun-codes commented Feb 14, 2023

Oh! @7malikk, @jywarren, I tried the same images again and layer.getCorners() returned corners. I can't seem to reproduce same error again. Very strange!!!

@segun-codes
Copy link
Collaborator

OK, not sure if this is related at all - 2 observations:

image

I found that in this collection: https://archive.org/details/sanborn-1885

See the individual files here: https://archive.org/download/sanborn-1885

one of the longitudes was recorded as "lng" not "lon" -- different libraries use lng or lon, so maybe there's an issue there? But so strange that it was just one corner!!!

I also uploaded a new mapknitter.json file there (just generated), so I'm not sure when the "lng" was introduced. But I had moved one corner so maybe that one was converted to "lng"?

I think we should double check everywhere we're using "lng" vs "lon" and maybe that's somewhere the cause of the issue!

Hi @jywarren, I fetched the two images from https://archive.org/details/sanborn-1885 and there was no inconsistency in the naming for longitude, see section highlighted yellow:
3

@jywarren
Copy link
Member Author

jywarren commented Feb 14, 2023

Well, I think it's a clue even if this specific issue isn't reproducible. Did you try moving one corner of the image, then checking again?

The layer.getCorners() thing is also a clue! We should look in the core library code to see where it's assembled!

I did that, printed the corners shortly after assembly in distortableImageOverlay.js. Corners were printed on each occasion, no miss. See the underlined:
2

4

5

@segun-codes
Copy link
Collaborator

I think I might have addressed this issue in PR #1359 already.

@jywarren
Copy link
Member Author

jywarren commented Feb 18, 2023 via email

@jywarren
Copy link
Member Author

Could this also be related somehow to the corner ordering in #1350 ? Hard to see how, but good to bear in mind as a possible complicating factor.

@segun-codes
Copy link
Collaborator

Could this also be related somehow to the corner ordering in #1350 ? Hard to see how, but good to bear in mind as a possible complicating factor.

Possibly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants