Something like "OpenStreetMaps" works fine!
Everything is ok, Zoom and Marker works, small Code...
But when i add my own Url, the Tiles are get not loaded !
So i think there is something wrong with my Image Size ? Pixel ?
Leaflet Tutorial just say "add a Map Url"
Look in my Code there is a Notice with Examples,
i think this is not a "coding" Error, more like a File Error.
I hope somebody has a idea :-)
http://hizi.xyz/Map/
You are using http://www.hizi.xyz/Map/{z}/{x}/{y}.png as your base URL, but your tiles are actually at http://www.hizi.xyz/Map/tiles/{z}/{x}/{y}.png.
At the zoom level you've initialized the map (11), you will not be able to see your custom tiles anyway, so you should set maxZoom: 5 in the map options. Also, your tiles only cover the northwestern quadrant of the map (from 0-85 degrees north and 0-180 degrees west), so you will either want to restrict panning within those bounds by setting the maxBounds option, or (if you actually want the map to be global) modify the directory structure by lowering the index for each of the {z} directories by 1. The following code should work to load your map as it is and prevent users from getting outside the boundaries of your map tiles:
var southWest = L.latLng(0, -180),
northEast = L.latLng(85, 0),
bounds = L.latLngBounds(southWest, northEast);
var map = L.map('map', {maxZoom: 5, maxBounds: bounds}).setView([42.5, -90], 3);
L.tileLayer('http://www.hizi.xyz/Map/tiles/{z}/{x}/{y}.png').addTo(map);
If, for aesthetic reasons, you want to keep the map from wrapping at the world boundaries, you may also want to set noWrap: true in the tileLayer options, i.e.:
L.tileLayer('http://www.hizi.xyz/Map/tiles/{z}/{x}/{y}.png', {noWrap: true}).addTo(map);
Here is an example fiddle that shows it working:
http://jsfiddle.net/nathansnider/6qeL29sm/
Related
https://knowledge.here.com/csm_kb?id=public_kb_csm_details&number=KB0017817
I've referenced this doc for getting the speed limit but it's not working well in a specific location. I'm not sure if I'm doing right.
For latitude: 34.9531064, longitude: -82.4189515, I was able to get 33712897 for ReferenceId using this api. https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json?prox=34.97147,-104.89752&mode=retrieveAddresses&maxresults=1&apiKey={{YOUR_API_KEY}}&locationattributes=linkInfo
tile size = 180° / 2^level [degree] tileY = trunc((latitude + 90°) / tile size) tileX = trunc((longitude + 180°) / tile size)
And using this formula, I am able to get 277 for tileX and 355 for tileY in case the level is 9.
But after calling https://pde.api.here.com/1/tiles.json?layers=SPEED_LIMITS_FC1&levels=9&tilexy=213,355&app_id={{YOUR_APP_ID}}&app_code={{YOUR_APP_CODE}}&meta=1&callback=onLoadPDETiles, I cannot get 33712897 ReferenceId in the response. So the result is I cannot get speed limit of that specific location.
What did I do wrong?
The way you're constructing your last request will not work because you forgot to consider the Functional Class of the link. Because of this, the layers, level and tilexy parameters are not correct.
The linkInfo object in the Reverse Geocoding response indicates that link 33712897 has a Functional Class = 5, so you want to call layer SPEED_LIMITS_FC5 isntead of SPEED_LIMITS_FC1. Also, according to the documentation available here, you should be using level=13:
For road link based layers, the level is always "road functional class" + 8
This means that your calculated tiles will be 4441,5686, and your request will look like this:
https://pde.api.here.com/1/tiles.json?
layers=SPEED_LIMITS_FC5&
levels=13&
tilexy=4441,5686&
app_id={{YOUR_APP_ID}}&
app_code={{YOUR_APP_CODE}}&
meta=1
Now, this request will still return an empty result because the link you chose doesn't have a Speed Limit in the HERE map, but at least your request is properly structured now. For example, if you change your coordinates to 32.705470,-96.784640 for link 17748385 (tilexy=3787,5584) using the exact same request structure, you will get a non-empty result.
If you want to check speed limit using coordinates, we would suggest to use Route Matching instead. Take these steps:
Compose a trace with coordinates, if for example you can compose it in csv format as below:
latitude,longitude
34.9531064,-82.4189515
Encode it into base64 format, you will get:
bGF0aXR1ZGUsbG9uZ2l0dWRlCjM0Ljk1MzEwNjQsLTgyLjQxODk1MTU=
Pass it to Route Matching API, such as:
https://m.fleet.ls.hereapi.com/2/matchroute.json?file=bGF0aXR1ZGUsbG9uZ2l0dWRlCjM0Ljk1MzEwNjQsLTgyLjQxODk1MTU=&attributes=SPEED_LIMITS_FCn(*)&apiKey=YOUR_API_KEY
Note attributes=SPEED_LIMITS_FCn(*) means to get all attributes of SPEED_LIMITS_FCn table, which means FC1-5.
Then you will notice you get nothing about speed limits because the location 34.9531064,-82.4189515 is located near a FC5 road which has no speed limits.
You can try a new location, such as 34.962142745546274,-82.4333132247333 which is on a highway, then you will get speed limits:
https://m.fleet.ls.hereapi.com/2/matchroute.json?file=bGF0aXR1ZGUsbG9uZ2l0dWRlCjM0Ljk2MjE0Mjc0NTU0NjI3NCwtODIuNDMzMzEzMjI0NzMzMw==&attributes=SPEED_LIMITS_FCn(*)&apiKey=YOUR_API_KEY
I recently asked this question: Horizontally-Drawn RowColumn Class for Motif Library (C)?
In my previous question, I was having trouble getting the xmRowColumnWidgetClass to draw horizontally (row-by-row) instead of vertically (column-by-column). After playing around with it, figured out how to switch to horizontal drawing with the following snippet:
XmNorientation, XmHORIZONTAL,
So the code that creates the xmRowColumnWidgetClass instance now looks like this:
rowColumn = XtVaCreateManagedWidget("rowcolumn",
xmRowColumnWidgetClass,
parentWidget,
XmNnumColumns, 3,
XmNorientation, XmHORIZONTAL,
XmNpacking, XmPACK_COLUMN,
XmNspacing, 6,
NULL);
However, my new problem is that for some reason the XmNnumColumns field is now referring to the number of rows, rather than the actual number of columns. Before adding the XmNorientation, XmHORIZONTAL part, the xmRowColumnWidgetClass instance was drawing the objects from left-to-right but it stayed to 3 columns like it was supposed to. Now, it is staying to 3 rows, occasionally creating a horizontal scrollbar which I do not want. I only want vertical scrolling.
So I need the children of the xmRowColumnWidgetClass instance to be drawn horizontally from top to bottom, but I need it to only put a maximum of 3 per row and thus keep it confined within a certain width.
I tried playing around with the XmNnumColumns field, but things that worked with more children did not work for less children, and vice versa. Sometimes it made it 4 or 5 columns rather than 3, and sometimes it made it 2 columns with the 3rd column completely empty. I encountered many issues like this even when experimenting with things like using XmNpacking, XmPACK_TIGHT rather than XmNpacking, XmPACK_COLUMN and other stuff.
If someone is able to find the official documentation of the xmRowColumnWidgetClass and link it, that would be be greatly appreciated.
To anybody familiar with this library:
How do I create a xmRowColumnWidgetClass instance that draws horizontally (row-by-row) while keeping it to a certain number of columns?
It should be able to handle any number of children and add as many rows as it needs to in order to keep it as exactly 3 columns.
Another group of examples of this library:
https://github.com/spartrekus/Motif-C-Examples
https://github.com/spartrekus/Motif-C-Examples/blob/master/rowcol.c
XmRowColumn was designed to implement the top menubar and all the other menu classes... You are searching for a grid like widget, and so you have to use XmForm read the related question for that.
In short: try the WtTable widget
Longer explanation follows:
The behaviour of XmRowColumn regarding "columns" becoming "rows" when you choose a horizontal configuration is very unfortunate. The alternative of using XmForm instead of XmRowColumn for this purpose is feasible, but however it requires manually setting the children constraints, and even then, it's quite possible that you won't be able to achieve the automatic sizing implemented in XmRowColumn.
By searching today, I found the WtTable widget and it works fine for my purposes. It's "almost" as automatic as XmRowColumn and it doesn't require to set any constraints manually. I tried it in my Motif code, and works fine.
Note however that I said "almost" as automatic. The "almost" is because you need to specify the number of columns and rows, and you need to specify the column and row for each child widget. However, all of this can be automated: you can create a convenience function that internally manages counters for columns and rows, so that you pass a widget to such function and it puts it in the cell it belongs automatically: you can even make that function create a new row in the WtTable when it's needed.
I’m trying to connect a LookupTable on a Grid(like one from examples). I have seen some tutorial and I have done what was in there, but it still not working.
I have defined a new lookup table like this
vtkSmartPointer<vtkLookupTable> lut =
vtkSmartPointer<vtkLookupTable>::New();
lut->SetNumberOfTableValues(x.size() * y.size());
lut->SetTableValue(0, colors->GetColor4d("Orange").GetData());
lut->Build();
and connected with the grid through the mapper, like this
rgridMapper->SetLookupTable(lut);
rgridMapper->SetUseLookupTableScalarRange(true);
rgridMapper->SetScalarModeToUsePointData();
Anyway it’s still not working. Why is it happening? How could I set a lookup table on a grid? Thanks
I use vtk python for programing,
My idea is that
You need to use rgrigdMapper.SetScalarRange(minValue,maxValue)
Here, the min and max value are the lower and upper limitation of the points color data. Usually, this data is set by vtkFloatArray and deliver to points by vtkPolyData.GetPointData().SetScalars(points)
I have an odd issue regarding the SPSS (version 20) use of Chart Template, and any help will be appriciated.
I used the GUI to manualy define a chart template for Histograms. Those are simple definitions:
1) set the x axis between 0 to 100.
2) set the y axis as percent and not as actual number of examples within each bin.
3) set the bin sizes to 5.
4) set the maximal value of the y axis to 20.
I saved the template using the File->Save ChartTemplate option after changing the definitions of one histogram.
Oddly, when I implement the template on a new histogram, only definitions 1,3,4 are generated while 2 is omitted. I searched for a solution and did not find any. This is extremly frustrating since I need to waste time and effort to manualy reset the axis to the right definition over any new histogram I make (which is a lot :/ ).
There might be a way to hack the template code using notepad but I did not see any mention of the Y axis there.
Any help and comment would be much appriciated.
I can't say offhand how to set up a template to do any of those aspects, but here is an example using syntax to specify those four options.
SET SEED 10.
INPUT PROGRAM.
LOOP #i = 1 TO 500.
COMPUTE Var = RV.UNIFORM(0,90).
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
DATASET NAME Sim.
FORMATS Var (F3.0).
EXECUTE.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=Var MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: Var=col(source(s), name("Var"))
GUIDE: axis(dim(1), label("Var"), delta(5))
GUIDE: axis(dim(2), label("Percent in Bin"))
SCALE: linear(dim(1), min(0), max(100))
SCALE: linear(dim(2), max(20))
ELEMENT: interval(position(summary.percent.count(bin.rect(Var, binWidth(5)), base.all(acrossPanels()))))
END GPL.
And this is what the graph looks like for me (with my default chart template) in V25.
I'm using the getclosest command to find a vertex.
ForceVertex1 = hatInstance.vertices.getClosest(coordinates=((x,y,z,))
This is a dictionary object with Key 0 and two values (hatInstance.vertices[1] and the coordinates of the vertex) The specific output:
{0: (mdb.models['EXP-100'].rootAssembly.instances['hatInstance-100'].vertices[1], (62.5242172081597, 101.192447407436, 325.0))}
Whenever I try to create a set, the vertex isn't accepted
mainAssembly.Set(vertices=ForceVertex1[0][0],name='LoadSet1')
I also tried a different way:
tolerance = 1.0e-3
vertex = []
for vertex in hatInstance.vertices:
x = vertex.pointOn[0][0]
print x
y = vertex.pointOn[0][1]
print y
z = vertex.pointOn[0][2]
print z
break
if (abs(x-xTarget)) < tolerance and abs(y-yTarget) < tolerance and abs(z-zTarget) < tolerance):
vertex.append(hatInstance.vertices[vertex.index:vertex.index+1])
xTarget etc being my coordinates, despite this I still don't get a vertex object
For those struggeling with this, I solved it.
Don't use the getClosest command as it returns a dictionary object despite the manual recommending this. I couldn't convert this dictionary object, specifically a key and a value within to a standalone object (vertex)
Instead use Instance.vertices.getByBoundingSphere(center=,radius=)
The center is basically a tuple of the coordinates and the radius is the tolerance. This returns an array of vertices
If you want the geometrical object you just have to access the dictionary.
One way to do it is:
ForceVertex1 = hatInstance.vertices.getClosest(coordinates=((x,y,z,))[0][0]
This will return the vertices object only, which you can assign to a set or whatever.
Edit: Found a solution to actually address the original question:
part=mdb.models[modelName].parts[partName]
v=part.vertices.getClosest(coordinates=(((x,y,z)),))
Note the formatting requirement for coordinates ((( )),), three sets of parenthesis with a comma. This will find the vertex closest to the specified point. In order to use this to create a set, I found you need to massage the Abaqus Python interface to return the vertex in a format that uses their "getSequenceFromMask" method. In order to create a set, the edges, faces, and/or vertices need to be of type "Sequence", which is internal to Abaqus. To do this, I then use the following code:
v2=part.verticies.findAt((((v[0][1])),))
part.Set(name='setName', vertices=v2)
Note, v[0][1] will give you the point at which the vertex lies on. Note again the format of the specified point using the findAt method (((point)),) with three sets of parenthesis and a comma. This will return a vertex that uses the getSequenceFromMask method in Abaqus (you can check by typing v2 then enter in the python box at the bottom of CAE, works with Abaqus 2020). This is type "Sequence" (you can check by typing type(V2)) and this can be used to create a set. If you do not format the point in findAt correctly (e.g., findAt(v[0][1]), without the parenthesis and comma), it will return an identical vertex as you get by accessing the dictionary returned using getClosest (e.g., v[0][0]). This is type 'Vertex' and cannot be used to create a set, even though it asks for a vertex. If you know the exact point where the vertex is, then you do not need the first step. You can simply use the findAt method with the correct formatting. However, the tolerance for findAt is very small (1e-6) and will return an empty sequence if nothing is found within the tolerance. If you only have a ballpark idea of where the vertex is located, then you need to use the getClosest method first. This indeed gets the closest vertex to the specified point, which may or may not be the one you are interested in.
Original post:
None of these answers work for a similar problem I am having while trying to create a set of faces within some range near a point. If I use getClosest as follows
f=mdb.models['Model-1'].parts['Part-1'].faces.getClosest(coordinates=((0,0,0),), searchTolerance=1)
mdb.models['Model-1'].parts['Part-1'].Set(faces=f, name='faceSet')
I get an error "TypeError: Keyword error on faces".
If I access the dictionary via face=f[0], I get error "Feature Creation Failed". If I access the tuple within the dictionary via f[0][0], I get the error "TypeError: keyword error on faces" again.
The option to use .getByBoundingSphere doesn't work either, because the faces in my model are massive, and the faces have to be completely contained within the sphere for Abaqus to "get" them, basically requiring me to create a sphere that encompasses the entire model.
My solution was to create my own script as follows:
import numpy as np
model=mdb.models['Model-1']
part=model.parts['Part-1']
faceSave=[]
faceSave2=[]
x=np.arange(-1,1,0.1)
y=np.arange(-1,1,0.1)
z=np.arange(-1,1,0.1)
for x1 in x:
for y1 in y:
for z1 in z:
f=part.faces.findAt(((x1,y1,z1),))
if len(f)>0:
if f[0] in faceSave2:
None
else:
faceSave.append(f)
faceSave2.append(f[0])
part.Set(faces=faceSave,name='faceSet')
This works, but it's extraordinarily slow, in part because "findAt" will throw a warning to the console whenever it doesn't find a face, and it usually doesn't find a face with this approach. The code above basically looks within a small cube for any faces, and puts them in the list "faceSave". faceSave2 is setup to ensure that duplicate faces aren't added to the list. Accessing the tuple (e.g, f[0] in the code above) contains the unique information about the face, whereas 'f' is just a pointer to the 'findAt' command. Strangely, you can use the pointer 'f' to create a Set, but you cannot use the actual face object 'f[0]' to create a set. The problem with this approach for general use is, the tolerance for "findAt" is super small, so, you either have to be confident where things are located in your model, or have the step size be 1e-6 in np.arange() to ensure you don't miss a face that's in the cube. With a tiny step size, expect the code to take forever.
At any rate, I can use a tuple (or a list of tuples) obtained via "findAt" to create a Set in Abaqus. However, I cannot use the tuple obtained via "getClosest" to make a set, even though I see no difference between the two objects. It's unfortunate, because getClosest gives me the exact info I need effectively immediately without my jumbled mess of for-loops.
#anarchoNobody:
Thank you so much for your edited answer!
This workaround works great, also with faces. I spent a lot of hours trying to figure out why .getClosest does not provide a working result for creating a set, but with the workaround and the number of brackets it works.
If applied with several faces, the code has to be slightly modified:
faces=((mdb.models['Model-1'].rootAssembly.instances['TT-1'].faces.getClosest(
coordinates=(((10.0, 10.0, 10.0)),), searchTolerance=2)),
(mdb.models['Model-1'].rootAssembly.instances['TT-1'].faces.getClosest(
coordinates=((-10.0, 10.0, 10.0),), searchTolerance=2)),)
faces1=(mdb.models['Model-1'].rootAssembly.instances['Tube-1'].faces.findAt((((
faces[0][0][1])),)),
mdb.models['Model-1'].rootAssembly.instances['Tube-1'].faces.findAt((((
faces[1][0][1])),)),)
mdb.models['Model-1'].rootAssembly.Surface(name='TT-inner-surf', side1Faces=faces1)
```