I was using the cmv eslint settings, so everything got reformatted. If you don't want to accept this due to the formatting changes, its completely understandable, but you should at least be able to see the changes in this commit:
add a graphics layer for coordinates that are found
When the user searches, a map icon is displayed using the maps graphics layer
separate coordtypes into a different file
Cleans up the widget a bit as all the coordinate system transformation code lives in CoordTypes.js
ability to set default values for the textbox and add custom coordinate systems
Prepopulate the textbox with a shortened version of a coordinate, for example mgrs, we can provide the grid zone for a local area.
A sample config file for providing cusotm projections might look like this:
goto.js:
define([
'proj4js/proj4',
'dojo/topic'
], function (proj4, topic) {
var mnrice = 'PROJCS["Rice County MN",GEOGCS["Rice County Datum",DATUM["<custom>",SPHEROID["<custom>",6378434.181,298.2572256054303]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",100000.0],PARAMETER["Central_Meridian",-93.13333333333334],PARAMETER["Standard_Parallel_1",44.3],PARAMETER["Standard_Parallel_2",44.66666666666666],PARAMETER["Latitude_Of_Origin",44.1947221],UNIT["Foot_US",0.3048006096012192]]';
var wgs84 = proj4.defs('WGS84');
return {
map: true,
coordTypes: [{
id: 'ricemn',
label: 'Rice County Coordinates',
examples: ['463993.5101,135233.3642'],
helpText: 'The input accepts two coordinates (easting, northing) separated by a comma.',
toLatLong: function (input) {
var coords = input.replace(/[A-Za-z$-]/g, '').split(',');
if (!coords.length === 2) {
topic.publish('growler/growl', {
title: 'Format not valid',
message: 'Please enter the coordinates like the example: easting,northing OR 12344.1234,12344.1234'
});
}
return proj4(mnrice, wgs84, coords);
}
}]
};
});
Formatting
I was using the cmv eslint settings, so everything got reformatted. If you don't want to accept this due to the formatting changes, its completely understandable, but you should at least be able to see the changes in this commit:
https://github.com/BrianBunker/cmv-widgets/pull/44/commits/8690d6741154920f95d7dda59c3feabd9a6386b9
add a graphics layer for coordinates that are found
When the user searches, a map icon is displayed using the maps graphics layer
separate coordtypes into a different file
Cleans up the widget a bit as all the coordinate system transformation code lives in CoordTypes.js
ability to set default values for the textbox and add custom coordinate systems
Prepopulate the textbox with a shortened version of a coordinate, for example mgrs, we can provide the grid zone for a local area.
A sample config file for providing cusotm projections might look like this:
goto.js:
and viewer.js:
Proj4 location
Proj4 path now points to
proj4js/proj4
to use the configured proj4 from the dojo config file.