1 : /******************************************************************************
2 : * $Id: ogr_opt.cpp 19782 2010-05-31 13:03:17Z dron $
3 : *
4 : * Project: OpenGIS Simple Features
5 : * Purpose: Functions for getting list of projection types, and their parms.
6 : * Author: Frank Warmerdam, warmerdam@pobox.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2000, Frank Warmerdam
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #include "ogr_srs_api.h"
31 : #include "cpl_string.h"
32 :
33 : CPL_CVSID("$Id: ogr_opt.cpp 19782 2010-05-31 13:03:17Z dron $");
34 :
35 : static const char *papszParameterDefinitions[] = {
36 : SRS_PP_CENTRAL_MERIDIAN, "Central Meridian", "Long", "0.0",
37 : SRS_PP_SCALE_FACTOR, "Scale Factor", "Ratio", "1.0",
38 : SRS_PP_STANDARD_PARALLEL_1, "Standard Parallel 1", "Lat", "0.0",
39 : SRS_PP_STANDARD_PARALLEL_2, "Standard Parallel 2", "Lat", "0.0",
40 : SRS_PP_LONGITUDE_OF_CENTER, "Longitude of Center", "Long", "0.0",
41 : SRS_PP_LATITUDE_OF_CENTER, "Latitude of Center", "Lat", "0.0",
42 : SRS_PP_LONGITUDE_OF_ORIGIN, "Longitude of Origin", "Long", "0.0",
43 : SRS_PP_LATITUDE_OF_ORIGIN, "Latitude of Origin", "Lat", "0.0",
44 : SRS_PP_FALSE_EASTING, "False Easting", "m", "0.0",
45 : SRS_PP_FALSE_NORTHING, "False Northing", "m", "0.0",
46 : SRS_PP_AZIMUTH, "Azimuth", "Angle", "0.0",
47 : SRS_PP_LONGITUDE_OF_POINT_1,"Longitude of Point 1", "Long", "0.0",
48 : SRS_PP_LATITUDE_OF_POINT_1, "Latitude of Point 1", "Lat", "0.0",
49 : SRS_PP_LONGITUDE_OF_POINT_2,"Longitude of Point 2", "Long", "0.0",
50 : SRS_PP_LATITUDE_OF_POINT_2, "Latitude of Point 2", "Lat", "0.0",
51 : SRS_PP_LONGITUDE_OF_POINT_3,"Longitude of Point 3", "Long", "0.0",
52 : SRS_PP_LATITUDE_OF_POINT_3, "Latitude of Point 3", "Lat", "0.0",
53 : SRS_PP_RECTIFIED_GRID_ANGLE,"Rectified Grid Angle", "Angle", "0.0",
54 : SRS_PP_SATELLITE_HEIGHT, "Satellite Height", "m", "35785831.0",
55 : NULL
56 : };
57 :
58 : static const char *papszProjectionDefinitions[] = {
59 :
60 : "*",
61 : SRS_PT_TRANSVERSE_MERCATOR,
62 : "Transverse Mercator",
63 : SRS_PP_LATITUDE_OF_ORIGIN,
64 : SRS_PP_CENTRAL_MERIDIAN,
65 : SRS_PP_SCALE_FACTOR,
66 : SRS_PP_FALSE_EASTING,
67 : SRS_PP_FALSE_NORTHING,
68 :
69 : "*",
70 : SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED,
71 : "Transverse Mercator (South Oriented)",
72 : SRS_PP_LATITUDE_OF_ORIGIN,
73 : SRS_PP_CENTRAL_MERIDIAN,
74 : SRS_PP_SCALE_FACTOR,
75 : SRS_PP_FALSE_EASTING,
76 : SRS_PP_FALSE_NORTHING,
77 :
78 : "*",
79 : SRS_PT_TUNISIA_MINING_GRID,
80 : "Tunisia Mining Grid",
81 : SRS_PP_LATITUDE_OF_ORIGIN,
82 : SRS_PP_CENTRAL_MERIDIAN,
83 : SRS_PP_FALSE_EASTING,
84 : SRS_PP_FALSE_NORTHING,
85 :
86 : "*",
87 : SRS_PT_ALBERS_CONIC_EQUAL_AREA,
88 : "Albers Conic Equal Area",
89 : SRS_PP_STANDARD_PARALLEL_1,
90 : SRS_PP_STANDARD_PARALLEL_2,
91 : SRS_PP_LATITUDE_OF_CENTER,
92 : SRS_PP_LONGITUDE_OF_CENTER,
93 : SRS_PP_FALSE_EASTING,
94 : SRS_PP_FALSE_NORTHING,
95 :
96 : "*",
97 : SRS_PT_AZIMUTHAL_EQUIDISTANT,
98 : "Azimuthal Equidistant",
99 : SRS_PP_LATITUDE_OF_CENTER,
100 : SRS_PP_LONGITUDE_OF_CENTER,
101 : SRS_PP_FALSE_EASTING,
102 : SRS_PP_FALSE_NORTHING,
103 :
104 : "*",
105 : SRS_PT_CYLINDRICAL_EQUAL_AREA,
106 : "Cylindrical Equal Area",
107 : SRS_PP_STANDARD_PARALLEL_1,
108 : SRS_PP_CENTRAL_MERIDIAN,
109 : SRS_PP_FALSE_EASTING,
110 : SRS_PP_FALSE_NORTHING,
111 :
112 : "*",
113 : SRS_PT_CASSINI_SOLDNER,
114 : "Cassini/Soldner",
115 : SRS_PP_LATITUDE_OF_ORIGIN,
116 : SRS_PP_CENTRAL_MERIDIAN,
117 : SRS_PP_FALSE_EASTING,
118 : SRS_PP_FALSE_NORTHING,
119 :
120 : "*",
121 : SRS_PT_EQUIDISTANT_CONIC,
122 : "Equidistant Conic",
123 : SRS_PP_STANDARD_PARALLEL_1,
124 : SRS_PP_STANDARD_PARALLEL_2,
125 : SRS_PP_LATITUDE_OF_CENTER,
126 : SRS_PP_LONGITUDE_OF_CENTER,
127 : SRS_PP_FALSE_EASTING,
128 : SRS_PP_FALSE_NORTHING,
129 :
130 : "*",
131 : SRS_PT_BONNE,
132 : "Bonne",
133 : SRS_PP_STANDARD_PARALLEL_1,
134 : SRS_PP_CENTRAL_MERIDIAN,
135 : SRS_PP_FALSE_EASTING,
136 : SRS_PP_FALSE_NORTHING,
137 :
138 : "*",
139 : SRS_PT_ECKERT_I,
140 : "Eckert I",
141 : SRS_PP_CENTRAL_MERIDIAN,
142 : SRS_PP_FALSE_EASTING,
143 : SRS_PP_FALSE_NORTHING,
144 :
145 : "*",
146 : SRS_PT_ECKERT_II,
147 : "Eckert II",
148 : SRS_PP_CENTRAL_MERIDIAN,
149 : SRS_PP_FALSE_EASTING,
150 : SRS_PP_FALSE_NORTHING,
151 :
152 : "*",
153 : SRS_PT_ECKERT_III,
154 : "Eckert III",
155 : SRS_PP_CENTRAL_MERIDIAN,
156 : SRS_PP_FALSE_EASTING,
157 : SRS_PP_FALSE_NORTHING,
158 :
159 : "*",
160 : SRS_PT_ECKERT_IV,
161 : "Eckert IV",
162 : SRS_PP_CENTRAL_MERIDIAN,
163 : SRS_PP_FALSE_EASTING,
164 : SRS_PP_FALSE_NORTHING,
165 :
166 : "*",
167 : SRS_PT_ECKERT_V,
168 : "Eckert V",
169 : SRS_PP_CENTRAL_MERIDIAN,
170 : SRS_PP_FALSE_EASTING,
171 : SRS_PP_FALSE_NORTHING,
172 :
173 : "*",
174 : SRS_PT_ECKERT_VI,
175 : "Eckert VI",
176 : SRS_PP_CENTRAL_MERIDIAN,
177 : SRS_PP_FALSE_EASTING,
178 : SRS_PP_FALSE_NORTHING,
179 :
180 : "*",
181 : SRS_PT_EQUIRECTANGULAR,
182 : "Equirectangular",
183 : SRS_PP_LATITUDE_OF_ORIGIN,
184 : SRS_PP_CENTRAL_MERIDIAN,
185 : SRS_PP_STANDARD_PARALLEL_1,
186 : SRS_PP_FALSE_EASTING,
187 : SRS_PP_FALSE_NORTHING,
188 :
189 : "*",
190 : SRS_PT_GAUSSSCHREIBERTMERCATOR,
191 : "Gauss-Schreiber Transverse Mercator",
192 : SRS_PP_LATITUDE_OF_ORIGIN,
193 : SRS_PP_CENTRAL_MERIDIAN,
194 : SRS_PP_SCALE_FACTOR,
195 : SRS_PP_FALSE_EASTING,
196 : SRS_PP_FALSE_NORTHING,
197 :
198 : "*",
199 : SRS_PT_GALL_STEREOGRAPHIC,
200 : "Gall Stereographic",
201 : SRS_PP_CENTRAL_MERIDIAN,
202 : SRS_PP_FALSE_EASTING,
203 : SRS_PP_FALSE_NORTHING,
204 :
205 : "*",
206 : SRS_PT_GOODE_HOMOLOSINE,
207 : "Goode Homolosine",
208 : SRS_PP_CENTRAL_MERIDIAN,
209 : SRS_PP_FALSE_EASTING,
210 : SRS_PP_FALSE_NORTHING,
211 :
212 : "*",
213 : SRS_PT_GEOSTATIONARY_SATELLITE,
214 : "Geostationary Satellite",
215 : SRS_PP_CENTRAL_MERIDIAN,
216 : SRS_PP_SATELLITE_HEIGHT,
217 : SRS_PP_FALSE_EASTING,
218 : SRS_PP_FALSE_NORTHING,
219 :
220 : "*",
221 : SRS_PT_GNOMONIC,
222 : "Gnomonic",
223 : SRS_PP_LATITUDE_OF_ORIGIN,
224 : SRS_PP_CENTRAL_MERIDIAN,
225 : SRS_PP_FALSE_EASTING,
226 : SRS_PP_FALSE_NORTHING,
227 :
228 : "*",
229 : SRS_PT_HOTINE_OBLIQUE_MERCATOR,
230 : "Hotine Oblique Mercator",
231 : SRS_PP_LATITUDE_OF_CENTER,
232 : SRS_PP_LONGITUDE_OF_CENTER,
233 : SRS_PP_AZIMUTH,
234 : SRS_PP_RECTIFIED_GRID_ANGLE,
235 : SRS_PP_SCALE_FACTOR,
236 : SRS_PP_FALSE_EASTING,
237 : SRS_PP_FALSE_NORTHING,
238 :
239 : "*",
240 : SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN,
241 : "Hotine Oblique Mercator Two Point Natural Origin",
242 : SRS_PP_LATITUDE_OF_CENTER,
243 : SRS_PP_LATITUDE_OF_POINT_1,
244 : SRS_PP_LONGITUDE_OF_POINT_1,
245 : SRS_PP_LATITUDE_OF_POINT_2,
246 : SRS_PP_LONGITUDE_OF_POINT_2,
247 : SRS_PP_SCALE_FACTOR,
248 : SRS_PP_FALSE_EASTING,
249 : SRS_PP_FALSE_NORTHING,
250 :
251 : "*",
252 : SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA,
253 : "Lambert Azimuthal Equal Area",
254 : SRS_PP_LATITUDE_OF_CENTER,
255 : SRS_PP_LONGITUDE_OF_CENTER,
256 : SRS_PP_FALSE_EASTING,
257 : SRS_PP_FALSE_NORTHING,
258 :
259 : "*",
260 : SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP,
261 : "Lambert Conformal Conic (2SP)",
262 : SRS_PP_STANDARD_PARALLEL_1,
263 : SRS_PP_STANDARD_PARALLEL_2,
264 : SRS_PP_LATITUDE_OF_ORIGIN,
265 : SRS_PP_CENTRAL_MERIDIAN,
266 : SRS_PP_FALSE_EASTING,
267 : SRS_PP_FALSE_NORTHING,
268 :
269 : "*",
270 : SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP,
271 : "Lambert Conformal Conic (1SP)",
272 : SRS_PP_LATITUDE_OF_ORIGIN,
273 : SRS_PP_CENTRAL_MERIDIAN,
274 : SRS_PP_SCALE_FACTOR,
275 : SRS_PP_FALSE_EASTING,
276 : SRS_PP_FALSE_NORTHING,
277 :
278 : "*",
279 : SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM,
280 : "Lambert Conformal Conic (2SP - Belgium)",
281 : SRS_PP_STANDARD_PARALLEL_1,
282 : SRS_PP_STANDARD_PARALLEL_2,
283 : SRS_PP_LATITUDE_OF_ORIGIN,
284 : SRS_PP_CENTRAL_MERIDIAN,
285 : SRS_PP_FALSE_EASTING,
286 : SRS_PP_FALSE_NORTHING,
287 :
288 : "*",
289 : SRS_PT_MILLER_CYLINDRICAL,
290 : "Miller Cylindrical",
291 : SRS_PP_LATITUDE_OF_CENTER,
292 : SRS_PP_LONGITUDE_OF_CENTER,
293 : SRS_PP_FALSE_EASTING,
294 : SRS_PP_FALSE_NORTHING,
295 :
296 : "*",
297 : SRS_PT_MERCATOR_1SP,
298 : "Mercator (1SP)",
299 : SRS_PP_LATITUDE_OF_ORIGIN,
300 : SRS_PP_CENTRAL_MERIDIAN,
301 : SRS_PP_SCALE_FACTOR,
302 : SRS_PP_FALSE_EASTING,
303 : SRS_PP_FALSE_NORTHING,
304 :
305 : "*",
306 : SRS_PT_MERCATOR_2SP,
307 : "Mercator (2SP)",
308 : SRS_PP_STANDARD_PARALLEL_1,
309 : SRS_PP_LATITUDE_OF_ORIGIN,
310 : SRS_PP_CENTRAL_MERIDIAN,
311 : SRS_PP_FALSE_EASTING,
312 : SRS_PP_FALSE_NORTHING,
313 :
314 : "*",
315 : SRS_PT_MOLLWEIDE,
316 : "Mollweide",
317 : SRS_PP_CENTRAL_MERIDIAN,
318 : SRS_PP_FALSE_EASTING,
319 : SRS_PP_FALSE_NORTHING,
320 :
321 : "*",
322 : SRS_PT_NEW_ZEALAND_MAP_GRID,
323 : "New Zealand Map Grid",
324 : SRS_PP_LATITUDE_OF_ORIGIN,
325 : SRS_PP_CENTRAL_MERIDIAN,
326 : SRS_PP_FALSE_EASTING,
327 : SRS_PP_FALSE_NORTHING,
328 :
329 : "*",
330 : SRS_PT_OBLIQUE_STEREOGRAPHIC,
331 : "Oblique Stereographic",
332 : SRS_PP_LATITUDE_OF_ORIGIN,
333 : SRS_PP_CENTRAL_MERIDIAN,
334 : SRS_PP_SCALE_FACTOR,
335 : SRS_PP_FALSE_EASTING,
336 : SRS_PP_FALSE_NORTHING,
337 :
338 : "*",
339 : SRS_PT_ORTHOGRAPHIC,
340 : "Orthographic",
341 : SRS_PP_LATITUDE_OF_ORIGIN,
342 : SRS_PP_CENTRAL_MERIDIAN,
343 : SRS_PP_FALSE_EASTING,
344 : SRS_PP_FALSE_NORTHING,
345 :
346 : "*",
347 : SRS_PT_POLYCONIC,
348 : "Polyconic",
349 : SRS_PP_LATITUDE_OF_ORIGIN,
350 : SRS_PP_CENTRAL_MERIDIAN,
351 : SRS_PP_FALSE_EASTING,
352 : SRS_PP_FALSE_NORTHING,
353 :
354 : "*",
355 : SRS_PT_POLAR_STEREOGRAPHIC,
356 : "Polar Stereographic",
357 : SRS_PP_LATITUDE_OF_ORIGIN,
358 : SRS_PP_CENTRAL_MERIDIAN,
359 : SRS_PP_SCALE_FACTOR,
360 : SRS_PP_FALSE_EASTING,
361 : SRS_PP_FALSE_NORTHING,
362 :
363 : "*",
364 : SRS_PT_ROBINSON,
365 : "Robinson",
366 : SRS_PP_LONGITUDE_OF_CENTER,
367 : SRS_PP_FALSE_EASTING,
368 : SRS_PP_FALSE_NORTHING,
369 :
370 : "*",
371 : SRS_PT_SINUSOIDAL,
372 : "Sinusoidal",
373 : SRS_PP_LONGITUDE_OF_CENTER,
374 : SRS_PP_FALSE_EASTING,
375 : SRS_PP_FALSE_NORTHING,
376 :
377 : "*"
378 : SRS_PT_STEREOGRAPHIC,
379 : "Stereographic",
380 : SRS_PP_LATITUDE_OF_ORIGIN,
381 : SRS_PP_CENTRAL_MERIDIAN,
382 : SRS_PP_SCALE_FACTOR,
383 : SRS_PP_FALSE_EASTING,
384 : SRS_PP_FALSE_NORTHING,
385 :
386 : "*"
387 : SRS_PT_TWO_POINT_EQUIDISTANT,
388 : "Two Point Equidistant",
389 : SRS_PP_LATITUDE_OF_1ST_POINT,
390 : SRS_PP_LONGITUDE_OF_1ST_POINT,
391 : SRS_PP_LATITUDE_OF_2ND_POINT,
392 : SRS_PP_LONGITUDE_OF_2ND_POINT,
393 : SRS_PP_FALSE_EASTING,
394 : SRS_PP_FALSE_NORTHING,
395 :
396 : "*",
397 : SRS_PT_VANDERGRINTEN,
398 : "Van Der Grinten",
399 : SRS_PP_CENTRAL_MERIDIAN,
400 : SRS_PP_FALSE_EASTING,
401 : SRS_PP_FALSE_NORTHING,
402 :
403 : "*"
404 : SRS_PT_KROVAK,
405 : "Krovak",
406 : SRS_PP_LATITUDE_OF_CENTER,
407 : SRS_PP_LONGITUDE_OF_CENTER,
408 : SRS_PP_AZIMUTH,
409 : SRS_PP_PSEUDO_STD_PARALLEL_1,
410 : SRS_PP_SCALE_FACTOR,
411 : SRS_PP_FALSE_EASTING,
412 : SRS_PP_FALSE_NORTHING,
413 :
414 : "*",
415 : SRS_PT_IMW_POLYCONIC,
416 : "International Map of the World Polyconic",
417 : SRS_PP_LATITUDE_OF_1ST_POINT,
418 : SRS_PP_LATITUDE_OF_2ND_POINT,
419 : SRS_PP_CENTRAL_MERIDIAN,
420 : SRS_PP_FALSE_EASTING,
421 : SRS_PP_FALSE_NORTHING,
422 :
423 : "*",
424 : SRS_PT_WAGNER_I,
425 : "Wagner I (Kavraisky VI)",
426 : SRS_PP_FALSE_EASTING,
427 : SRS_PP_FALSE_NORTHING,
428 :
429 : "*",
430 : SRS_PT_WAGNER_II,
431 : "Wagner II",
432 : SRS_PP_FALSE_EASTING,
433 : SRS_PP_FALSE_NORTHING,
434 :
435 : "*",
436 : SRS_PT_WAGNER_III,
437 : "Wagner III",
438 : SRS_PP_LATITUDE_OF_ORIGIN,
439 : SRS_PP_FALSE_EASTING,
440 : SRS_PP_FALSE_NORTHING,
441 :
442 : "*",
443 : SRS_PT_WAGNER_IV,
444 : "Wagner IV",
445 : SRS_PP_FALSE_EASTING,
446 : SRS_PP_FALSE_NORTHING,
447 :
448 : "*",
449 : SRS_PT_WAGNER_V,
450 : "Wagner V",
451 : SRS_PP_FALSE_EASTING,
452 : SRS_PP_FALSE_NORTHING,
453 :
454 : "*",
455 : SRS_PT_WAGNER_VI,
456 : "Wagner VI",
457 : SRS_PP_FALSE_EASTING,
458 : SRS_PP_FALSE_NORTHING,
459 :
460 : "*",
461 : SRS_PT_WAGNER_VII,
462 : "Wagner VII",
463 : SRS_PP_FALSE_EASTING,
464 : SRS_PP_FALSE_NORTHING,
465 :
466 : NULL
467 : };
468 :
469 :
470 :
471 :
472 : /************************************************************************/
473 : /* OPTGetProjectionMethods() */
474 : /************************************************************************/
475 :
476 : /**
477 : * Fetch list of possible projection methods.
478 : *
479 : * @return Returns NULL terminated list of projection methods. This should
480 : * be freed with CSLDestroy() when no longer needed.
481 : */
482 :
483 1 : char **OPTGetProjectionMethods()
484 :
485 : {
486 : int i;
487 1 : char **papszList = NULL;
488 :
489 353 : for( i = 1; papszProjectionDefinitions[i] != NULL; i++ )
490 : {
491 352 : if( EQUAL(papszProjectionDefinitions[i-1],"*") )
492 47 : papszList = CSLAddString(papszList,papszProjectionDefinitions[i]);
493 : }
494 :
495 1 : return papszList;
496 : }
497 :
498 : /************************************************************************/
499 : /* OPTGetParameterList() */
500 : /************************************************************************/
501 :
502 : /**
503 : * Fetch the parameters for a given projection method.
504 : *
505 : * @param pszProjectionMethod internal name of projection methods to fetch
506 : * the parameters for, such as "Transverse_Mercator"
507 : * (SRS_PT_TRANSVERSE_MERCATOR).
508 : *
509 : * @param ppszUserName pointer in which to return a user visible name for
510 : * the projection name. The returned string should not be modified or
511 : * freed by the caller. Legal to pass in NULL if user name not required.
512 : *
513 : * @return returns a NULL terminated list of internal parameter names that
514 : * should be freed by the caller when no longer needed. Returns NULL if
515 : * projection method is unknown.
516 : */
517 :
518 : char **OPTGetParameterList( const char *pszProjectionMethod,
519 47 : char ** ppszUserName )
520 :
521 : {
522 47 : char **papszList = NULL;
523 : int i;
524 :
525 8135 : for( i = 1; papszProjectionDefinitions[i] != NULL; i++ )
526 : {
527 8135 : if( papszProjectionDefinitions[i-1][0] == '*'
528 : && EQUAL(papszProjectionDefinitions[i],pszProjectionMethod) )
529 : {
530 47 : i++;
531 :
532 47 : if( ppszUserName != NULL )
533 47 : *ppszUserName = (char *)papszProjectionDefinitions[i];
534 :
535 47 : i++;
536 282 : while( papszProjectionDefinitions[i] != NULL
537 : && papszProjectionDefinitions[i][0] != '*' )
538 : {
539 : papszList = CSLAddString( papszList,
540 188 : papszProjectionDefinitions[i] );
541 188 : i++;
542 : }
543 47 : return papszList;
544 : }
545 : }
546 :
547 0 : return NULL;
548 : }
549 :
550 : /************************************************************************/
551 : /* OPTGetParameterInfo() */
552 : /************************************************************************/
553 :
554 : /**
555 : * Fetch information about a single parameter of a projection method.
556 : *
557 : * @param pszProjectionMethod name of projection method for which the parameter
558 : * applies. Not currently used, but in the future this could affect defaults.
559 : * This is the internal projection method name, such as "Tranverse_Mercator".
560 : *
561 : * @param pszParameterName name of the parameter to fetch information about.
562 : * This is the internal name such as "central_meridian"
563 : * (SRS_PP_CENTRAL_MERIDIAN).
564 : *
565 : * @param ppszUserName location at which to return the user visible name for
566 : * the parameter. This pointer may be NULL to skip the user name. The
567 : * returned name should not be modified or freed.
568 : *
569 : * @param ppszType location at which to return the parameter type for
570 : * the parameter. This pointer may be NULL to skip. The returned type
571 : * should not be modified or freed. The type values are described above.
572 : *
573 : * @param pdfDefaultValue location at which to put the default value for
574 : * this parameter. The pointer may be NULL.
575 : *
576 : * @return TRUE if parameter found, or FALSE otherwise.
577 : */
578 :
579 : int OPTGetParameterInfo( const char * pszProjectionMethod,
580 : const char * pszParameterName,
581 : char ** ppszUserName,
582 : char ** ppszType,
583 188 : double *pdfDefaultValue )
584 :
585 : {
586 : int i;
587 :
588 : (void) pszProjectionMethod;
589 :
590 1350 : for( i = 0; papszParameterDefinitions[i] != NULL; i += 4 )
591 : {
592 1348 : if( EQUAL(papszParameterDefinitions[i],pszParameterName) )
593 : {
594 186 : if( ppszUserName != NULL )
595 186 : *ppszUserName = (char *)papszParameterDefinitions[i+1];
596 186 : if( ppszType != NULL )
597 186 : *ppszType = (char *)papszParameterDefinitions[i+2];
598 186 : if( pdfDefaultValue != NULL )
599 186 : *pdfDefaultValue = atof(papszParameterDefinitions[i+3]);
600 :
601 186 : return TRUE;
602 : }
603 : }
604 :
605 2 : return FALSE;
606 : }
607 :
|