cuspatial icon indicating copy to clipboard operation
cuspatial copied to clipboard

[FEA] Any plans for a coordinate transformation/projection function?

Open asmith26 opened this issue 3 years ago • 12 comments

Hi there,

I was wondering if this lib offers a way for me to project a large cudf from lon/lat to UTM zone (e.g. .to_crs() in Dask GeoPandas)?

Many thanks for any help, and for this amazing lib! :)

asmith26 avatar Jun 15 '22 18:06 asmith26

It's certainly something we are considering. Is lonlat to UTM the only projection you need?

harrism avatar Jun 16 '22 00:06 harrism

We do have a simple lonlat to Cartesian (takes an origin point) API: https://docs.rapids.ai/api/cuspatial/stable/api.html#cuspatial.lonlat_to_cartesian

harrism avatar Jun 16 '22 00:06 harrism

It's certainly something we are considering. Is lonlat to UTM the only projection you need?

Great, thanks for the info. I predominantly only project to UTM, so this would be of most use to me.

asmith26 avatar Jun 16 '22 08:06 asmith26

Hi! Thanks for taking a look! Do you need lon/lat to specific coordinates within the UTM zone, or do you only want to identify which zone each lon/lat falls into?

thomcom avatar Jun 16 '22 14:06 thomcom

Thank you!

Do you need lon/lat to specific coordinates within the UTM zone, or do you only want to identify which zone each lon/lat falls into?

I need both really (i.e. first identify which UTM zone my points are in, and then transform them to this).

asmith26 avatar Jun 17 '22 08:06 asmith26

You could easily use https://apps.gis.ucla.edu/geodata/dataset/world_utm_zones with point in polygon to identify which coordinates are within each zone. Projecting them into zone coordinates is another problem unfortunately.

It seems possible to build a UTM projection using lonlat to Cartesian and a few known fixed coordinates inside or on the boundaries of each UTM zone.

I know that projections into specific coordinate systems can have many particularities. I'd love to support coordinate system transformations as one of our next major features. There are lots of coordinate systems to support. :)

thomcom avatar Jun 17 '22 14:06 thomcom

You could easily use https://apps.gis.ucla.edu/geodata/dataset/world_utm_zones with point in polygon to identify which coordinates are within each zone.

Great tip, thanks!

I know that projections into specific coordinate systems can have many particularities. I'd love to support coordinate system transformations as one of our next major features. There are lots of coordinate systems to support. :)

That's fair enough, thanks for any help - in case it helps, I've used pyproj for achieving this (on CPU):

utm_eastings, utm_northings = Proj(utm_epsg_code)(df["lon"].values, df["lat"].values)

It would be cool if we could somehow compile this to GPU, but I imagine/guess it might be a case of re-writing that sort of functionaility with GPU libs (maybe like numba, cupy,...?)

asmith26 avatar Jun 17 '22 15:06 asmith26

Actually, you've contributed a great deal just by pointing out https://github.com/OSGeo/PROJ. That's the best lead I've seen yet for us finding implementations and approaches for the numerous coordinate systems I mention above.

thomcom avatar Jun 17 '22 19:06 thomcom

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Jul 17 '22 20:07 github-actions[bot]

I was wondering if this lib offers a way for me to project a large cudf from lon/lat to UTM zone

@asmith26 any chance you can provide more information? e.g. how large is large (how many coordinates)? Anything else you can tell us about your use case / project to help us prioritize?

Thanks! CC @jarmak-nv

harrism avatar Jul 19 '22 00:07 harrism

Thanks for asking @harrism

  1. How Large: Many of my datasets are in the 100's of millions of coordinates, and (I think) all are <10 billion rows.
  2. More info: I have a number of projects that take data in lon/lat and convert these to a single UTM Zone for running machine learning algorithms on (since UTM works in metres it makes it easier to grid the data and run prediction on these).

Hope this helps!

asmith26 avatar Jul 19 '22 18:07 asmith26

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Aug 18 '22 19:08 github-actions[bot]

Hi @asmith26 - just wanted to let you know that we have a new library, cuProj, coming with the 23.08 release that GPU accelerates projections between WGS and UTM. You can check out the README here, and 23.08 should be releasing at the end of next week :tada:

jarmak-nv avatar Aug 04 '23 14:08 jarmak-nv

Many thanks for the info and for your help. This will help me greatly! :)

asmith26 avatar Aug 04 '23 15:08 asmith26