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

Projinfo improvements: output operation summary and add --area option #1189

Merged
merged 2 commits into from Dec 3, 2018

Conversation

Projects
None yet
2 participants
@rouault
Copy link
Member

rouault commented Dec 3, 2018

No description provided.

@rouault rouault force-pushed the rouault:projinfo_improvements branch 2 times, most recently from 1dab665 to b319acd Dec 3, 2018

@kbevers

This comment has been minimized.

Copy link
Member

kbevers commented Dec 3, 2018

Just gave this is quick go. I expected the two calls below using --bbox and --area to be equivalent. What I am doing wrong?

$ bin/projinfo -s EPSG:25832 -t EPSG:23032 --bbox 8,55,12,56
unknown id, Inverse of UTM zone 32N + Inverse of ED50 to ETRS89 (4) + UTM zone 32N, 1 m, Denmark - onshore

PROJ string:
+proj=pipeline +step +inv +proj=utm +zone=32 +ellps=GRS80 +step +proj=cart +ellps=GRS80 +step +inv +proj=helmert +x=-81.1 +y=-89.4 +z=-115.8 +rx=0.485 +ry=0.024 +rz=0.413 +s=-0.54 +convention=position_vector +step +inv +proj=cart +ellps=intl +step +proj=utm +zone=32 +ellps=intl
$ bin/projinfo -s EPSG:25832 -t EPSG:23032 --area Denmark
unknown id, Inverse of UTM zone 32N + Null geographic offset from ETRS89 to ED50 + UTM zone 32N, unknown accuracy, World

PROJ string:
+proj=pipeline +step +inv +proj=utm +zone=32 +ellps=GRS80 +step +proj=utm +zone=32 +ellps=intl
Show resolved Hide resolved src/projinfo.cpp Outdated

@rouault rouault force-pushed the rouault:projinfo_improvements branch from b319acd to 0942d53 Dec 3, 2018

@rouault

This comment has been minimized.

Copy link
Member Author

rouault commented Dec 3, 2018

What I am doing wrong?

Ah I also stumbled upon this while testing. If you look closely at the unit test, you'll see I use "Denmark - onshore" / EPSG:3237, and not "Denmark" / EPSG:1080 . The later one is valid for onshore and offshore, but the "ED50 to ETRS89 (4)" is only valid for "Denmark - onshore"

so use projinfo -s EPSG:25832 -t EPSG:23032 --area 'Denmark - onshore'

@kbevers

This comment has been minimized.

Copy link
Member

kbevers commented Dec 3, 2018

I see. Can we make the area search a bit more loose? I notice that if I do a similar search for France I am presented with areas to choose from before continuing:

