2

I have several polygon and line layers in shapefile format with no crs so it can't be reprojected. The vertices coordinates need to be divided by 3,600,000 in order for them to match the project crs, EPSG:4326.

Is there a way to do this in field calculator or with a plugin?

Can it be converted to another file format and edited?

Here's an example of the current values.

example

2
  • Even you have a shapefile however it does not mean that it placed correctly, am I right? One more interesting thing, how did you achieve that shapefile? Can you perhaps adjust coordinates before they rise in QGIS?
    – Taras
    Apr 24 '20 at 6:02
  • @Taras The file was provided as is from a company. I can't adjust the coordinates of the shapefile since I did not create it.
    – brink
    Apr 24 '20 at 17:11
4

Sure, you can multiply/divide all vertices from a vector layer. That's what Affine Transformations are good for.

Go to Processing Toolbox and execute the Affine transform algorithm, select your layer (you can run in as batch if you want) and set parameters Scale factor (x-axis) and Scale factor (y-axis) as 1/3600000 (yes, you can use the rational number in there :) ).

After doing this, you should assign the correct CRS (Assign projection algorithm) to your layer.


If you want to know more about affine transformations, have a look at this post: QGIS moving the layer/all features using Vector Affine Transformation and

0
0

I propose a workaround, not sure if there is an easier solution - it also depends on your data, you didn't state what crs your original data is in and why you can't simply reproject your shapefiles.

Go to menu vector - geometry tools - extract vertices. You get a points-layer with your vertices. Use the field calculator and define the value of two new fields (named x_coord and y_coord) like this: $x/3600000 respetively $y/3600000. You get new fields with the correct values. Export the layer as CSV (delimited text layer), than re-import the csv-file (menu layer - add layer - add delimited text-layer) and define the two fields generated above (x_coord and y_coord) as x-/y-coordinates. However, the points have to be converted to polygons again: use points to path (from the toolbox) and than from menu vector - geometry tools - lines to polygons.

5
  • The data doesn't come with a crs so it can't be reprojected. I think this solution would give me a similar layer but the attributes will be lost. I need to maintain the attributes. I'll add the missing crs part to the original question.
    – brink
    Apr 23 '20 at 22:43
  • You can make a join after you tried the solution proposed above to re-add your attributes
    – Babel
    Apr 24 '20 at 8:29
  • By the way: can you try to find out which was the original crs? Where is your data from? Where do you know from that you have to divide your coordiantes by 3600000 to get 4326-coordinates? So the values of your original coordinates as well as the region you are working in should give a hint to the original crs
    – Babel
    Apr 24 '20 at 8:32
  • I can't tell you where I got the data as it's proprietary and the data doesn't have a known crs. It's most likely an internal crs that they only use. The data provider gave the information about dividing the coordinates as a means to use the data within a known crs.
    – brink
    Apr 24 '20 at 17:06
  • Maybe your case is similar to one of these: stackoverflow.com/a/14452758 or gis.stackexchange.com/q/256476/88814
    – Babel
    Apr 24 '20 at 20:32

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.