-
Notifications
You must be signed in to change notification settings - Fork 78
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
geoPackage error: "proj4.defs is not a function" #103
Comments
Hello, Please let me know if you are unable to get the tests running. If you are able to, and can write a failing test, you are welcome to submit a pull request to fix the issue you are seeing. Thanks, |
I am having a similar issue as @sveta-wl |
@sveta-wl @s-chand I have been unsuccessful in reproducing your errors. My steps are as follows: When I do these steps, I am able to open the index.html file in Safari, Chrome, and FireFox with no issues. I am using node 6.9.4. If you could please let me know your steps for creating this problem that would be good. In addition, even better would be a web page that I can go to in my browser that also demonstrates the problem. Also please let me know the version of node you are running to compile the code and what browser you are using to run it. Thanks |
@danielbarela Hey thanks for the response.
`componentDidMount(){
}`
I also tried the umd build and got this error instead
I'll try to have another look at the examples and see if there's something missing in my adaptation |
Hi @danielbarela It seems, that this part of code |
I have upgraded the ngageoint/geopackage npm package to 1.0.25 which should pin proj4 to 2.4.3 until I get some more time to look into this issue. Please let me know if that fixes your problems for now. If either of you are able to write me a failing test that would be awesome and would save me lots of time. |
Hi, I'm also facing this issue. It has to do with module loading with webpack in my React app. I did clone and add an hack to not break tests. Let me know if you want a PR. |
@danielbarela I understand that it is convenient to load proj4 definitions into geopackage, but I think it is out of scope of this lib. My suggestion would be to have an API method to load the definitions manually. What do you think? |
That sounds like a good suggestion. Please create a pull request with your suggested changes for me to take a look at. Thanks. |
@danielbarela Thanks. I don't know how many tests depends on proj4 definitions but this change will break those tests. Should I also fix these testes in the PR? Thanks. |
Yes, please. |
I'm not sure we should remove projection definition dependencies from this library. Most users will need to support projections in a GeoPackage in which they have no creative control over. It is a steep hurdle to require library users to parse the Manual loading of projections in addition to definitions is a good idea and something we do in our other GeoPackage libraries (Android, Java, iOS). New authorities and/or projections can be manually added through library calls and property configurations. Projections are retrieved in the following order until found or created:
|
@bosborn Other libs like OpenLayers and Leaflet also don't bundle proj definitions. OpenLayers only have included EPSG:4326 and EPSG:3857. Any other projections that are "project specific" are added manually. I think this is the best approach. My suggestion is something like this:
|
What about projections that are specified by the GeoPackage that you are loading and aren't necessarily part of your own project? |
You mean to NOT include all the current projections in https://github.com/ngageoint/geopackage-js/blob/master/lib/proj4Defs.js ? Yes, my sugestion is to include only 4326 and 3857. |
I was just saying, what happens if a GeoPackage that I get from an external source, specifies a projection like EPSG:32628 for example. How would that projection get loaded in order to present that data on the map to the user? |
That's what I was suggesting, using addProjection API, like this:
|
Hi guys,
the following problem occurs using geoPackage and proj4 ^2.4.3:
since this commit (the file lib/defs.js line 55) has been published by Proj4-team the geoPackage fails by initialization on following line. It seams, that now the correct way of calling
proj4.defs
at this point isproj4.default.defs(name, defs[name]);
otherwise it throws the error "proj4.defs is not a function".Could this issue be fixed or any workaround be suggested?
Thank you for help!
The text was updated successfully, but these errors were encountered: