-
Notifications
You must be signed in to change notification settings - Fork 41
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
diff/show: Add reprojection #213
Conversation
e6a0b00
to
70af52c
Compare
Can we use |
So, these are the formats
I'm not keen on this one, c/- the above logic.
Meant to be the same?
Presumably this is any proj-string, so eg: Idle not-for-now query: if I add a
Can we make the content of this just parsed like the command-line argument? Ie could contain a proj string, And related to axis-order handling ideas, can we add URN support? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -392,19 +408,23 @@ def _out(dataset, diff): | |||
class LazyGeojsonFeatureOutput: | |||
"""Wrapper of KeyValue that lazily serialises it as GEOJSON when sent to json.dumps""" | |||
|
|||
__slots__ = ("change_type", "key_value") | |||
__slots__ = ("change_type", "key_value", "geometry_transform") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there one transform per dataset? Do we need to carry it around with every feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, there's only one of these objects (all features get the same one).
but the geometry isn't turned into an OGR geometry until it's being streamed out as JSON. So we need to pass the transform down into the lazily-serialized object so it can be used after we have an OGR geometry.
Doing it this way is quite elegant because it ensures minimal memory overhead; we don't have to store millions of OGR geometries in memory (we just create one at a time while streaming JSON out)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, doing the transform at emit-time makes total sense. But why do we need to pass N million pointers to the same Transform object about with each feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the alternative being a global variable? I try to avoid those where it's not absolutely necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create an output context containing that?
I'm not familiar enough with how this is working though, I'd have to dig in tomorrow — eg: I thought we were generating/producing a feature at a time, but that doesn't seem to be the case, we're building up big features lists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort of - we're building up lists of dicts, but only transforming & converting during json.dump()
. It's a lot less work up-front than it used to be.
ok, will remove
yes it does
yeah, that'll cause issues, but let's not deal with it. User problem
it is - I wasn't suggested the filename here is important. It just reads the file and parses it as a string like everything else
will see if I can get GDAL to handle them. Otherwise I'm not terribly familiar with them and don't really want to figure out how to parse them correctly |
1bcbd81
to
7d9cdff
Compare
|
cae6bbf
to
53a7447
Compare
Alternatively use OGC WKT with: `--crs @nztm.wkt`
778f8b7
to
d887a30
Compare
Description
diff/show: Add reprojection using the
--crs
option.The form of the argument is quite flexible. Equivalent forms:
--crs 2193
--crs epsg:2193
--crs EPSG:2193
--crs '+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'
--crs 'PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",GEOGCS["NZGD2000",DATUM["New_Zealand_Geodetic_Datum_2000",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6167"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4167"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",173],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",1600000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","2193"]]'
--crs @./nztm.wkt
--crs @./nztm.prj
I have not added any handling for cases where reprojection fails. The process will error (
RuntimeError
normally) in that case.Related links:
none
Checklist: