|
POST
|
Here's a Gist showing how to convert from Degrees/Minutes/Seconds to decimal degrees. Below is the same code (in case GitHub is down). /*jslint browser: true, nomen: true */
/*jshint dojo, jquery, nomen:false */
/*global jQuery */
(function ($) {
"use strict";
// Matches DMS coordinates
// http://regexpal.com/?flags=gim®ex=^(-%3F\d%2B(%3F%3A\.\d%2B)%3F)[°%3Ad]%3F\s%3F(%3F%3A(\d%2B(%3F%3A\.\d%2B)%3F)['�?�%3A]%3F\s%3F(%3F%3A(\d%2B(%3F%3A\.\d%2B)%3F)["�?�]%3F)%3F)%3F\s%3F([NSEW])%3F&input=40%3A26%3A46N%2C79%3A56%3A55W 40%3A26%3A46.302N 79%3A56%3A55.903W 40°26�?�47�?�N 79°58�?�36�?�W 40d 26�?� 47�?� N 79d 58�?� 36�?� W 40.446195N 79.948862W 40.446195%2C -79.948862 40° 26.7717%2C -79° 56.93172
var dmsRe = /^(-?\d+(?:\.\d+)?)[°:d]?\s?(?:(\d+(?:\.\d+)?)['�?�:]?\s?(?:(\d+(?:\.\d+)?)["�?�]?)?)?\s?([NSEW])?/i;
// Results of match will be [full coords string, Degrees, minutes (if any), seconds (if any), hemisphere (if any)]
// E.g., ["40:26:46.302N", "40", "26", "46.302", "N"]
// E.g., ["40.446195N", "40.446195", undefined, undefined, "N"]
/** Parses a Degrees Minutes Seconds string into a Decimal Degrees number.
* @param {string} dmsStr A string containing a coordinate in either DMS or DD format.
* @return {Number} If dmsStr is a valid coordinate string, the value in decimal degrees will be returned. Otherwise NaN will be returned.
*/
function parseDms(dmsStr) {
var output = NaN, dmsMatch, degrees, minutes, seconds, hemisphere;
dmsMatch = dmsRe.exec(dmsStr);
if (dmsMatch) {
degrees = Number(dmsMatch[1]);
minutes = typeof (dmsMatch[2]) !== "undefined" ? Number(dmsMatch[2]) / 60 : 0;
seconds = typeof (dmsMatch[3]) !== "undefined" ? Number(dmsMatch[3]) / 3600 : 0;
hemisphere = dmsMatch[4] || null;
if (hemisphere !== null && /[SW]/i.test(hemisphere)) {
degrees = Math.abs(degrees) * -1;
}
if (degrees < 0) {
output = degrees - minutes - seconds;
} else {
output = degrees + minutes + seconds;
}
}
return output;
}
// Add coordinate validation method to jQuery validator.
if (typeof ($.validator) !== "undefined") {
$.validator.addMethod("coordinate", function (value, element) {
return this.optional(element) || dmsRe.test(value);
}, "Please enter a Decimal Degree or DMS value.");
}
$.parseDms = parseDms;
}(jQuery));
... View more
05-30-2014
09:33 AM
|
1
|
0
|
2858
|
|
POST
|
I think I've found a bug with the BasemapGallery, as demonstrated by this JSFiddle. The BasemapGallery executes the following
... View more
05-15-2014
12:30 PM
|
0
|
1
|
669
|
|
POST
|
Unfortunately I don't have an answer for your question. In the meantime you can use a Meta Tag to force IE 11 to use act as an older version of IE.
... View more
05-15-2014
09:18 AM
|
1
|
0
|
1346
|
|
POST
|
For the token issue, it looks like your address search endpoint requires a token. The easiest fix would be to change the security on that service so that it no longer requires a token. Otherwise you'll need to either use the IdentityManager object in your JavaScript code to have the user log in, or, if you don't want users to have to log in, handle the login on the server-side using a proxy.
... View more
03-20-2014
08:25 AM
|
0
|
0
|
1169
|
|
POST
|
Have you tried using Esri's Terraformer libraries to do the conversion?
... View more
03-19-2014
03:29 PM
|
0
|
0
|
2650
|
|
POST
|
I think it is possible to have a proxy page at the site level (instead of the application level).
... View more
02-26-2014
02:38 PM
|
0
|
0
|
440
|
|
POST
|
Here's an article reviewing various JavaScript IDEs.
... View more
02-10-2014
08:40 AM
|
0
|
0
|
923
|
|
POST
|
When you post code on the forums be sure you use the tags to preserve your indentation, making the code easier for others to read.
require(["dojo/dom",
"dojo/dom-attr",
"dojo/_base/array",
"dojo/_base/Color",
"dojo/parser",
"esri/config",
"esri/map",
"esri/graphic",
"esri/tasks/GeometryService",
"esri/tasks/BufferParameters",
"esri/toolbars/draw",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleFillSymbol",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane"],
function (dom, domAttr, array, Color, parser, esriConfig, Map,
Graphic, GeometryService, BufferParameters, Draw, SimpleMarkerSymbol,
SimpleLineSymbol, SimpleFillSymbol)
{
var map, geo, tb;
parser.parse();
map = new Map("map", {
basemap: "streets",
center: [-122.4, 37.785],
zoom: 13
});
esriConfig.defaults.io.proxyUrl = "/proxy";
esriConfig.defaults.io.alwaysUseProxy = false;
geo = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
map.on("load", initToolbar);
/*
** Initialize the drawing toolbar
*/
function initToolbar(evtObj) {
app.tb = new Draw(evtObj.map);
app.tb.on("draw-end", drawPoint);
}
// Array where points are saved
var list = [];
/*
** Draw point
*/
function drawPoint(evtObj) {
// Get the click geometry
var geometry = evtObj.geometry;
// Point symbol
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_SQUARE,
10,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0]),
1),
new Color([0, 255, 0, 0.25]));
// Add point to the map
var graphic = new Graphic(geometry, symbol);
app.map.graphics.add(graphic);
// Store the point geometry
list.push(geometry);
}
/*
** Create buffer around points
*/
function doBuffer() {
// Stop drawing points
app.tb.deactivate();
// Show the zoom slider
app.map.showZoomSlider();
// Setup the buffer parameters
var params = new BufferParameters();
params.distances = [dom.byId("distance").value];
params.bufferSpatialReference = new esri.SpatialReference({
wkid: dom.byId("bufferSpatialReference").value
});
params.outSpatialReference = map.spatialReference;
params.unit = GeometryService[dom.byId("unit").value];
params.geometries = list;
// Launch buffer calculation
app.geo.buffer(params, showBuffer);
}
/*
** Draw buffer on the map
*/
function showBuffer(geoms) {
// Symbol of the buffer
var symbol = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0, 0.65]), 2),
new Color([255, 0, 0, 0.35]));
// Add the buffer graphics to the map
array.forEach(geoms, function (geometry) {
var graphic = new Graphic(geometry, symbol);
app.map.graphics.add(graphic);
});
}
app = {
map: map,
tb: tb,
geo: geo,
buffer: doBuffer
};
});
/*
** Click on Foggy Zone button
*/
function foggyZoneClick() {
app.buffer();
}
/*
** Click on Point button
*/
function pointClick() {
app.tb.activate(esri.toolbars.Draw.POINT);
app.map.hideZoomSlider();
}
... View more
01-15-2014
06:43 AM
|
0
|
0
|
1717
|
|
POST
|
You might want to try the dojox/layout/ExpandoPane.
... View more
01-13-2014
06:45 AM
|
0
|
0
|
1179
|
|
POST
|
I more or less use jacobsj's approach (I have a tomcat/java server). I did investigate ways of doing this using the File API, but I gave up because IE8 doesn't support it if I recall correctly. I'm not sure if it is possible or not though. You are correct, IE8 doesn't support File API. I think you would also need FileWriter, which most browsers don't support.
... View more
01-09-2014
06:58 AM
|
0
|
0
|
763
|
|
POST
|
Instead of trying to use a GeoProcessing service, I would write a server-side component in your web site. The handler would take the user selected data as input, serialize the JSON to classes, and then write the CSV equivalent. What kind of server are you running? If you are running ASP.NET I would recommend using the following libraries for this. ServiceStack: This is for easily creating a REST endpoint. There is also a library for JSON serialization. CsvHelper This library is for converting your classes into CSV. [Edit: I think ServiceStack on its own suports CSV output, so you probably don't need CSVHelper after all.]
... View more
01-08-2014
03:23 PM
|
0
|
0
|
763
|
|
POST
|
@rlwatson, Thanks for the info. I don't want to use the ArcGIS Runtime SDK for WPF due to the complications with licensing and authorization. I'll be using your suggested approach: For .NET, I do think that you want to have a set of strongly typed classes which expose async methods that check the result and throw exceptions when it is something other than success. Background: I am currently updating a legacy ASP.NET Web Forms application that currently uses the ArcGIS SOAP SDK to call Esri's free routing service. Esri is dropping support for this service at the end of this year, so I need to update the application to use their new routing service. As far as I can tell there is no SOAP endpoint for this service, so I need to use REST instead. (The new service also requires a OAuth login, where the old one did not.)
... View more
12-27-2013
08:55 AM
|
0
|
0
|
737
|
|
POST
|
I have been working on a .NET client library for the ArcGIS REST API, adding features as I need them. Before I put too much work into this I just wanted to make sure something like this doesn't already exist elsewhere. Is anyone aware of a .NET client library for the ArcGIS REST API (other than my incomplete one that I linked above)?
... View more
12-26-2013
09:21 AM
|
0
|
2
|
2599
|
|
POST
|
I have personally used QUnit. It looks like Esri is using Karma in some of their GitHub projects.
... View more
11-06-2013
01:20 PM
|
0
|
0
|
1939
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-08-2025 08:56 AM | |
| 2 | 03-05-2024 05:10 PM | |
| 1 | 04-30-2013 08:23 AM | |
| 1 | 05-03-2022 09:45 AM | |
| 1 | 06-30-2015 10:55 AM |