|
POST
|
Instead of what you have, add the following:
var graphicExtent = graphic._extent.getExtent();
map.setExtent(graphicExtent);
Hope this helps! Tim
... View more
08-04-2014
12:50 PM
|
0
|
3
|
2011
|
|
POST
|
Flo, looking at the default swipe app, I don't think you can add a scalebar. You could however download the swipe app and modify the code and add a scalebar. scalebar-amd | API Reference | ArcGIS API for JavaScript Tim
... View more
08-04-2014
12:37 PM
|
1
|
0
|
531
|
|
POST
|
You convert it from deg/min/sec and once you have your Lat/Long feed them into line 122, here:
var LatLongLocation = new Point([Long,Lat]);
... View more
08-04-2014
12:16 PM
|
0
|
0
|
2011
|
|
POST
|
Karen, just an fyi with the 3.10 release the measurement widget look has changed. Tim
... View more
08-04-2014
11:03 AM
|
0
|
0
|
381
|
|
POST
|
I built on the example I gave you, check it out:
<!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>Find Address</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.10/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map {
padding: 0;
border: solid 2px #666;
margin: 0 5px 5px 5px;
}
#header {
border: solid 2px #666;
color: #666;
font-family: sans-serif;
font-size: 1.1em;
height: auto;
margin: 5px;
overflow: hidden;
padding: 10px 0 10px 20px;
text-align:left;
}
.roundedCorners {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
</style>
<script src="http://js.arcgis.com/3.10/"></script>
<script>
var map;
require([
"esri/map", "esri/tasks/locator", "esri/graphic",
"esri/geometry/webMercatorUtils",
"esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol",
"esri/InfoTemplate", "esri/Color", "esri/geometry/Point", "dojo/on",
"dojo/number", "dojo/parser", "dojo/dom", "dijit/registry", "dijit/form/TextBox", "dijit/form/Button",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"
], function(
Map, Locator, Graphic,
webMercatorUtils,
SimpleMarkerSymbol, SimpleLineSymbol,
InfoTemplate, Color, Point, on,
number, parser, dom, registry, TextBox
) {
parser.parse();
map = new Map("map", {
basemap: "streets",
center: [-95.273, 38.95],
zoom: 14
});
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])
);
var locator = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
var infoTemplate = new InfoTemplate("Location", "Address: ${Address}");
locator.on("location-to-address-complete", function(evt) {
if (evt.address.address) {
var address = evt.address.address;
var location = webMercatorUtils.geographicToWebMercator(evt.address.location);
//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);
});
var LongTextBox = new TextBox({
placeHolder: "Longitude",
value:"-95.273",
intermediateChanges:true
},"LongTextBoxDiv");
var LatTextBox = new TextBox({
placeHolder: "Latitude",
value:"38.95",
intermediateChanges:true
},"LatTextBoxDiv");
on(registry.byId("latlong"), "click", getaddress);
function getaddress(){
var Lat = LatTextBox.get("value");
var Long = LongTextBox.get("value");
var LatLongLocation = new Point([Long,Lat]);
locator.locationToAddress(LatLongLocation , 100);
map.graphics.clear();
}
});
</script>
</head>
<body class="claro">
<div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="design:'headline', gutters:false"
style="width:100%; height:100%;">
<div id="header" class="roundedCorners"
data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'top'">
Long: <input id="LongTextBoxDiv" />
Lat: <input id="LatTextBoxDiv" />
<button id="latlong" data-dojo-type="dijit.form.Button" type="button" data-dojo-attach-point="button">Get Address</button>
</div>
<div id="map" class="roundedCorners"
data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'center'">
</div>
</div>
</body>
</html>
Hope this answers your question! Tim
... View more
08-04-2014
08:41 AM
|
0
|
2
|
2011
|
|
POST
|
Ian, you could set the opacity property when you create your graphic or later on use the setOpacity method of your graphic layer to do that. Tim
... View more
08-04-2014
07:22 AM
|
0
|
2
|
1399
|
|
POST
|
You could use the color picker instead? dojox.widget.ColorPicker — The Dojo Toolkit - Reference Guide
... View more
08-04-2014
07:05 AM
|
0
|
0
|
1399
|
|
POST
|
Jay, you could use this Reverse geocode | ArcGIS API for JavaScript , but instead of a "map on click event" you could create a box, where a user can put in the lat/long, then create a point from that information and use the point as your "evt.mapPoint". Tim
... View more
08-04-2014
06:40 AM
|
0
|
0
|
2011
|
|
POST
|
Hey everybody, I was wondering what the terms of use are with ArcGIS Javascript API. I was thinking about creating a personal website that shows some of the mapping application that I have build using ArcGIS Javascript API. At the moment I only have one of the free developer account. Since I don't want to violate any terms by using the ArcGIS Javascript API on my personal website, does anyone know if I can do this without having a paid account? Thanks, Tim
... View more
08-04-2014
06:15 AM
|
0
|
3
|
3539
|
|
POST
|
Jay, put the following outside of your showLocation function:
var point;
and then remove the var in front of point inside your showLocation function, so that it looks like this: point = evt.result.feature.geometry; now it should be global and ready to be used in your BufferParameters.
... View more
08-01-2014
12:23 PM
|
0
|
0
|
898
|
|
POST
|
Ken, I just realized that this will change the color of all button text. Write it like this so only the button text for the measure will be changed:
#measurementDiv .dijitButtonText {
color: white;
}
Tim
... View more
07-31-2014
12:36 PM
|
0
|
1
|
1410
|
|
POST
|
Ken is right, with my code you will only change the color of the dropdown text, which you probably want to change as well.
... View more
07-31-2014
12:26 PM
|
0
|
0
|
1410
|
|
POST
|
Try this and see what it does:
.dijitMenuItem TD{
color: white;
}
Hope this helps!
... View more
07-31-2014
12:19 PM
|
0
|
0
|
1410
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-06-2015 06:58 AM | |
| 1 | 05-04-2016 07:27 AM | |
| 1 | 07-06-2017 08:12 AM | |
| 1 | 10-26-2015 11:51 AM | |
| 1 | 12-12-2014 12:05 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|