1

I have a large shapefile of lines, and want to run a mmqgis function (Plugins --> mmqgis --> Modify --> Convert Geometry Type.)

The problem is the file is very large and crashes the program. What options do I have?

Would running it as background python script work (and if so how do I find the commands for mmqgis function?)?

There are 460'000 features and i'm running a 3.40GHz i7 with 12GB of RAM. Is there a way of this not breaking down?

  • Can you give us your system specs, and how many features are in your .shp? – HDunn Jun 6 '13 at 8:46
  • There are 460'000 features and i'm running a 3.40GHz i7 with 12GB of RAM. – DGraham Jun 6 '13 at 9:42
  • Woops missed the mention @HDunn – DGraham Jun 6 '13 at 10:29
4

You might try importing the shp into postgis with shp2pgsql and running the query for ST_Centroid in the database. See the docs here.

  • PostGIS is excellent tool for "big" data needs for normal users (i know 460k lines isn't big data) – simplexio Jun 6 '13 at 17:33
  • Sptailite might be a better option. – Nathan W Jun 6 '13 at 21:06
1

To calculate the coordinates of each line segment's midpoint, create two new fields using the functions:

(x_max( $geometry ) + x_min( $geometry ))/2

and

(y_max( $geometry ) + y_min( $geometry ))/2
0

With FME Desktop, you can use this transformer: CenterOfGravityReplacer. It's very easy to use this.

Replaces the geometry of the feature with a point at the center of mass of the feature. Note that, depending on the feature’s shape, the resulting point may be far outside of the original feature.

Example The transformer calculates the exact distribution of portions of a shape; therefore, some points can actually appear outside a feature.

  • 1
    FME is nice tools, but commercial and costs about 2k€ + annual support fee – simplexio Jun 6 '13 at 17:30
  • 1
    I don't know why this question received a downvote. FME is a completely valid answer to this question. The OP doesn't specify free software as a requirement. It may be valid for other users in the future. I would upvote it, but I've reached my daily vote limit. – Fezter Jun 7 '13 at 1:15
  • Upvote. Yes i hate it now and then , but it solves a lot more problems than it causes. It's excellent tool to file conversion and it can also manipulate data. Only minus comes from fact that it is commercial with annoying license handling. For last two years i have "wasted" several days when waiting license keys to arrive. Also it probably saves license stuff in to primary hd boot sector because i wasted 2 days after i had move my all data to bigger ssd hd. Windows and all other programs didn't even need re-activation. – simplexio Jun 7 '13 at 7:15
0

If you don't want to set up a database like zimmi suggested I would use GDAL/OGR with the Centroid function.

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.