Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a polygon with a 40m diameter and several points that lay inside it. Now I want to reformat the point locations (projected in DHDN/GK-3, but could vary) to x-y coordinates ranging from zero to the maximal diameter of the polygon (in this case 40m).

I am working in R and therefore I need a scripted solution (this is just a testing subset and many more follow, therefore "click"-solutions in Qgis/arcgis won't suffice.)

Pictures say more than words: The triangle is the polygons centroid. The green dots the point locations.

enter image description here

I appreciate any coding assistance :-)

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

If I understand your question right: it is a simple algebra calculation. You have two cartesian coordinate systems.

For the x-coordinate of the blue point: 20 + 2500117 - 2500100 = 37

enter image description here

EDIT: This solution works only if the coordinate system is a "projected coordinate system" (e.G. Gauss-Krueger, UTM, ...). It is not a solution for "geographical coordinate systems" (e.g. WGS84).

share|improve this answer
    
no comment. Thanks for this easy solution ;-) However it results in some negative values, which is why i took the diameter instead of the radius. I should read some of those old highschool math books... –  Curlew Dec 12 '12 at 16:20
add comment

There is Proj4 library interface for R in CRAN http://cran.r-project.org/package=proj4 and http://www.rforge.net/proj4/ After that only thing what you need is source and destination SRID

share|improve this answer
    
I don't want to transform between projections, but instead from one projection to a cartesian coordinate system. –  Curlew Dec 12 '12 at 12:43
    
A projection can be either geographic or projected. In the first case, your coordinates are in the φ,λ (spherical) plane and in the later in x,y (Cartesian) plane. –  nickves Dec 12 '12 at 12:51
    
proj4 can solve your problem. You need create a custom proj4 string, with the appropriate parameters. trac.osgeo.org/proj/wiki/GenParms . –  nickves Dec 12 '12 at 12:55
    
Ahh. i understood question wrong and assumed that we were talking about point on globe. But still you can solve problem with proj4 using link 'nickves' provided –  simplexio Dec 12 '12 at 13:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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