2

the title seems weird though, i am dealing with Japanese shapefile and it has its own "bizarre" projection.

I have two hints to solve this issue.

  1. it's based on espg 4301 (http://pacificprojections.spc.int/4301#)
  2. but the coordinates is in integer(?), it has to be transformed. for instance, the coordinates divided by (3600*1000) e.g.) 502888725, 128444858 => 139.6913125, 35.6791272

Within QGIS, it looks like i need to make custom CRS and fix proj.4 of ESPG 4301, which looks like below (i added +to_meter = 1/3600000)

+proj=longlat +ellps=bessel +towgs84=-146.414,507.337,680.507,0,0,0,0 +no_defs +to_meter=1/3600000

but obviously, it doesn't work.

Can anyone help for this?

when i define the projection to ESPG 4301 and open the file in ArcGIS, it shows the error message of extent issue.

  • or seems like i have to modify the coordinate of the shape file, internally. (like changing the extent..?) but how? :( – Pil Kwon Sep 25 '17 at 6:38
  • On thing to try - go into layer properties and recalculate the extent (from ArcCatalog, open layer properties and go to the Feature Extent tab. Click recalculate). – jbalk Sep 25 '17 at 7:41
  • @jbalk thanks for the comment. it did change the extent yet not showing any features on my arcmap display :@ hmm.... it's another headache – Pil Kwon Sep 25 '17 at 8:01
3

What you need to do is to scale the coordinates. You can do it with GDAL and SQLite/SpatiaLite SQL dialect http://www.gdal.org/ogr_sql_sqlite.html and the "ScaleCoords" function of SpatiaLite https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html

I made a test with your example point by saving the WKT of it POINT (502888725 128444858) into OpenJUMP file japan_1.jml. Then I verified with ogrinfo that the scaling works as supposed. I had to convert the scale factor expression 1/3600000 first into number 2.7777777777777777777777777777778e-7

ogrinfo -dialect sqlite -sql "select scalecoords(geometry,2.7777777777777777777777777777778e-7) as scaled_geometry from japan_1" japan_1.jml
Had to open data source read-only.
INFO: Open of `japan_1.jml'
      using driver `JML' successful.

Layer name: SELECT
Geometry: Unknown (any)
Feature Count: 1
Extent: (139.691312, 35.679127) - (139.691312, 35.679127)
Layer SRS WKT:
(unknown)
Geometry Column = scaled_geometry
OGRFeature(SELECT):0
  POINT (139.6913125 35.6791272222222)

Seems to work. What you need to do is to edit a -sql parameter so that it suits with your data. Command will look about like this:

ogr2ogr -f "ESRI Shapefile" -a_srs epsg:4301 -dialect sqlite -sql "select scalecoords(geometry,2.7777777777777777777777777777778e-7),attribute_1, attribute_2, attribute_3 from my_shape" my_scaled_shape.shp my_shape.shp

You must include all the normal attributes of your shapefile into list of selected fields in your SQL statement. Use ogrinfo -al -so my_shape.shp for reading the attribute list.

  • dayum.. this looks confusing but ti will try. since i get the hint that i am going to do with "Scale", i will go for with ArcMap function though. – Pil Kwon Sep 25 '17 at 8:22
  • The syntax may look confusing but the idea is clear: multiply each coordinate by 1/3600000, save result into new shapefile. It is possible to update on place as well but to create a copy is more safe. I guess you could also use the QGIS Field calculator for scaling the coordinates. – user30184 Sep 25 '17 at 8:33
  • i am new to QGIS stuff but i will try for tonight to figure this out. thanks for help and i will keep you updated! – Pil Kwon Sep 25 '17 at 8:36
  • It returned"FAILURE: no target datasource provided Converting outputs Loading resulting layers" this error message. Trying to fix this :( – Pil Kwon Sep 25 '17 at 9:01
  • Paste you whole command, there must be some glitch in the syntax. – user30184 Sep 25 '17 at 9:05
2

If you prefer to use GUI the Affine transform tool of OpenJUMP is pretty simple to use. What you want to do is actually a simple affine transformation with only two parameters: x-scale and y-scale. With OpenJUMP you need to fill in these parameters and press OK.

enter image description here

  • OMG, this is so freaking easy to work with. Thanks for the comment. Now i think i should work with the GDAL command above. Cuz, i need a specific PRJ file for this! thanks for help, srly. I've been digging this for 12 hrs :) – Pil Kwon Sep 25 '17 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.