ncssar / sartopo_python

Python calls for the caltopo / sartopo API
GNU General Public License v3.0
14 stars 2 forks source link

allow specification of map title and mode when creating new map #74

Open caver456 opened 1 week ago

caver456 commented 1 week ago

Right now, the new map title is hardcoded to 'new':

    if self.mapID=='[NEW]':
        j={}
        j['properties']={
            'mapConfig':json.dumps({'activeLayers':[['mbt',1]]}),
            'cfgLocked':True,
            'title':'new',
            'mode':'sar' # 'cal' for recreation, 'sar' for SAR
        }

Change this to allow mapID to be a longer strong, and whatever text follows [NEW] can be used as the value of the 'title' key. Also update the docstring.

caver456 commented 1 week ago

Probably best to allow mode specification too. Default should be recreation, in case a non-SAR user is trying to make a map. Maybe the format of the openMap argument could be '[NEW]'[[:]] with mode and title being optional, like:</p> <p>[NEW] - just make a new map, recreation mode, title='new' [NEW]myMap - make a new map, recreation mode, title='myMap' [NEW]SAR:mySARMap - make a new map, SAR mode, title='mySARMap'</p> <p>While shoving all these arguments into the mapID argument as a string seems odd, it does get rid of the need to change upstream calls to openMap or <strong>init</strong>.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>