I using javascript for converting UTM to WSG84 lon lat with the following code where the utm_zone contains the UTM zone number.
var utm = "+proj=utm +zone=";
utm = utm + "" + utm_zone;
var wgs84 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
var lonlatArray = proj4(utm, wgs84, [utm_x, utm_y]);
But how can I parameterize for convert directly the UTM format to EOV (epsg:23700)?
Use the definition of EOV / EPSG:23700 from https://epsg.io/23700.
Example:
var utm = "+proj=utm +zone=34T";
var epsg23700 = '+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +towgs84=52.17,-71.82,-14.9,0,0,0,0 +units=m +no_defs';
console.log(proj4(utm, epsg23700, [352920, 5263357]));
Related
I can't figure out how to retrieve registration point that I see in properties panel transform section in script.
I use this script documentation http://ai.aenhancers.com/jsobjref/SymbolItem/
As far as I can tell they are just coordinates of the symbol's center. You can get them this way:
var symbol = app.activeDocument.selection[0];
var X = symbol.position[0] + symbol.width/2;
var Y = -symbol.position[1] + symbol.height/2;
alert("X: " + X + "\n" + "Y: " + Y);
I'm coding a terrain generator in Godot. I generate the Mesh using SurfaceTool and triangle strips. The geometry works fine — but the UV mapping doesn't, as each triangle repeats the texture instead of the full mesh covering the texture once:
Normalizing the UV-Coordinates to fit into the 0,0 - 1,1 dimensions is what should work, but doesn't, as it makes only one pair of triangles have the full texture and the rest is blank:
extends MeshInstance
export var terrain_width = 16
export var terrain_depth = 16
export var terrain_height = 1
export var terrain_scale = 1
#Noise Generation
var terrain_noise = OpenSimplexNoise.new()
var terrain_heightmap = ImageTexture.new()
var terrain_texture = Texture.new()
var terrain_material = SpatialMaterial.new()
var terrain_mesh = Mesh.new()
var surfacetool = SurfaceTool.new()
func _ready():
generate_heightmap()
generate_mesh()
func generate_heightmap():
#Setup the noise
terrain_noise.seed = randi()
terrain_noise.octaves = 4
terrain_noise.period = 20.0
terrain_noise.persistence = 0.8
#Make the texture
terrain_heightmap.create_from_image(terrain_noise.get_image(terrain_width+1, terrain_depth+1))
terrain_texture = terrain_heightmap
func generate_mesh():
#Set the material texture to the heightmap
terrain_material.albedo_texture = terrain_texture
# This is where the uv-mapping occurs, via the add_uv function
for z in range(0,terrain_depth):
surfacetool.begin(Mesh.PRIMITIVE_TRIANGLE_STRIP)
for x in range(0,terrain_width):
surfacetool.add_uv(Vector2((terrain_width-x)/terrain_width,z/terrain_depth))
surfacetool.add_vertex(Vector3((terrain_width-x)*terrain_scale, terrain_noise.get_noise_2d(x,z)*terrain_height*terrain_scale, z*terrain_scale))
surfacetool.add_uv(Vector2((terrain_width-x)/terrain_width,(z+1)/terrain_depth))
surfacetool.add_vertex(Vector3((terrain_width-x)*terrain_scale, terrain_noise.get_noise_2d(x,z+1)*terrain_height*terrain_scale, (z+1)*terrain_scale))
surfacetool.generate_normals()
surfacetool.index()
surfacetool.commit(terrain_mesh)
#Set the texture and mesh on the MeshInstance
self.material_override = terrain_material
self.set_mesh(terrain_mesh)
self.set_surface_material(0, terrain_texture)
I expect each triangle to cover only the corresponding coordinates in the texture.
It seems as if each triangle is considered as a separate surface.
You have lots of integer divisions there. There are many ways to fix that. Here's a quick one: Just add .0 after your exported variable's default values:
export var terrain_width = 16.0
export var terrain_depth = 16.0
export var terrain_height = 1.0
export var terrain_scale = 1.0
And here's a more explicit way:
export(float) var terrain_width = 16
export(float) var terrain_depth = 16
export(float) var terrain_height = 1
export(float) var terrain_scale = 1
Assuming you don't have any other bugs, this should fix the issue.
I found createfishnet method in arcobject, but it doesn't work.Where is my mistake?
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
ESRI.ArcGIS.DataManagementTools.CreateFishnet fishnet = new ESRI.ArcGIS.DataManagementTools.CreateFishnet();
fishnet.template = buffer_out;
//txtOutputPath2.Text="E:\\program\\shenzhen_science_committee\\sc\\landuse_subway\\shenzhen_subway\\23_net.shp"
fishnet.out_feature_class = txtOutputPath2.Text;
IFeatureCursor cursor1=buffer_out.Search(null,true);
IFeature buffer=cursor1.NextFeature();
IPoint centerPoint =new ESRI.ArcGIS.Geometry.Point();
IArea pArea = buffer.Shape as IArea;
pArea.QueryCentroid(centerPoint);
fishnet.origin_coord = centerPoint;
double height=0;
double width=0;
fishnet.cell_height = 0.1;
fishnet.cell_width = 0.1;
fishnet.number_columns = 50;
fishnet.number_rows = 50;
IGeoProcessorResult results = (IGeoProcessorResult)gp.Execute(fishnet, null);
The result shows wrong HRESULT E_FAIL.
I have tried this in ArcObjects with Java. What I found was that the fishnet could not be generated for area within a particular polygon, as in the ArcMap application. You would have to intersect or use spatial filter on the fishnet output.
Also, try giving all the parameters, even the optional ones like set corner coordinate. If you are using data in a particular projection system, that can be set to the output by setting the template (and this takes only Envelope).
Below is the code that I have used. I wanted the fishnet label as well, so I have enabled it. Make sure you use a space between the x and y coordinate of a point, entered as a String, which is probably the issue here.
GeoProcessor gp = new GeoProcessor();
gp.setOverwriteOutput(true);
IEnvelope aoi = buffer_out.getEnvelope();
CreateFishnet createFishnet = new CreateFishnet();
createFishnet.setOutFeatureClass(tempDir+"/"+fishnetOutput+".shp");
createFishnet.setTemplate(aoi);
createFishnet.setOriginCoord(aoi.getXMin()+" "+aoi.getYMin());
createFishnet.setYAxisCoord(aoi.getXMin()+" "+aoi.getYMax());
createFishnet.setCornerCoord(aoi.getXMax()+" "+aoi.getYMax());
createFishnet.setCellHeight(30.0);
createFishnet.setCellWidth(30.0);
createFishnet.setNumberRows(0);
createFishnet.setNumberColumns(0);
createFishnet.setLabels("LABELS");
createFishnet.setGeometryType("POLYLINE");
gp.execute(createFishnet, null);
I hope you can use this example and apply it to your code.
I am trying to fetch all the hospitals for specific cities in India using BING Map APIs for Windows 8 Metro application. However i am not able to fetch the details. Following are the two approaches that are tried
Using NearbyVenueCollection class
NearbyVenueOptions options = new NearbyVenueOptions(loc, 10000);
NearbyVenueCollection nearbyVenues = null;
try
{
nearbyVenues = await MyMap.VenueManager.GetNearbyVenuesAsync(options); ;
}
catch (Exception)
{
}
if (nearbyVenues != null && nearbyVenues.Count > 0)
{
foreach (var nearbyVenue in nearbyVenues)
{
if (nearbyVenue.Metadata.VenueType == VenueType.Hospital.ToString())
{
string name = nearbyVenue.Metadata.Name;
}
}
}
This is not providing the required details.
Using Bing Spatial Data Services
Following is the code snippet
////Create the Bing Spatial Data Services request to get nearby POI
string findNearbyPOIRequest = "http://spatial.virtualearth.net/REST/v1/data/ f22876ec257b474b82fe2ffcb8393150/ NavteqNA/NavteqPOIs? spatialfilter=nearby("
+ loc.Latitude + "," + loc.Longitude + "," + 1000 + ")"
+ "&$filter=EntityTypeID%20EQ%20'" + "8060" + "'& $select=EntityID,DisplayName,__Distance,Latitude,Longitude,AddressLine, Locality,AdminDistrict,PostalCode,Phone&$top=20"
+ "&key=" + BingCredentials;
Uri uri = new Uri(findNearbyPOIRequest);
WebRequest request = WebRequest.Create(uri);
// GetResponseAsync() returns immediately after the header is ready
WebResponse response = await request.GetResponseAsync();
Stream inputStream = response.GetResponseStream();
XDocument doc = XDocument.Load(inputStream);
XNamespace m ="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
XNamespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";
MapLayer pushpinLayer = new MapLayer();
pushpinLayer.Name = "Push Pin Layer";
var elements = from nodes in doc.Descendants(m + "properties")
select new
{
Name = nodes.Element(d + "DisplayName").Value,
Latitude = nodes.Element(d + "Latitude").Value,
Longitude = nodes.Element(d + "Longitude").Value,
Address = nodes.Element(d + "AddressLine").Value,
};
However i am not getting the required details for cities in India. Can someone help me figure out what need to be done in order to fetch correct details?
The Venue maps are only locations where Bing Maps has indoor floor plans. I'm not aware of any hospitals in India that are available as Venue Maps. The point of interest data in the Bing Spatial Data services is only available in North America and Europe. Your best option for finding locations in India is to use the Bing Maps SOAP Search Service.
http://msdn.microsoft.com/en-us/library/cc980849.aspx
http://msdn.microsoft.com/en-us/library/dd221354.aspx
a develop a application. in this we take data from server just like name, discription, id and image, all information is show on label. But, image is not show proper.
xhr.onload = function(){ Ti.API.info('details onload');
var details = this.responseXML.documentElement;
var name_info = details.getElementsByTagName('game_name');
var disc_info = details.getElementsByTagName('game_desc');
var img_info = details.getElementsByTagName('game_image');
var g_id_info = details.getElementsByTagName('game_id');
Ti.API.info(curWin.id2);
for(var i=0;i<g_id_info.length;i++){
var gm_id = g_id_info.item(i);
var gm_nam = name_info.item(i);
var gm_dis = disc_info.item(i);
var img = img_info.item(i);
//
var image1 = Ti.Utils.base64decode(img.text);
Ti.API.info('if '+ gm_id.text );
if(curWin.id2==gm_id.text){
Ti.API.log('if ok');
name_label.text = gm_nam.text;
disc_label.text = gm_dis.text;
img_label.backgroundImage = image1;
};
};
};
if, u sure ur data whose come from serve in base64, than
You Just take a imageView and your data (image) whose come from server decode in bitmap or jpg and set in imageView.image.
I think it's working.... on ur application
You should use an ImageView, and set the image property with a Blob that contains the decoded datas.