<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Short of Little saying otherwise, I'm pretty sure GeoMoose 3 is
      using GeoJSON as it's internal representation of features, so my
      guess is GeoJSON is the simplest point format.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 12/13/2018 11:41 AM, Reynolds,
      Michael J. (MNIT) wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:DM2PR09MB0256E687DEACC3FDB47A9607B8A00@DM2PR09MB0256.namprd09.prod.outlook.com">
      <meta http-equiv="Context-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <div class="WordSection1">
        <p class="MsoNormal"><span>This seemed to work…  though I'm
            wondering why I couldn't get it to work until I passed
            in_point to geojson_point.  Is there a simpler point format
            allowed?</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>/** projects incoming point
            coordinates and projection to target</span></p>
        <p class="MsoNormal"><span>* projection and passes to zoomTo
            function.</span></p>
        <p class="MsoNormal"><span>* @param in_point - point coordinate
            array [x, y]</span></p>
        <p class="MsoNormal"><span>* @param projection - string
            'EPSG:####'</span></p>
        <p class="MsoNormal"><span>* @param zoom - integer zoom level
          </span></p>
        <p class="MsoNormal"><span> * @returns zooms to coordinate
            location and zoom level</span></p>
        <p class="MsoNormal"><span>*
          </span></p>
        <p class="MsoNormal"><span> * Search Template usage example</span></p>
        <p class="MsoNormal"><span>* <a onClick="projectZoomTo([{{
            geometry.coordinates.0 }},{{ geometry.coordinates.1 }}],
            'EPSG:3857',16)" class="zoomto-link"></span></p>
        <p class="MsoNormal"><span>*            <i class="fa
            fa-search"></i>
          </span></p>
        <p class="MsoNormal"><span> *            {{
            properties.equipmentname|blank> }}</span></p>
        <p class="MsoNormal"><span>* </a></span></p>
        <p class="MsoNormal"><span>*/</span></p>
        <p class="MsoNormal"><span>function projectZoomTo(in_point,
            projection, zoom) {</span></p>
        <p class="MsoNormal"><span>                  geojson_point = [{</span></p>
        <p class="MsoNormal"><span>                                               
              "type": "Feature",</span></p>
        <p class="MsoNormal"><span>                                               
              "geometry": {</span></p>
        <p class="MsoNormal"><span>                                               
                "type": "Point",</span></p>
        <p class="MsoNormal"><span>                                               
                "coordinates": in_point
          </span></p>
        <p class="MsoNormal"><span>                                               
              }</span></p>
        <p class="MsoNormal"><span>                  }]</span></p>
        <p class="MsoNormal"><span>                  var new_point =
            gm3.util.projectFeatures(geojson_point, projection,
            'EPSG:4326')[0];</span></p>
        <p class="MsoNormal"><span>                  return
app.zoomTo(new_point.geometry.coordinates[0],new_point.geometry.coordinates[1],
            zoom);</span></p>
        <p class="MsoNormal"><span>};</span></p>
        <p class="MsoNormal"><span> </span></p>
        <div>
          <div>
            <p class="MsoNormal"><b><span>From:</span></b><span> Jim
                Klassen [<a class="moz-txt-link-freetext" href="mailto:klassen.js@gmail.com">mailto:klassen.js@gmail.com</a>]
                <br>
                <b>Sent:</b> Wednesday, November 28, 2018 11:55 AM<br>
                <b>To:</b> Reynolds, Michael J. (MNIT)
                <a class="moz-txt-link-rfc2396E" href="mailto:mike.reynolds@state.mn.us"><mike.reynolds@state.mn.us></a><br>
                <b>Cc:</b> GeoMOOSE Users List
                <a class="moz-txt-link-rfc2396E" href="mailto:geomoose-users@lists.osgeo.org"><geomoose-users@lists.osgeo.org></a><br>
                <b>Subject:</b> Re: [Geomoose-users] Geomoose 3 onclick
                action</span></p>
          </div>
        </div>
        <p class="MsoNormal"> </p>
        <p class="MsoNormal">It looks like app.zoomToExtent() takes an
          extent and projection and app.zoomTo() takes a point (in
          lat/lon), and zoom level, but no projection.  This seems like
          it might be a bit on an oversight, but in the meantime
          gm3.util.projectFeatures() is available from services.  Paring
          that with app.zoomTo(point, zoom_level) looks like it would
          work.<br>
          <br>
          You could do this in the template directly or add a helper
          function in your app.js.<br>
          <br>
          Say something like (untested):<br>
          <br>
          function myZoomTo(in_point, projection, zoom) {<br>
            var point = gm3.util.projectFeatures([point], projection,
          'EPSG:4326')[0];<br>
            return app.zoomTo(point, zoom);<br>
          }<br>
          <br>
          <br>
          then call it from the template as:<br>
          <br>
          myZoomTo({geometry.coordinates: [x, y]}, 'EPSG:26915', 16);<br>
          <br>
          I'm not sure that using the global space for myZoomTo is best
          practice, but just an idea to get started.<br>
          <br>
          I am also remembering something now about the search templates
          being able to reproject points, but it looks like that is
          using properties.boundedBy and app.zoomToExtent, so that might
          not apply.<br>
          <br>
          <br>
        </p>
        <div>
          <p class="MsoNormal">On 11/28/2018 11:18 AM, Reynolds, Michael
            J. (MNIT) wrote:</p>
        </div>
        <blockquote>
          <p class="MsoNormal"><span>The onClick would be in a search
              template used for rendering search results.  Once rendered
              and displayed to the user, the user could click the
              <a> and the onClick would execute the function to
              zoom to the location.</span></p>
          <p class="MsoNormal"><span> </span></p>
          <p class="MsoNormal"><span><div class="search-result"></span></p>
          <p class="MsoNormal"><span>                <div
              class="search-label"></span></p>
          <p class="MsoNormal"><span>                                {{
              properties.name }}     </div></span></p>
          <p class="MsoNormal"><span>                <div
              class="search-action"></span></p>
          <p class="MsoNormal"><span>                               
              <div style="padding: 2px"></span></p>
          <p class="MsoNormal"><span>                                               
              <a onclick='app.zoomToCoordinates([{{
              geometry.coordinates.0 }},{{ geometry.coordinates.1 }}],
              26915, 16)' class="zoomto-link"></span></p>
          <p class="MsoNormal"><span>                                                               
              <i class="fa fa-search"></i>
            </span></p>
          <p class="MsoNormal"><span>                                                               
              Zoom!</span></p>
          <p class="MsoNormal"><span>                                               
              </a></span></p>
          <p class="MsoNormal"><span>                               
              </div></span></p>
          <p class="MsoNormal"><span>                </div></span></p>
          <p class="MsoNormal"><span></div></span></p>
          <p class="MsoNormal"><a name="_MailEndCompose"
              moz-do-not-send="true"><span> </span></a></p>
          <p class="MsoNormal"><b><span>From:</span></b><span> James
              Klassen [<a href="mailto:klassen.js@gmail.com"
                moz-do-not-send="true">mailto:klassen.js@gmail.com</a>]
              <br>
              <b>Sent:</b> Wednesday, November 28, 2018 10:44 AM<br>
              <b>To:</b> Reynolds, Michael J. (MNIT) <a
                href="mailto:mike.reynolds@state.mn.us"
                moz-do-not-send="true">
                <mike.reynolds@state.mn.us></a><br>
              <b>Cc:</b> GeoMOOSE Users List <a
                href="mailto:geomoose-users@lists.osgeo.org"
                moz-do-not-send="true"><geomoose-users@lists.osgeo.org></a><br>
              <b>Subject:</b> Re: [Geomoose-users] Geomoose 3 onclick
              action</span></p>
          <p class="MsoNormal"> </p>
          <div>
            <p class="MsoNormal">I'm lost.  Where is the onClick coming
              from (DOM element, general description, ...)?</p>
            <div>
              <p class="MsoNormal"> </p>
            </div>
            <div>
              <p class="MsoNormal">I know you can create a service that
                asks the user to click a point on the map and returns
                the coordinate, etc.  You can call the app.* from the
                HTML returned by the service rendering template (and
                maybe even earlier) without worrying about
                react/dispatch/etc.</p>
            </div>
            <div>
              <p class="MsoNormal"> </p>
            </div>
            <div>
              <p class="MsoNormal">I am working on a jump to USNG
                coordinate service in a branch on my fork
                (klassenjs/gm3) that does both of the above.</p>
            </div>
          </div>
          <p class="MsoNormal"> </p>
          <div>
            <p class="MsoNormal">On Tue, Nov 27, 2018, 06:39 Reynolds,
              Michael J. (MNIT) <<a
                href="mailto:mike.reynolds@state.mn.us"
                moz-do-not-send="true">mike.reynolds@state.mn.us</a>
              wrote:</p>
          </div>
          <div>
            <div>
              <p class="MsoNormal">We're trying to create an onClick()
                event that passes coordinates, srid, and zoom level in
                and moves the map to that location.</p>
              <p class="MsoNormal"> </p>
              <p class="MsoNormal">It seems like the onClick event would
                need to create an action loaded with the parameters,
                register and then dispatch or run it, so would that be
                a  function we create in our app's app.js?  </p>
              <p class="MsoNormal"> </p>
              <p class="MsoNormal">Plus we would then need to create the
                zoom action which we would like to transform the
                coordinates from in-srid to web Mercator and then move
                the map.  Are Proj and mapActions available to actions
                at runtime?  </p>
              <p class="MsoNormal"> </p>
              <p class="MsoNormal">onClick => app.zoomToCoordinates()
                => dispatch ZoomToCoordinates action to transform
                coordinates and move map.</p>
              <p class="MsoNormal"> </p>
              <p class="MsoNormal">There's a gm3 zoomTo() function now
                but it expects lat,lon.  We're not currently modifying
                any of the core geomoose 3 code and hoping to be able to
                add this modification to our app's part of the code.</p>
              <p class="MsoNormal"> </p>
              <p class="MsoNormal">Open to any ideas, even scrapping
                this procedure with a shorter one if there's a way to
                control the map without dispatching an action but that
                would mean the js function somehow needs access to the
                app Proj library and map object. Right?</p>
              <p class="MsoNormal"> </p>
              <p class="MsoNormal"><b><span>Michael Reynolds</span></b></p>
              <p class="MsoNormal"> </p>
            </div>
          </div>
          <p class="MsoNormal">_______________________________________________<br>
            Geomoose-users mailing list<br>
            <a href="mailto:Geomoose-users@lists.osgeo.org"
              target="_blank" moz-do-not-send="true">Geomoose-users@lists.osgeo.org</a><br>
            <a
              href="https://lists.osgeo.org/mailman/listinfo/geomoose-users"
              target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/geomoose-users</a></p>
        </blockquote>
        <p class="MsoNormal"> </p>
      </div>
    </blockquote>
    <br>
  </body>
</html>