question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instantiating many proj objects much slower than 1.9.6

See original GitHub issue

I have a tool in pyproj 1.9.6 that I use for doing a “reverse lookup” of projections. Given an x/y in unknown CRS and a known longitude/latitude, this finds the projections which place that x/y closest to the known longitude/latitude. This is helpful when trying to track down an unknown coordinate system.

This requires instantiating thousand of proj/Proj objects, but it only takes a few seconds in pyproj 1.9.6. Recently I wanted to upgrade to more recent versions of PROJ and GDAL, but this tool is now taking a few minutes, about 50 times longer in pyproj 2.x:

I know that a lot changed in the underlying PROJ C++ library between pyproj 1.9.6 and 2.x. But is there any way to restore the fast instantiation of the proj/Proj objects? The projections don’t have to be exact - just close enough to this reverse lookup tool. Also, I am willing to serialize/pickle the proj objects if that would help, though my understanding was that that didn’t work with Python C extensions.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
dmahr1commented, Oct 27, 2020

@snowman2 I definitely thought about using area of interest to filter projections. And that’s a really cool new helper function for querying them! But there’s nothing stopping a novice GIS user from (wrongly) using a coordinate system for points outside of the area of interest, right? In that case I think it’s better to be thorough and just check everything. Each request to the cloud function only takes about 500 ms 😃

1reaction
snowman2commented, Jul 3, 2020

But it looks like the global context is leaving open a persistent connection to the database via the PROJ C API?

That was one of the settings that needed to be tweaked to get this to work. Also, adding the settings to the context beforehand and not updating them each time shaved off time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is Instantiate bad for performance? Unity says it's fast, forums ...
I am trying to optimize my game and I read on the forums that Instantiate can be bad for performance. But I never...
Read more >
Frequently Asked Questions - NekoHTML - SourceForge
5 to 1.9.6. The new version marks a fresh start for NekoHTML and indicates that the project is mature and stable. Why are...
Read more >
GNU Automake
This manual is for GNU Automake (version 1.9.6, 9 July 2005), a program that creates GNU standards-compliant Makefiles from template files. Copyright ©...
Read more >
1.9.6.1. altera_chip_pin_lc - Intel
Do not use this attribute to assign pin locations from entities at lower levels of the design hierarchy. Note: The altera_chip_pin_lc attribute is...
Read more >
Open and create — segyio 1.9.6 documentation
The data type object of the traces. This is the format most accurate and efficient to exchange with the underlying file, and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found