Invalid argument - unknown wkt,this is the exception which i got

3201
15
02-19-2017 09:50 PM
竹丰刘
New Contributor II

I use the shapefileTable to open the shapefiles on my machine,write with the absolute path.I download the local shapefiles(include .dbf .prj .shp .shx) from google.and all the code are from https://developers.arcgis.com/java/10-2/sample-code/shapefile-feature-layer/  .I only change the shapefileTable line of code.

try {
shapefileTable = new ShapefileFeatureTable("E:\\antarctica-icesheet-polygons-3857\\icesheet_polygons.shp");
featureLayer = new FeatureLayer(shapefileTable);

// create a renderer
UniqueValueRenderer uvRenderer = new UniqueValueRenderer(
new SimpleFillSymbol(new Color(100, 0, 0, 255), null), "icesheet_polygons");

// set renderer
featureLayer.setRenderer(uvRenderer);
jMap.getLayers().add(featureLayer);

the shapefiels(include .dbf .prj ..sbn .sbx shp .shp.xml .shx) that the sample code use are more.Is that the problem?

I HOPE THERE IS SOMEBODY TO HELP ME OUT!   THANK YOU!

Tags (1)
15 Replies
nita14
by
Occasional Contributor III

maybe  i should to only use the basemap(which its url is World_Street_Map (MapServer) )and not to use the shapefiles

- GOOD  IDEA 🙂

Adam

0 Kudos
竹丰刘
New Contributor II

hello,Adam.

I HAVE one more problem to ask you again,

when i use point(which longitude and latitude are west-longitude 122 and north-latitude 37)in State of California

the code is following:

private JMap createMap() {
// map
JMap jMap =new JMap();
//MapOptions mapOptions = new MapOptions(MapType.TOPO);
//jMap = new JMap(mapOptions);
ArcGISTiledMapServiceLayer basemap = new ArcGISTiledMapServiceLayer(BASEMAP_URL);

jMap.getLayers().add(basemap);

GraphicsLayer myGraphicsLayer = new GraphicsLayer();

SimpleMarkerSymbol simpleMarker = new SimpleMarkerSymbol(Color.RED, 10, Style.CIRCLE);

SpatialReference spatialReference = SpatialReference.create(4326);

Point point = GeometryEngine.project(37.6, -122.5, spatialReference);
Point point1 = new Point(37.6, -122.5);
myGraphicsLayer.addGraphic(new Graphic(point1, simpleMarker));

jMap.getLayers().add(myGraphicsLayer);
jMap.setShowingEsriLogo(false);
jMap.setExtent(new Envelope(-15967900, 1670500, -6360000, 8079000));

return jMap;
}

THE red point is supposed to show in State of California,but it is showing nearly by the Africa,it's obviouly wrong.

i thought it maybe  is because of the SpatialReference is wrong,but what number instead of 4326 I suppose to use?

or there is some method to mark the longitude is west-longitude and the latitude is north-latitude?

 

AND the code: jMap.setExtent(new Envelope(-15967900, 1670500, -6360000, 8079000));

the function of this line of code is to set the map-view to Include all the amerian-map.

AND I really want to know those number(-15967900, 1670500, -6360000, 8079000) how to create.

if those numbers is transformed by Latitude and longitude,please tell how turn Latitude and longitude to those number.

0 Kudos
NeilAyres
MVP Alum

Although I know nothing about Java or whatever language, this looks to be the wrong way round :

GeometryEngine.project(37.6, -122.5, spatialReference);

I think that should be -122.5, 37.6

nita14
by
Occasional Contributor III

Neil Ayres made good point regarding the arguments order. Also, insure that your map spatial reference is 4326, since you project the point to this wkid. Last time you mentioned going to switch back to World Street Map which is in 3857 (102100) wkid. 

竹丰 刘 napisał(-a):

AND the code: jMap.setExtent(new Envelope(-15967900, 1670500, -6360000, 8079000));

the function of this line of code is to set the map-view to Include all the amerian-map.

AND I really want to know those number(-15967900, 1670500, -6360000, 8079000) how to create.

if those numbers is transformed by Latitude and longitude,please tell how turn Latitude and longitude to those number

These seem to be coordinates in 102100 WKID. You can project polygon geometry to this wkid using GeometryEngine.project as well. You just need to create new polygon. I highly recommend you read the guide to ArcGIS Runtime 10.2.4 which really good starting point. Also you can examine the runtime samples where you can find plenty of useful hints regarding extents, geometry and coordinate systems.

Regards,

Adam

0 Kudos
NeilAyres
MVP Alum

WKID 3857 and 102100 are actually the same thing, just a historical difference.

https://community.esri.com/thread/9351 

0 Kudos
竹丰刘
New Contributor II

hello,Adam.

I HAVE one more problem to ask you again,

when i use point(which longitude and latitude are west-longitude 122 and north-latitude 37)in State of California

the code is following:

private JMap createMap() {
// map
JMap jMap =new JMap();
//MapOptions mapOptions = new MapOptions(MapType.TOPO);
//jMap = new JMap(mapOptions);
ArcGISTiledMapServiceLayer basemap = new ArcGISTiledMapServiceLayer(BASEMAP_URL);

jMap.getLayers().add(basemap);

GraphicsLayer myGraphicsLayer = new GraphicsLayer();

SimpleMarkerSymbol simpleMarker = new SimpleMarkerSymbol(Color.RED, 10, Style.CIRCLE);

SpatialReference spatialReference = SpatialReference.create(4326);

Point point = GeometryEngine.project(37.6, -122.5, spatialReference);
Point point1 = new Point(37.6, -122.5);
myGraphicsLayer.addGraphic(new Graphic(point1, simpleMarker));

jMap.getLayers().add(myGraphicsLayer);
jMap.setShowingEsriLogo(false);
jMap.setExtent(new Envelope(-15967900, 1670500, -6360000, 8079000));

return jMap;
}

THE red point is supposed to show in State of California,but it is showing nearly by the Africa,it's obviouly wrong.

i thought it maybe  is because of the SpatialReference is wrong,but what number instead of 4326 I suppose to use?

or there is some method to mark the longitude is west-longitude and the latitude is north-latitude?

AND the code: jMap.setExtent(new Envelope(-15967900, 1670500, -6360000, 8079000));

the function of this line of code is to set the map-view to Include all the amerian-map.

AND I really want to know those number(-15967900, 1670500, -6360000, 8079000) how to create.

if those numbers is transformed by Latitude and longitude,please tell how turn Latitude and longitude to those number.

0 Kudos