Gee David and your solution is so much simpler than actually having the program
work the way its supposed to! :-)
Chris




[EMAIL PROTECTED] on 07/02/99 03:53:33 AM
To:   [EMAIL PROTECTED]
cc:   Chris Skelly/MOH@MOH
Subject:  Re: MI My centroids problem solved!





Sorry for the delay in posting this response.  I was not monitoring the list for
a while and am still catching up.

I'm puzzled by the assertion by Chris Skelly that "[New Zealanders] still have
to deal with the continuing problem that we cannot save to a NZ Map Grid
Coordinate System! It is necessary to paste the appropriate coordinate system
code into the file (which needs to be converted into a MIF file first - what a
pain!).  The line of code is CoordSys Earth Projection 18, 31, "m", 173, -41,
2510000, 6023150 Bounds (1000000, 3000000) (3000000, 8000000)"

There are considerably less painful ways to achieve the same end.  There is a
line in the MapInfo projection file (MAPINFOW.PRJ) for the New Zealand Map Grid,
altough it's specified without Bounds.  Here it is:

"New Zealand Map Grid\p27200", 18, 31, 7, 173, -41, 2510000, 6023150

You can easily add a line (or modify the existing one) to add Bounds
information.  The general syntax for specifying Bounds for a coordinate system
in the .PRJ file is:

"projectionname", projectionnumber + 2000, projectionparameters,
boundsparameters

where boundsparameters is a comma-separated list of bounds values expressed in
the units of the coordinate system; viz. minx, miny, maxx, maxy.

So, Chris could modify the .PRJ file by adding a new line in the New Zealand
section of the file as follows:

"...",2018,31,7,173,-41,2510000,6023150,1000000,3000000,3000000,8000000

The pick list, that pops up when the Projection button is pressed in various
MapInfo dialogs, will now contain the new system with whatever name you use for
"..." above.

Alternatively, it's possible to use a bounded coordinate system
programmatically.  For example, say you want to save a table, "nz", that's open
in MapInfo to a copy, "nz1", with its coordinates in the above coordinate
system.  Either of the following MapBasic syntax forms will do the trick:

    Commit Table nz
           As "d:\temp\nz1.tab"
           CoordSys Earth
               Projection 18, 31, 7,
                          173, -41,
                          2510000, 6023150
               Bounds (1000000,3000000) (3000000,8000000)
OR

    Commit Table nz
           As "d:\temp\nz1.tab"
           CoordSys Earth
               Projection 2018, 31, 7,
                          173, -41,
                          2510000, 6023150,
                          1000000, 3000000, 3000000, 8000000

I hope this helps.

David Horne
MapInfo Engineering
[EMAIL PROTECTED]


Original message:


From: Chris Skelly@MOH on 08/06/99 22:21


To:   [EMAIL PROTECTED]
cc:
Subject:  My centroids problem solved!


Thanks to all for their suggestions regarding a problem in MapInfo which makes
it difficult to extract the centroids of polygons in anything but Lat-Long, even
when you are using a cartesian coordinate system. Chris Perry and Jacques Paris
provided a solution that works, which I'll relay here for anyone who is
interested.

If you run an SQL query using the functions CentroidX(obj) and CentroidY(obj) to
create coordinates from which to create a new points data set, you may find (as
I did) that MapInfo will refuse to give you anything other than Lat-Long
coordinates. However, if you issue the command "Set coordsys table
<yourtablename>" in the MapBasic window before the SQL query, MapInfo will
return the coordinates in the appropriate coordinate system.

A couple of other respondents replied that I could use the Lat-Long coordinates,
save them to a file with a new projection. This works, except for those of us in
New Zealand who still have to deal with the continuing problem that we cannot
save to a NZ Map Grid Coordinate System! It is necessary to paste the
appropriate coordinate system code into the file (which needs to be converted
into a MIF file first - what a pain!).  The line of code is

CoordSys Earth Projection 18, 31, "m", 173, -41, 2510000, 6023150 Bounds
(1000000, 3000000) (3000000, 8000000)

So thanks guys - my time to a solution from sending in the email - 22 minutes!

Cheers,
Chris



           Chris Skelly, PhD, Senior Advisor (Environmental Health),

     Public Health Group, Safety and Regulation Branch, Ministry of Health

          133 Molesworth Street, PO Box 5013, Wellington, New Zealand

 Ph: +64 4 496-2215, Fx: +64 4 496-2340, Email: [EMAIL PROTECTED], WWW:
                                 http://www.moh.govt.nz


----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]




----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to