$ bin/projinfo -s EPSG:25832 -t EPSG:23032 --area France
Several candidate area of use matching providing name :
  EPSG:1096 : France
  EPSG:1326 : France - mainland onshore
  EPSG:1327 : France - Corsica onshore
  EPSG:1369 : France - Alsace
  EPSG:1731 : France - mainland north of 48.15°N
  EPSG:1732 : France - mainland 45.45°N to 48.15°N
  EPSG:1733 : France - mainland south of 45.45°N
  EPSG:1734 : France - mainland 45.45°N to 48.15°N. Also all mainland.
  EPSG:3545 : France - mainland south of 43°N and Corsica
  EPSG:3546 : France - mainland south of 44°N
  EPSG:3547 : France - mainland - 43°N to 45°N
  EPSG:3548 : France - mainland - 44°N to 46°N
  EPSG:3549 : France - mainland - 45°N to 47°N
  EPSG:3550 : France - mainland - 46°N to 48°N
  EPSG:3551 : France - mainland - 47°N to 49°N
  EPSG:3552 : France - mainland - 48°N to 50°N
  EPSG:3553 : France - mainland north of 49°N
  EPSG:3694 : France - onshore - mainland and Corsica
  EPSG:3897 : France - offshore Mediterranean
  IGNF:4 : FRANCE METROPOLITAINE (CORSE COMPRISE)
  IGNF:85 : FRANCE CONTINENTALE (CORSE EXCLUE)
  IGNF:91 : FRANCE
  IGNF:142 : FRANCE CONTINENTALE
  IGNF:143 : FRANCE METROPOLITAINE
  IGNF:218 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT GRAND CHAMP
  IGNF:219 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT I NORD
  IGNF:220 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT I CARTO
  IGNF:221 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT II CENTRE
  IGNF:222 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT II CARTO
  IGNF:223 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT II ETENDU
  IGNF:224 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT III SUD
  IGNF:225 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT III CARTO
  IGNF:226 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT IV CORSE
  IGNF:227 : FRANCE METROPOLITAINE (CORSE COMPRISE) - LAMBERT IV CARTO
  IGNF:235 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC42 (CONIQUE CONFORME ZONE 1)
  IGNF:236 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC43 (CONIQUE CONFORME ZONE 2)
  IGNF:237 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC44 (CONIQUE CONFORME ZONE 3)
  IGNF:238 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC45 (CONIQUE CONFORME ZONE 4)
  IGNF:239 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC46 (CONIQUE CONFORME ZONE 5)
  IGNF:240 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC47 (CONIQUE CONFORME ZONE 6)
  IGNF:241 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC48 (CONIQUE CONFORME ZONE 7)
  IGNF:242 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC49 (CONIQUE CONFORME ZONE 8)
  IGNF:243 : FRANCE METROPOLITAINE (CORSE COMPRISE) - CC50 (CONIQUE CONFORME ZONE 9)
  IGNF:244 : FRANCE METROPOLITAINE (CORSE COMPRISE) - UTM NORD FUSEAU 31
  IGNF:245 : FRANCE METROPOLITAINE (CORSE COMPRISE) - UTM NORD FUSEAU 32
  IGNF:246 : FRANCE METROPOLITAINE (CORSE COMPRISE) - UTM NORD FUSEAU 30
  IGNF:284 : FRANCE CONTINENTALE (CORSE EXCLUE) - UTM NORD FUSEAU 30
  IGNF:285 : FRANCE CONTINENTALE (CORSE EXCLUE) - UTM NORD FUSEAU 32
  IGNF:286 : FRANCE CONTINENTALE (CORSE EXCLUE) - UTM NORD FUSEAU 31
  IGNF:295 : FRANCE CONTINENTALE (CORSE EXCLUE) - LAMBERT I CARTO
  IGNF:296 : FRANCE CONTINENTALE (CORSE EXCLUE) - LAMBERT I NORD
  IGNF:297 : FRANCE CONTINENTALE (CORSE EXCLUE) - LAMBERT II CARTO
  IGNF:298 : FRANCE CONTINENTALE (CORSE EXCLUE) - LAMBERT II ETENDU
  IGNF:300 : FRANCE CONTINENTALE (CORSE EXCLUE) - LAMBERT II CENTRE
  IGNF:301 : FRANCE CONTINENTALE (CORSE EXCLUE) - LAMBERT III CARTO
  IGNF:302 : FRANCE CONTINENTALE (CORSE EXCLUE) - LAMBERT III SUD
  IGNF:305 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC42 (CONIQUE CONFORME ZONE 1)
  IGNF:307 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC43 (CONIQUE CONFORME ZONE 2)
  IGNF:309 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC44 (CONIQUE CONFORME ZONE 3)
  IGNF:310 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC45 (CONIQUE CONFORME ZONE 4)
  IGNF:311 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC46 (CONIQUE CONFORME ZONE 5)
  IGNF:312 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC47 (CONIQUE CONFORME ZONE 6)
  IGNF:313 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC48 (CONIQUE CONFORME ZONE 7)
  IGNF:314 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC49 (CONIQUE CONFORME ZONE 8)
  IGNF:315 : FRANCE CONTINENTALE (CORSE EXCLUE) - CC50 (CONIQUE CONFORME ZONE 9)

I reckon the reason I don't get this list is because there is just one area to choose from. So maybe display this list when a close enough match is found, even if there's just one result?

@rouault

This comment has been minimized.

Copy link
Member Author

rouault commented Dec 3, 2018

Actually the logic to identify the area of use from its name starts with an exact match. So as "Denmark" has a hit and a single hit, then it is used directly. For France, the reason is that my SQL query uses the LIKE operator to be case insensitive, but there is "France" (in EPSG) and "FRANCE" (in IGNF), so as there is no single match, approximate search is done.
If we do what you suggest (that is always approximate search), it means that people wanting to use "Denmark" will not be able to do it by name, right ?

@kbevers

This comment has been minimized.

Copy link
Member

kbevers commented Dec 3, 2018

Actually the logic to identify the area of use from its name starts with an exact match. So as "Denmark" has a hit and a single hit, then it is used directly.

And the area of that hit is "World", yes? At least that is what I understand from

$ bin/projinfo -s EPSG:25832 -t EPSG:23032 --area "Denmark" --identify
unknown id, Inverse of UTM zone 32N + Null geographic offset from ETRS89 to ED50 + UTM zone 32N, unknown accuracy, World

Is that an exact match because "Denmark" is listed as being part of "World"?

As far as I understand, all of the France areas (except the first) have names that include more than just "France", e.g. "France - mainland onshore" or "France - Corsica onshore". Why isn't the exact match for "France" chosen as the default in the case in my previous comment?

If we do what you suggest (that is always approximate search), it means that people wanting to use "Denmark" will not be able to do it by name, right ?

Not sure about that. What if the output was as follows:

$ bin/projinfo -s EPSG:25832 -t EPSG:23032 --area Denmark
Several candidate area of use matching providing selected area:
  EPSG:xxxx : World
  EPSG:yyyy : Denmark - onshore

Wouldn't that allow users the option of choosing the area they want without hiding the fact that a more suitable area than the default might be available?

@rouault

This comment has been minimized.

Copy link
Member Author

rouault commented Dec 3, 2018

Is that an exact match because "Denmark" is listed as being part of "World"?

Nope, this is because when you specify Denmark, no appropriate transforms is found, and then the code fallbacks to generate this dummy "Null geographic offset from ETRS89 to ED50" that is so dummy that it can apply to the whole world if people are ready to use it.

Why isn't the exact match for "France" chosen as the default in the case in my previous comment?

This is because I considered that exact match was based on case-insensitive comparisons (wanted to be tolerant to people using foo, FOO or Foo), using the SQLite LIKE operator. Obviously the French messed this logic up ;-)

Wouldn't that allow users the option of choosing the area they want without hiding the fact that a more suitable area than the default might be available?

Ah ok, so in case there is a single exact match, use it, but still display the other approximate candidates as a warning ? (unless --quiet is used)

Hum actually, I realize you meant something else, that is explore the results to see which area of use they refer to. But if you specify an area of use, it is used to filter out results. So "Denmark" would result in rejecting transformations only valid for "Denmark - onshore". Except if I do the search of operations in two pass:

  • first pass: without any area of use criterion. silent output.
  • if no operations refer to the area of use specified by the user, but some operations have an area of use which is a substring that the user specified area of interest, display those candidate area of uses, and exit
  • otherwise do a second pass like currently done with the user specified area.

Hum, a bit complicated to implement. Would rather deal that as an improvement over the proposed base behaviour of this PR

@kbevers

This comment has been minimized.

Copy link
Member

kbevers commented Dec 3, 2018

Okay, I understand the logic now. And you understood perfectly what I meant. I agree that this better dealt with as an improvement later on and not as part of this PR. I just get excited by this little nifty tool you've created and I can't keep myself from coming up with cool things that it should also do :-)

I am happy with this PR as provided now!

@rouault rouault force-pushed the rouault:projinfo_improvements branch from 0942d53 to 0ba9d24 Dec 3, 2018

@rouault rouault merged commit addf30e into OSGeo:master Dec 3, 2018

1 check was pending

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.