gismo icon indicating copy to clipboard operation
gismo copied to clipboard

Gismo Location to XY generated inappropriate value

Open yiqiaowang-arch opened this issue 1 year ago • 5 comments

Issue

I am using a .shp file that describes an area in Zurich, Switzerland and I used Gismo in Rhino 7.34 to import the geometry into grasshopper. The SHP to Location battery generates location which is roughly 47.38N, 8.48E. When I use LocationToXY (ver 0.0.3, Jan_29_2019) however, the location was translated into point (294608, 5248100). image

Expected Behaviour

According to the geo location of Zurich, EPSG 32632 should be an appropriate coordination system, which will translate 47.38N, 8.48E into (460629, 5214800).

Possible location of issue

I looked into the code of LocationToXY, and found that the output EPSG was determined by latitude and longitude automatically.

def main(requiredLocation, anchorLocation, anchorOrigin):
    ...
    # inputCRS
    EPSGcode = 4326
    inputCRS = gismo_gis.CRS_from_EPSGcode(EPSGcode)
    # outputCRS
    outputCRS = gismo_gis.UTM_CRS_from_latitude(required_locationLatitudeD, required_locationLongitudeD)

I tried to modify the output CRS to:

    # outputCRS
    outputCRS = gismo_gis.CRS_from_EPSGcode(32632)

But the output stays the same.

yiqiaowang-arch avatar Oct 17 '23 11:10 yiqiaowang-arch

Hi @yiqiaowang-arch ,

Sorry for the late reply. From Gismo's side, everything works as intended. If you print the 'outputCRS' from your first code snippet, you will see the following: print outputCRS.Name # WGS 84 / UTM zone 32N

"UTM zone 32N" is exactly the EPSG:32632 you pointed out.

I think your question is why shapefile geometry is not projected somewhere far away like it would be if you would use QGIS or ArcGIS? Rhino moves the projected geometry from that original location to "origin_" input. In your .gh file you didn't change this input, which means it is set to 0,0,0 by default. In uploaded .gh file below, I added a 'moveVec' output so that you can move the geometry back to the originally projected location: https://www.dropbox.com/scl/fi/lk8qtwqdpy29pov7w5lnq/read-shapefile-move-geo-to-original-projected-location.gh?rlkey=bbuampdcslt95mnezg4pahzg0&dl=0

image

stgeorges avatar Oct 22 '23 08:10 stgeorges

Dear @stgeorges Thank you very much for your reply! I have tried your new battery, it worked perfectly, and thank tothat I can finally explain my problems much better. image

In these two batteries, the output point/vector doesn't fit with each other. THe upper one (that you just sent me) matches the EPSG:32632 projection, but the lower one (the battery I have mentioned in my issue description) has a weird x value, but the y value somehow still fits.

I don't know if I had a wrong understanding of the function of this "location to XY" battery, but I indeed had problems finding the origin point before, and this new feature really helps me a lot in aligning different shp files into a same place around the (0,0,0) point. Thank you again for helping, and I really appreciate your effort in working on Gismo!

yiqiaowang-arch avatar Oct 22 '23 22:10 yiqiaowang-arch

Hi @yiqiaowang-arch , What are you trying to do? You have different .shp files, and you would like to overlay one on top of each other? Can you uploadyour .shp files please, and share a link to them?

stgeorges avatar Oct 23 '23 13:10 stgeorges

Just as you said, I have a .shp file that is coded in EPSG:4326, and I have a group of points coded in EPSG:32632, and I want the points to be on the exact location of my .shp files. https://www.dropbox.com/scl/fo/it47cxg5m8f8c63qu12lr/h?rlkey=zqgjvdb2yzhrfl86f1tmwiq4l&dl=0 or in onedrive: https://1drv.ms/f/s!Ai_5pui2MokRk-hbzk2WmzpnWhXCoQ?e=03dkt0

yiqiaowang-arch avatar Oct 25 '23 22:10 yiqiaowang-arch

Hi @yiqiaowang-arch , Thank you for the shared files. I opened both of your B162298_geometry_tran.csv and B162307_geometry_tran.csv files. They both have projected coordinates for building corners. When you have projected coordinates, then just use the regular Grasshopper "Construct Point" component to recreate the building corner points. I attached a .gh file which imports corner points from both csv files. And I also included a shapefile of Zurich from that area: https://www.dropbox.com/scl/fi/13b0k2jsfidl4pqhg51io/Zurich_Schaechenstrasse_shapefile.zip?rlkey=gnpsgbiyruvhtjrcu0e6xcwya&dl=0

Here is the alignment of the shapefile, with your building corner points (two green buildings): image

stgeorges avatar Oct 29 '23 23:10 stgeorges