|
POST
|
Doug, I have experienced this problem too. Mostly at mobile home parks in a public safety vehicle routing context. Rooftop points are great for showing a location, but have problems when you are routing them. Using driveway addresses will solve this problem. Then you are routing them to a location nearest the street network which will give you much better routing results. If you don't have driveway addresses you can look at creating linear barriers that can be used to solve your route. A line barrier creates a fence that won't allow the route to get to the point through the fence. It must go around to solve the route properly. Regards, Tom
... View more
07-27-2015
11:11 AM
|
1
|
0
|
808
|
|
POST
|
I would also add that the new "Vector" tiles are going to be really great and going to be a real game changer for basemaps. According to one session I attended on the topic, vector tiles use protocol buffers (a Google binary format) to store the tiles. This changes terabytes of imagery into about 13 gigabytes of vector data. They can be restyled on the fly, so you can switch basemaps without downloading additional data. When you rotate the map, the labels stay oriented so you can read them, which is not possible with a cached image basemap. The labels and vectors are crisply displayed at any scale or resolution too. Regards, Tom
... View more
07-27-2015
09:59 AM
|
1
|
1
|
2167
|
|
DOC
|
Kevin, Yes! That will work just fine. I have not gotten back to the printing problem, but your widget will work nicely. It would be nice to have a ultimate draw/measure widget that does it all too. Regards, Tom
... View more
07-17-2015
02:12 PM
|
0
|
0
|
15985
|
|
POST
|
Carisa, I have experimented a bit with this using my own vehicle data. When using a map service that is time enabled the ager works properly. When using a map service that is not time enabled and trying to manually establish time parameters, I am having the same result you are seeing. I will try tweaking things a bit more and see if I can come up with what is missing. Regards, Tom
... View more
07-17-2015
10:56 AM
|
0
|
1
|
1689
|
|
POST
|
Carisa, It looks like your time extent is the same for both start and ending times. You might try being more specific about the time range using dates and times. Regards, Tom
... View more
07-16-2015
12:02 PM
|
0
|
3
|
1689
|
|
POST
|
Robert, No worries at all Robert! I always like looking at other peoples code (especially yours). To see different ways of solving a problem. Best Regards, Tom
... View more
07-16-2015
09:07 AM
|
0
|
0
|
4103
|
|
POST
|
Robert, You beat me by a couple of minutes! Regards, Tom
... View more
07-16-2015
08:53 AM
|
0
|
2
|
4103
|
|
POST
|
Manjari, I added some additional logic to your app to use the keyed coordinates too. You can still click on the map and it will fill in the coordinates that were found or you can enter the coordinates and an address will be found if in the tolerance set. As Ken states, your references in the require were not properly aligned. I removed the extra references. <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Reverse Geocode</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css">
<style>
html,
body,
#mapDiv {
padding: 0;
margin: 0;
height: 100%;
}
#leftPanel {
width: 20%;
border-top: solid 1px #343642;
border-left: solid 1px #343642;
border-bottom: solid 1px #343642;
border-right: solid 1px #343642;
margin: 0px 0px 5px 5px;
color: #343642;
font: 100% Georgia, "Times New Roman", Times, serif;
}
#convertButton {
font-size: 12pt;
}
</style>
<script src="http://js.arcgis.com/3.11/"></script>
<script>
var map;
require(["esri/map",
"esri/geometry/Point",
"esri/SpatialReference",
"esri/tasks/locator",
"esri/geometry/webMercatorUtils",
"esri/dijit/Geocoder",
"esri/graphic",
"esri/InfoTemplate",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/Color",
"dojo/dom",
"dojo/parser",
"dojo/on",
"dojo/domReady!",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/form/Button",
"dijit/form/TextBox"
],
function(
Map,
Point,
SpatialReference,
Locator,
webMercatorUtils,
Geocoder,
Graphic,
InfoTemplate,
SimpleMarkerSymbol,
SimpleLineSymbol,
Color,
dom,
parser,
on
) {
parser.parse();
map = new Map("mapDiv", {
basemap: "gray",
center: [-95.249, 38.954],
zoom: 3,
sliderStyle: "large"
});
var geocoder = new Geocoder({
arcgisGeocoder: {
placeholder: "Enter an Address",
sourceCountry: "USA"
},
autoComplete: true,
map: map
}, dom.byId("search"));
geocoder.on("select", showLocation);
//script for locating the address with Longitude and Latitude.
function init() {
convertButton.on("click", function(i) {
var x = parseFloat(inLon.value);
var y = parseFloat(inLat.value);
var pt = new Point(x, y, new SpatialReference({ wkid: 4326 }));
locator.locationToAddress(pt, 100);
});
}
var locator = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
var infoTemplate = new InfoTemplate("Location", "Address: ${Address}");
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE,
15,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([0, 0, 255, 0.5]),
8
),
new Color([0, 0, 255])
);
locator.on("location-to-address-complete", function(evt) {
if (evt.address.address) {
var address = evt.address.address;
var location = webMercatorUtils.geographicToWebMercator(evt.address.location);
dojo.byId("inLat").value = evt.address.location.y.toFixed(6);
dojo.byId("inLon").value = evt.address.location.x.toFixed(6);
//this service returns geocoding results in geographic - convert to web mercator to display on map
// var location = webMercatorUtils.geographicToWebMercator(evt.location);
var graphic = new Graphic(location, symbol, address, infoTemplate);
map.graphics.add(graphic);
map.infoWindow.setTitle(graphic.getTitle());
map.infoWindow.setContent(graphic.getContent());
//display the info window with the address information
var screenPnt = map.toScreen(location);
map.infoWindow.resize(200, 100);
map.infoWindow.show(screenPnt, map.getInfoWindowAnchor(screenPnt));
}
});
map.on("click", function(evt) {
map.graphics.clear();
locator.locationToAddress(webMercatorUtils.webMercatorToGeographic(evt.mapPoint), 100);
});
dojo.ready(init);
function showLocation(evt) {
map.graphics.clear();
console.log(evt);
var point = evt.result.feature.geometry;
var symbol = new SimpleMarkerSymbol().setStyle(
SimpleMarkerSymbol.STYLE_SQUARE).setColor(
new Color([255, 0, 0, 0.5])
);
var graphic = new Graphic(point, symbol);
map.graphics.add(graphic);
map.centerAndZoom(graphic, 4);
map.infoWindow.setTitle("Search Result");
map.infoWindow.setContent(evt.result.name);
map.infoWindow.show(evt.result.feature.geometry);
}
});
</script>
</head>
<body class="claro">
<div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'sidebar', gutters:false" style="width:100%; height:100%;">
<div id="leftPanel" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'left'">
<br> Enter an address then click the magnifying glass to return the location for street addresses in the United States.
<div id="search"></div>
<br>
<br>
<div style="font-size: 12pt; font-weight:bold;">
Input Longtitude and Latitude
</div>
<br>
<div>
<span>X: </span>
<input tabindex="1" type="text" id="inLon" data-dojo-id="inLon" data-dojo-type="dijit/form/TextBox" value="-95.249" />
</div>
<div>
<span>Y: </span>
<input tabindex="2" type="text" id="inLat" data-dojo-id="inLat" data-dojo-type="dijit/form/TextBox" value="38.954" />
</div>
<br>
<div>
<button id="convertButton" data-dojo-id="convertButton" data-dojo-type="dijit/form/Button">Convert</button>
</div>
</div>
<div id="mapDiv" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
<div style="position:absolute; right:20px; top:10px; z-Index:999;"></div>
</div>
</html> Regards, Tom
... View more
07-16-2015
08:50 AM
|
2
|
6
|
4104
|
|
POST
|
Chris, You are welcome! Have a great UC! Regards, Tom
... View more
07-16-2015
08:02 AM
|
1
|
1
|
3029
|
|
POST
|
Chris, It is now up on github. You can find it at: CityofYakima/Yak-Back · GitHub Regards, Tom
... View more
07-15-2015
04:51 PM
|
2
|
3
|
6100
|
|
POST
|
Manjari, I added some logic to your code to allow you to click on the map from the reverse geocoding example. It populates the lat/lon fields too. Here is the updated code: <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>ArcGIS dynamic and tile layers using Popup and InfoTemplates</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css">
<style>
html,
body,
#mapDiv {
padding: 0;
margin: 0;
height: 100%;
}
#leftPanel {
width: 20%;
border-top: solid 1px #343642;
border-left: solid 1px #343642;
border-bottom: solid 1px #343642;
border-right: solid 1px #343642;
margin: 0px 0px 5px 5px;
color: #343642;
font: 100% Georgia, "Times New Roman", Times, serif;
}
#convertButton {
font-size: 12pt;
}
</style>
<script src="http://js.arcgis.com/3.11/"></script>
<script>
var map, candidateLocation;
require(["esri/map",
"esri/SnappingManager",
"esri/dijit/Measurement",
"esri/dijit/BasemapGallery",
"esri/layers/FeatureLayer",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/dijit/Legend",
"esri/tasks/locator",
"esri/geometry/webMercatorUtils",
"esri/dijit/Geocoder",
"esri/tasks/query",
"esri/geometry/Circle",
"esri/graphic",
"esri/InfoTemplate",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleFillSymbol",
"esri/renderers/SimpleRenderer",
"esri/symbols/Font",
"esri/symbols/TextSymbol",
"esri/config",
"esri/Color",
"esri/tasks/geometry",
"esri/geometry/Extent",
"dojo/_base/array",
"dijit/registry",
"dojo/dom",
"dojo/parser",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/layout/AccordionContainer",
"dijit/form/Button",
"dijit/form/Textarea",
"dijit/form/TextBox",
"dijit/form/Select",
"dojo/on",
"dojo/domReady!",
],
function(
Map, SnappingManager, Measurement, BasemapGallery, FeatureLayer,
ArcGISDynamicMapServiceLayer, Legend, Locator, webMercatorUtils, Geocoder, Query, Circle,
Graphic, InfoTemplate, SimpleMarkerSymbol, SimpleLineSymbol,
SimpleFillSymbol, SimpleRenderer, Font, TextSymbol, esriConfig, Color, geometry, Extent,
arrayUtils, registry, dom, parser, on) {
parser.parse();
map = new Map("mapDiv", {
basemap: "gray",
center: [-95.249, 38.954],
zoom: 3,
sliderStyle: "large"
});
var geocoder = new Geocoder({
arcgisGeocoder: {
placeholder: "Enter an Address",
sourceCountry: "USA"
},
autoComplete: true,
map: map
}, dom.byId("search"));
geocoder.on("select", showLocation);
//script for locating the address with Longitude and Latitude.
function init() {
var inLat = new dijit.form.TextBox({
name: "inLat",
//value: 34.0571709
}, "inLat");
var inLon = new dijit.form.TextBox({
name: "inLon",
//value: -117.1942978
}, "inLon");
//dojo.byId("inLat").value = defaultcoord.y;
//dojo.byId("inLon").value = defaultcoord.x;
// var button = new dijit.form.Button({
//label: "Convert",
// },"convertButton");
convertButton.on("click", function(i) {
var a = 0;
});
}
var locator = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
var infoTemplate = new InfoTemplate("Location", "Address: ${Address}");
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE,
15,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([0, 0, 255, 0.5]),
8
),
new Color([0, 0, 255])
);
locator.on("location-to-address-complete", function(evt) {
if (evt.address.address) {
var address = evt.address.address;
var location = webMercatorUtils.geographicToWebMercator(evt.address.location);
dojo.byId("inLat").value = evt.address.location.y.toFixed(6);
dojo.byId("inLon").value = evt.address.location.x.toFixed(6);
//this service returns geocoding results in geographic - convert to web mercator to display on map
// var location = webMercatorUtils.geographicToWebMercator(evt.location);
var graphic = new Graphic(location, symbol, address, infoTemplate);
map.graphics.add(graphic);
map.infoWindow.setTitle(graphic.getTitle());
map.infoWindow.setContent(graphic.getContent());
//display the info window with the address information
var screenPnt = map.toScreen(location);
map.infoWindow.resize(200, 100);
map.infoWindow.show(screenPnt, map.getInfoWindowAnchor(screenPnt));
}
});
map.on("click", function(evt) {
map.graphics.clear();
locator.locationToAddress(webMercatorUtils.webMercatorToGeographic(evt.mapPoint), 100);
});
dojo.ready(init);
function showLocation(evt) {
map.graphics.clear();
console.log(evt);
var point = evt.result.feature.geometry;
var symbol = new SimpleMarkerSymbol().setStyle(
SimpleMarkerSymbol.STYLE_SQUARE).setColor(
new Color([255, 0, 0, 0.5])
);
var graphic = new Graphic(point, symbol);
map.graphics.add(graphic);
map.centerAndZoom(graphic, 4);
map.infoWindow.setTitle("Search Result");
map.infoWindow.setContent(evt.result.name);
map.infoWindow.show(evt.result.feature.geometry);
}
});
</script>
</head>
<body class="claro">
<div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'sidebar', gutters:false" style="width:100%; height:100%;">
<div id="leftPanel" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'left'">
<br> Enter an address then click the magnifying glass to return the location for street addresses in the United States.
<div id="search"></div>
<br>
<br>
<div style="font-size: 12pt; font-weight:bold;">
Input Longtitude and Latitude
</div>
<br>
<div>
<span>X: </span>
<input tabindex="1" type="text" id="inLon" />
</div>
<div>
<span>Y: </span>
<input tabindex="2" type="text" id="inLat" />
</div>
<br>
<div>
<button id="convertButton" data-dojo-id="convertButton" data-dojo-type="dijit/form/Button">Convert</button>
</div>
</div>
<div id="mapDiv" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
<div style="position:absolute; right:20px; top:10px; z-Index:999;"></div>
</div>
</html>
... View more
07-15-2015
03:32 PM
|
1
|
12
|
4104
|
|
POST
|
Manjari, Have you seen the sample from the JS API page? Reverse geocode | ArcGIS API for JavaScript Regards, Tom
... View more
07-15-2015
03:04 PM
|
0
|
0
|
4103
|
|
POST
|
Chris, Yes! I am really looking forward to this years UC. I know that they are getting ready to release the latest version of JS API and also the new 4.0 beta. I am really interested in working on some 3D web projects too. Are you also attending? Regards, Tom
... View more
07-15-2015
11:10 AM
|
1
|
4
|
3029
|
|
POST
|
Chris, Not at present. We will get it posted up later today. Regards, Tom
... View more
07-15-2015
10:58 AM
|
2
|
6
|
3070
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-24-2023 10:45 AM | |
| 1 | 05-19-2023 08:13 AM | |
| 1 | 02-22-2023 09:12 AM | |
| 1 | 05-15-2015 03:11 PM | |
| 1 | 02-10-2015 11:52 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-26-2024
04:50 PM
|