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

Weird behaviour when generating heights (CZ) #7

Closed
LoogleCZ opened this issue Jan 21, 2020 · 8 comments
Closed

Weird behaviour when generating heights (CZ) #7

LoogleCZ opened this issue Jan 21, 2020 · 8 comments
Labels
bug Something isn't working probably solved The problem is so close to being solved

Comments

@LoogleCZ
Copy link

When generating heights for the map (country=CZ), script (mod2) tends to create download peaks.

image

I would expect constant network usage when downloading heights data. Also consider bit refactor of mod2. In the script, "stupid" str.split is used to get data out of json. Thats one thing, another thing is, that in case when you will generate 4x4 map (my case), it will open ~4227136 connections just to get one number. Web protection services can detect this ammount of connections as an attack and will cause slow down for that user.

TODO:

  • In the documentation find way how to download bulk of datas
  • Refactor mod2 to be able to download just one datafile with all necesary heights

Impact:

Because of this issue, this script hard to use for large maps in czech environment.

@LoogleCZ
Copy link
Author

@CrusheerPL CrusheerPL added the bug Something isn't working label Jan 22, 2020
@CrusheerPL
Copy link
Owner

CrusheerPL commented Jan 23, 2020

I am going to use the getSamples method (https://ags.cuzk.cz/arcgis2/rest/services/dmr5g/ImageServer/getSamples) instead of identify.
The getSamples method allows you to enter the coordinates of more than one point, if the geometryType parameter is set to esriGeometryMultipoint. As a result, the mod2 execution time may be shorter.
More info: http://ags.cuzk.cz/arcgis2/sdk/rest/index.html#/Get_Samples/02ss000000ms000000/

@CrusheerPL CrusheerPL added the investigating Looking for a solution... label Jan 23, 2020
@LoogleCZ
Copy link
Author

Thanks, this would help (certainly this will shorten the execution time), but I'm still afraid that there will still be too much unnecessary amount of data.

But start with GetSamples method is a good approach of course, then I will try to use ExportImage for processing area tile. (I think we don't need samples or identify because we want to sample continuous area). And processing images in python is not a problem at all

@CrusheerPL
Copy link
Owner

Unfortunately, I can't give so many points' coordinates in one query. In this video you can see why.
https://streamable.com/ojw5q
38 points in one query – OK.
39 and more – HTTP 404.
But always something.

@LoogleCZ
Copy link
Author

Maybe internal response limit? From documentation:

The number of sample locations in the response is based on the sampleDistance or sampleCount parameter and cannot exceed the limit of the image service (the default is 1000, which is an approximate limit).

But HTTP 404 is weird way how to indicate that limit is exceeded. I will try ExportImage now and let you kow my results

@LoogleCZ
Copy link
Author

LoogleCZ commented Jan 23, 2020

I've managed to export image based on lat/long coordinates (spatial reference 4326) and resulting image is in Krovak projection (spatial reference 5514). But then I don't know how to exactly use that image (must figure out later).

My idea is:

  1. generate array of points on which we want to know heights (in WGS84, because I know how to do in this coordinate system - approx.)
  2. Download image (min and max values from previous step, in WGS84 - SRS 4326) in Krovak projection (SRS 5514)
  3. Somehow address the image as 2D image array with S-JTSK coordinates. Shifting along axis X in WGS84 != shifting along X in S-JTSK. But maybe simple transformation from WGS84 will be enough to get index into the image. I'm too tired for this math now.
  4. Use sampled values as height values.

Resource:

Get image - input bounding box in WGS84, output image in S-JTSK

CrusheerPL added a commit that referenced this issue Jan 24, 2020
- CZ part:
  - elevation data downloading improved: #7 (comment) (use the "getSamples" method instead of "identify")
  - JSON data is now converting to dictionary (no more string.split operations)
- PL part:
  - "getHeightPL" function replaced by "openUrl"
  - if the server returns less than 200 points' heights, the script will inform about it
- No support for Python 3.8 or newer, and Python older than 3.5
- Code optimization
@CrusheerPL
Copy link
Owner

CrusheerPL commented Jan 24, 2020

In spite of all, new version of this script seems to work fine. (2048 x 2048) m terrain in <10 minutes, without the weird behaviour mentioned in the 1st post.

Maybe your idea would be good, but let's see how the new version will work :)
New version: 44fcaf0

@CrusheerPL CrusheerPL added probably solved The problem is so close to being solved and removed investigating Looking for a solution... labels Jan 24, 2020
@LoogleCZ
Copy link
Author

Great - I will try to do it my way and I will use your solution as reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working probably solved The problem is so close to being solved
Projects
None yet
Development

No branches or pull requests

2 participants