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

WKID question of OGCGeometry.fromText() and OGCGeometry.fromBinary() #139

Open
yiranwang opened this issue Jul 19, 2017 · 3 comments
Open
Labels

Comments

@yiranwang
Copy link

yiranwang commented Jul 19, 2017

public static OGCGeometry fromText(String text) {
OperatorImportFromWkt op = (OperatorImportFromWkt)OperatorFactoryLocal.getInstance().getOperator(Type.ImportFromWkt);
OGCStructure ogcStructure = op.executeOGC(0, text, (ProgressTracker)null);
return createFromOGCStructure(ogcStructure, SpatialReference.create(4326));
}
For this function (same as fromBinary), it will output OGCGeometry using the WKID 4326 directly. If the input text has some information of SRID which is not 4326, what should we do? Or current api for all the relations (such as st_contains, st_intersects etc.) is just suited for 4326 spatial reference system. In the function fromGeoJson or fromJson, it will parse the WKID from the Json input and set the SpatialReference. Here, I have a question: if the SRID is not 4326, when we do the relation query for these geometries, do we use the spatial reference system in the input JSON, or we change the spatial reference system to the 4326? Thank you!

@alocke
Copy link
Member

alocke commented Jul 19, 2017

Currently, ImportFromWkt doesn't import spatial references from text. We can add that functionality if you need it.
I don't understand what you mean when you say that relational operations are suited only for 4326. Can you explain it more?

@yiranwang
Copy link
Author

yiranwang commented Jul 19, 2017

Thank you so much! Yes, I think for the functions fromText or fromBinary, it's better to have the part to import the spatial reference. If there is no information of WKID or SRID in the WKT or WKB, we could use the 4326 as default one. For the second question, for example, I run this:
containsOperator.execute(leftGeometry.getEsriGeometry(), rightGeometry.getEsriGeometry(), leftGeometry.getEsriSpatialReference(), null);
In public boolean execute(Geometry inputGeom1, Geometry inputGeom2, SpatialReference sr, ProgressTracker progressTracker) {
return RelationalOperations.relate(inputGeom1, inputGeom2, sr, 1, progressTracker);
}
If the WKID of sr is not 4326, could we guarantee the correctness of the containsOperator.execute(...)?

@alocke
Copy link
Member

alocke commented Jul 20, 2017

Yes, the relational operators work correctly no matter which spatial reference is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants