我正在尝试添加一些功能,这些功能将根据查询返回的点缩放地图.例如,假设我们放大了德克萨斯州.如果我执行查询并且服务返回德克萨斯州的一些点和一些位于加利福尼亚州的点,我希望地图然后缩小然后显示加利福尼亚州和德克萨斯州.我一直在浏览ArcGIS JS API以了解如何实现它,但我无法确定用于实现此目的的属性和/或方法.
在我的ASP.net Web应用程序中,我在Page的Page_Init event()中有代码,它会检查一些会话变量,以便在发生会话超时时重定向用户.
在我的Silverlight应用程序中,我有一个按钮事件处理程序,它以异步方式执行一些ESRI ArcGIS代码,并配置一个在异步调用完成时触发的事件处理程序:
QueryTask queryTask = new QueryTask(myLayer.Url + "/" + layerID);
queryTask.ExecuteCompleted += new EventHandler<QueryEventArgs>(queryCountyTask_ExecuteCompleted);
queryTask.ExecuteAsync(query);
Run Code Online (Sandbox Code Playgroud)
还有一些代码在页面上调用JavaScript函数来隐藏Panel.包含此代码会导致整页回发.
HtmlPage.Window.Invoke("hideReport");
Run Code Online (Sandbox Code Playgroud)
我的问题是有时queryCountyTask_ExecuteCompleted()Silvelright事件在Page_Init()Page事件之前触发,有时它会触发.在Silverlight在Page事件之前触发的情况下,会话状态为空,导致用户错误地重定向到"您的会话已超时"页面.只要Silverlight事件在Page事件之后触发,Session变量仍然存在,一切正常.
看起来Invoke方法的位置与触发页面级事件无关,因此事件的顺序看起来似乎是随机的.有没有办法订购活动以避免这些竞争条件?
有没有办法将这些异步回调事件与Web应用程序页面的正常页面生命周期进行协调,以避免这些竞争条件?
我最近在C#中继承了一个大型项目,该项目使用ArcGIS来渲染一些区域计划.目前正在使用它的人一直在抱怨该工具的性能极差,现在我的任务是让它更快.
当我第一次看到代码时,我感到害怕.System.Threading.Sleep(30000);每次打电话给gis api后都会有30-60s的睡眠时间,导致需要几分钟的简单动作.
经过一些测试后,很明显删除它们导致草图无法完成或充满了瑕疵,原因很简单,因为在执行下一步操作之前场景尚未完全呈现.
我的问题很简单.有没有办法获得ArcGIS渲染的当前状态,所以我可以停止该工具,直到ArcGis将当前视图标记为准备好,而不是等待'默认'30s?
谢谢
编辑:示例代码
doc.ActiveView = (IActiveView)doc.PageLayout;
doc.ActiveView.ContentsChanged();
System.Threading.Thread.Sleep(5000);
doc.PageLayout.ZoomToWhole();
System.Threading.Thread.Sleep(30000);
Run Code Online (Sandbox Code Playgroud)
我可以提供更多的代码片段,但我认为这个问题更通用,而不是直接与我的代码相关.
我想从 ArcGIS 地图中抓取数据。当我们单击红色要素时,以下地图会弹出一个窗口。如何以编程方式访问该数据?
链接:https : //cslt.maps.arcgis.com/apps/MapSeries/index.html?appid=2c9f3e737cbf4f6faf2eb956fa26cdc5
我正在尝试在Angular应用程序中使用ArcGIS JavaScript API.我看,它使用Dojo.所以,我试图从Angular指令初始化ArcGIS,如下所示:
link: function (scope, element, attrs) {
dojo.require('esri.map');
var init = function () {
console.log('dojo is ready');
var map = new esri.Map("map-container", {
center: [-111.3797, 56.7266 ],
zoom: 16,
basemap: "streets"
});
map.enableScrollWheelZoom()
};
dojo.addOnLoad(init);
}
Run Code Online (Sandbox Code Playgroud)
看起来这种方式不是100%正确,因为当我尝试通过滚动鼠标滚轮进行缩放时,我收到此错误:
Uncaught TypeError: Cannot call method 'apply' of null
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何在Angular应用程序中正确地注入ArcGIS功能?
我需要在项目中使用 geopandas sjoin 。我已经成功创建了 GeoDataFrame 对象并使用了类方法 readfile、crs 和 to_crs。但是,当涉及到使用 sjoin 时,我收到错误: AttributeError: 'GeoDataFrame' object has no attribute 'sjoin'。
所以我想我会尝试让 sjoin 处理一个直接取自 geopandas 官方网站的简单示例: https: //geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.sjoin.html
import geopandas
countries = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))
cities = geopandas.read_file(geopandas.datasets.get_path("naturalearth_cities"))
print(countries.head())
print(cities.head())
cities_w_country_data = cities.sjoin(countries)
print(cities_w_country_data.head())
Run Code Online (Sandbox Code Playgroud)
但我遇到了同样的问题。请问有人可以解释这个错误并提供解决方案吗?谢谢。
输出如下:
C:\Users\mmm\AppData\Local\ESRI\conda\envs\arcgispro-py3_clone\lib\site-packages\geopandas\array.py:85: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the number of parts of a multi-part geometry.
aout[:] = out
C:\Users\mmm\AppData\Local\ESRI\conda\envs\arcgispro-py3_clone\lib\site-packages\geopandas\geodataframe.py:35: ShapelyDeprecationWarning: The …Run Code Online (Sandbox Code Playgroud) 我很难尝试将简单的可点击标记添加到ArcGIS,纯粹使用JavaScript进行地图绘制.所有ArcGIS Samples似乎都从服务器获取其标记和相关的弹出信息. 如何使用ArcGIS获得与下面的Google Maps示例代码相同的结果?
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<div id="map" style="width: 500px; height: 500px;"></div>
<script type="text/javascript">
window.onload = function() {
var myOptions = {
zoom: 2,
center: new google.maps.LatLng(40, -75),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), myOptions);
var icon = new google.maps.MarkerImage("http://cinnamonthoughts.org/wp-content/uploads/2010/01/Custom-Marker-Avatar.png");
var markerOptions = {
icon: icon,
map: map,
position: new google.maps.LatLng(37.7699298, -122.4469157),
};
var marker = new google.maps.Marker(markerOptions);
google.maps.event.addListener(marker, 'click', function() {
var infoWindow = new google.maps.InfoWindow();
infoWindow.setContent("hello world");
infoWindow.open(map, marker);
});
};
</script>
Run Code Online (Sandbox Code Playgroud) 我正在尝试将地理坐标系转换为Esri Webmercator,但是当我进行转换时,结果x和y的值为0000003232112222 ...和00000012665321 .... 这是非常奇怪的,因为坐标不存在.
var positions = [];
positions.push(x, y);
var g = new esri.geometry.Point(positions);
g = esri.geometry.geographicToWebMercator(g);
x = g.x;
y = g.y;
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Windows 8.1上安装Scrapy for Python 2.7,我知道我首先需要安装pip.由于我通过ArcGIS 10.2安装了Python,我认为我需要在C:\ Python27\ArcGIS10.2\lib\site-packages下安装pip.一旦pip安装在该目录中,我收到错误代码:
>>> import pip
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python27\ArcGIS10.2\lib\site-packages\pip\__init__.py", line 10, in <module>
from pip.util import get_installed_distributions, get_prog
File "C:\Python27\ArcGIS10.2\lib\site-packages\pip\util.py", line 18, in <module>
from pip._vendor.distlib import version
File "C:\Python27\ArcGIS10.2\lib\site-packages\pip\_vendor\distlib\version.py", line 14, in <module>
from .compat import string_types
File "C:\Python27\ArcGIS10.2\lib\site-packages\pip\_vendor\distlib\compat.py", line 38, in <module>
from HTMLParser import HTMLParser
File "C:\Python27\ArcGIS10.2\lib\HTMLParser.py", line 47, in <module>
""", re.VERBOSE)
File "C:\Python27\ArcGIS10.2\lib\re.py", line 190, in compile
return _compile(pattern, flags) …Run Code Online (Sandbox Code Playgroud) 在设备中运行应用程序时出错:
java.lang.UnsatisfiedLinkError: Native method not found: com.esri.core.runtime.LicenseImpl.nativeIsClientIdValid:(Ljava/lang/String;)Z
at com.esri.core.runtime.LicenseImpl.nativeIsClientIdValid(Native Method)
at com.esri.core.runtime.LicenseImpl.a(Unknown Source)
at com.esri.android.a.b.b(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
相关代码:
import com.esri.android.runtime.ArcGISRuntime;
public class MainActivity extends FragmentActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ArcGISRuntime.setClientId("xxxxxxxxxxxxxxxx");
......
Run Code Online (Sandbox Code Playgroud)
的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "xxx.xxxx.xxxxx"
minSdkVersion 17
targetSdkVersion 19
versionCode 1
versionName "1.0"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled …Run Code Online (Sandbox Code Playgroud) arcgis ×10
javascript ×4
esri ×3
python ×2
android ×1
angularjs ×1
asp.net ×1
c# ×1
dojo ×1
geopandas ×1
google-maps ×1
pip ×1
scrapy ×1
silverlight ×1
web-scraping ×1
web-services ×1