Re: [NTLK] Help with GPS MAP process (VERY,VERY LONG POST)

From: Edward Johnson (radar9999_at_aol.com)
Date: Tue Apr 05 2005 - 08:38:54 PDT


Hello all,

First I want to thank Victor Rehorst and Johannes Wolff for their help
so far. Victor for this BBS and his wide-ranging knowledge and
outstanding support of UNNA. Johannes for his insight in getting me as
far as I have gotten so far with creating maps for my 2100. I think I
am 95-98% of the way there toward my 1st successful map. Having gone as
far as I think I can, I will try use the "Open Source" option to get me
the rest of the way there. The process is rather involved with many
steps where I might have made my mistake. I will try to be as detailed
as I can. For those interested I have screen shots (picture=1000 words,
eh?) as part of emails that Johannes and I have exchanged regarding
parts of the problem I am experiencing. That does not mean I am
elsewise problem free, just that this problem is stopping me from
discovering any others.
  I will start with a modified copy of the email I sent Johannes
explaining what I have done so far;

Snip>>
Johannes,
    Thanks for the response. Just to let you know my process I will give
you the big steps I have done, and then you can point out where I've
gone wrong and how to fix it. I am trying to create a basic topo map of
my home neighborhood of Ojai (pronounced Oh-Hi) California.
1 I went on to www.maptech.com and saved as jpeg a free topo map
depiction (scale = 1:24000) of my neighborhood.
2 Being very cheap I downloaded GIMP from http://www.gimp.org/ and used
web resources (http://gimp-savvy.com/BOOK/) to learn how to use it.
Took me about a week to get how to do it.
3 Imported image into Gimp, then I;
    A Saved it as .XCF. (Proprietary extension that allows GIMP to
remember changes made to document when saved)
    B Reduced the color palette to 16 colors (4-bit?) Rt-click on
picture>Image>Mode>Indexed>General Optimal Palette>16 Colors
    C Save AS (MODIFY FILENAME TO INDICATE 16 COLORS) OJAI_2_16CLR.XCF
    D Convert to Grayscale Rt-Click on picture>Image>Mode>Grayscale
    E Save As (MODIFY FILENAME TO INDICATE GRAYSCALE) OJAI_2_GS.XCF
    F Scale Image to 72 Dpi Rt-Click on picture>Image>Image Scale> ensure
that resolution is set to 72 dpi on X & Y axes
    G Save-as Ojai_2_gs.xcf
    H Flatten out document. (Consolidates
    H Convert to bitmap for export. File>Save-as>click on extension bar
and choose .BMP as extension. Ojai_2_gs.bmp
4 Closed out GIMP.
<<SNIP
Important note: Graphic Convertor will do all of the above. Delete Step
#2 & #3 and replace with the following.

2 I found Graphic Convertor ver 4.6.1 already on my MAC
(http://www.lemkesoft.com/en/index.htm) as part of the bundled
software.

3 Opened Jpeg image with Graphic Convertor 4.6. then I;

A Reduced the color depth to 16 colors Pictures>Colors>Change to 16
Colors (4 bit)
B Converted to Grayscale Pictures>Colors>Grayscale
C Set the resolution to 72 dpi Pictures>Resolution> Enter "72" dpi in
both the Horiz & Vert boxes: then "OK"
D If you have not already extracted the calibration point pixel
coordinates this is the time to do so. This information is necessary so
that correction factors can be applied to the map by GPS MAP. Here is
another modified version of an email I exchanged with Johannes;

snip>>
Now Correction Factors I can Help With. The idea, of course, is to
logically relate LAT/LONG points with pixel locations so that GPS MAP
will know how to identify and display individual points.
The map I saved from the web lets you preview the latitude and
longitude of points. Since my maps don't have LAT LONG grids I have to
use the 'RECT 2 application for three individual points in my
calculations. I located 3 readily identifiable points on the map as
recommended in the PDF document on map preparation and noted the
LAT/LONG readings (they are displayed by the website). After Importing
into GIMP (now Graphic Convertor) I was able to locate these points and
note the Pixel Locations for each of these points (I found out that GC
will also let you identify pixel locations). Ensure that you copy them
down 1-2-3 as you did the LAT/LONG readings. Then plug these numbers
into the 'RECT 2 application to get your correction factors for each
point. The factors take into account any slight leaning, twisting, or
stretching of the maps as they are scanned. As I downloaded mine from
the web they have already been properly scanned and trued with respect
to north-south orientation, making my job much easier. The factors are
the group of numbers that show up at the bottom of the RECT
application. These should have been automatically copied to your
desktop or clipboard so you can paste them into the afterScript.
snip<<
  Note that you must read the Map Preparation Document PDF that comes
with GPS MAP to understand this business about the the 3 calibration
points and the difference between 'RECT 1 & 'RECT 2.

        To get Graphic Convertor to show the pixel coordinates it is
Picture>Show Coordinates. A box will appear near the top of the map
window with the X/Y coordinates of the cursor. Move the cursor to the
three calibration points that you selected and copy down the
corresponding pixel coordinates. Keep this information handy for later.
4 Save map as a PICT resource. (I think this is where part of my
problem is occurring) FILE>SAVE AS> Click the File Extension tab and
select Resource (*.RSRC). Leave the three boxes underneath Unchecked.
>Click the Preference tab and click the DEFAULT Tab (This may be a
Problem Point) >Then click the OPTIONS tab>Select Standard Compression
(RLE); Ensure that RSED (ResEdit) is in the Document Creator Field.
Click the Resource box and click the Original Index Radio Button. Name
the resource (I typed in Ojai1 with no space, dot or extension. This
may be another Problem Point ). Choose Dither in the Misc Block. Click
OK to close the Options Dialog box. Then Save the File. My File name
was Ojai 1. rsrc (Ojai space 1dot rsrc).
5 Close Graphic Convertor.
6 Create the conversion factors for your map. Having read the PDF file
on Map making you already know the difference between the 3 types of
map calibration generators 'CONE, 'RECT 1 & 'RECT 2. See the email in
step 3 for illustration. Following the directions in the MAP
Preparation PDF plug in the Lat Long coordinates and the corresponding
pixel coordinates for each calibration point. The result will be
pasted to your desktop or copied to your clipboard. Hang on to this
until
7 Go into GPS MAP folder and Duplicate Map Template 1.5. Rename
duplicated folder.
8 Drop copy of PICT resource document into the new folder.
9 Launch Newton Toolkit ver 1.6.4
    a NTK will not load unless it sees a serial port. Ensure that Newton
is connected to serial port via Newton Connection Utilities before
trying to load NTK or it won't work.
    b There is something called TCPSerial that fakes a serial port. Should
be on UNNA.
    c If you have a USB only computer you probably need to get a USB to
Serial Convertor.
    d Ethernet- Don't know if NTK will see serial port & newton if
connected via ethernet (wired or wireless) to NCU.
10 Within the Renamed Folder open MAP (no extension) document. OS-X may
see this as a Text-edit document so use the Open With... feature to
locate NTK.
11 In the Window that comes up select Map_Main.t by double-clicking on
it. In the Browser window that comes up select clView:Map_Main, and
select afterScript.
12 In the big window that comes up is the template for calling out
maps. Tried to follow directions as in PDF document MapPrep.PDF. Also
found source on Web (http://www.phys.uwosh.edu/mike/newt-maps.html)
that covered some details. Actually very detailed with respect to
creating the PICT resource files, but from Photoshop not GC. (here is a
copy of the script I input)
//////////////////////////////////////////////////////////////////////
// Map Template for Map Preparation Package version 1.5 //
// //
// Copyright ©1995-97 //
// Gerd Staudenmaier, Software Development & Marketing //
// Friedrichshafener Str. 24 b //
// D-88090 Immenstaad, Germany //
// e-mail: gerds_at_micronet.de //
// all rights reserved ! //
// //
// IMPORTANT !!! //
// You may freely use this map template for use with "GPS Map" and //
// "GPS Map Lite" only. All other applications need the written //
// permission of the author! //
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////
// Read in the map by using one of the methods as described within //
// the map preparation manual //
//////////////////////////////////////////////////////////////////////
rf := OpenResFileX (Home & "Ojai 1.rsrc");
BMAP_1 := MakePixFamily (NIL,NIL,"Ojai1");
CloseResFileX(rf);
//////////////////////////////////////////////////////////////////////
// Repeat previous statements for all further maps to be included //
// into your map package if applicable //
//////////////////////////////////////////////////////////////////////
//BMAP_2 := .......;

thisView.MapList := [
                      /////////////////////////////////////////////////
                      // This frame describes the map loaded into //
                      // BMAP_1. If you have more maps repeat the //
                      // frame for each map //
                      /////////////////////////////////////////////////
                      {
                       // map name as displayed in map list
                       Name : "Ojai 1",
                       // comment as displayed in "theTextView"
                       Comment : "Topo Map of Home in Ojai",
                       // pointer to map data
                       theBits : BMAP_1,
                       // map scale (1:24000)
                       Scale : 24000,
                       // scanner resolution in dots per inch (72)
                       Resolution : 72,
                       // calculate ScaleFactor as "ROUND (Scale /
Resolution)"
                       ScaleFactor : 333,
                       // coordinate style of map, must be 'RECT or
'CONE, don't forget leading apostrophe!
                       Type : 'rect,
                       // map structure version (always 1 for this
template version)
                       Version : 1,
                       // remove slot "Public" if map should not be
recognized by GPS Map demo version!
                       Public : TRUE,
                       ////////////////////////////////////////////////
                       // replace the question marks below by the //
                       // coefficients output from one of the //
                       // calibration applications //
                       ////////////////////////////////////////////////
                       C_X : [ NaN,
NaN, NaN],
                       C_Y : [ 9.6866552029E+05,
-2.9290909091E+04, -3.3603896104E+02],
                       C_Long : [ NaN,
NaN, NaN],
                       C_Lat : [ NaN,
NaN, NaN],
                       A : NaN,
                       // geographic limits for map ('CONE type only)
                       Lat_top : NIL,
                       Lat_bottom : NIL,
                       Long_left : NIL,
                       Long_right : NIL,
                       // geographic default position for loading map
                       Def_Lat : 34.4292,
                       Def_Long : -119.2782
                      },

                      /////////////////////////////////////////////////
                      // Repeat the previous frame for further maps //
                      // if applicable //
                      /////////////////////////////////////////////////
                     ];

// end of afterScript

16 At this point I attempt to build the application and I get this
error message in the Inspector window,

Error in Map_Main.t, Map_Main.afterScript, line 22:
   Couldn't open resource file (-43): "Macintosh
HD:Users:edwardjohnson:Documents:Newton Stuff:GPS Downloads:GPS MAP 2.1
Unrestricted:Maps Prep Software:MPS-Mac:Ojai 1:Ojai 1.rsrc"
n.afterScript, Line 1: Unknown global function "MakePixFamily"

I am stumped at this point. I think this error is related to way I
saved the resource in step 4. I am not experienced in Newton
development and do not know what it is looking for in terms of creating
or calling the proper resource in the script. That is why this post is
so bloody long! Point me to the error of my ways so that I can get on
with my life! I have been messing around with this for a couple of
months and my wife is p*****-off!

Okay, enough! Into the mailbox with you!

Semper Fi!

Ed Johnson

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
Official Newton FAQ: http://www.chuma.org/newton/faq/
WikiWikiNewt for all kinds of articles: http://tools.unna.org/wikiwikinewt/


This archive was generated by hypermail 2.1.5 : Tue Apr 12 2005 - 07:30:01 PDT