mapping,gis,mapbox,mapbox-gl-js , Control pan and zoom animation duration in mapbox.js

Control pan and zoom animation duration in mapbox.js


Tag: mapping,gis,mapbox,mapbox-gl-js

I'm making an animated map showing a series of points using Mapbox.js. Ideally, I want to smoothly switch focus between points by combining zoom and pan like this example created in d3.js. I wonder if there is anyway to control the pan & zoom animation speed (mainly to slow it down). In the code below, I've tried both setView() and panTo() functions and the transition is too fast. Any suggestion will be highly appreciated, thanks!

L.mapbox.accessToken = "#Token Here";
var map ='map', 'mapbox.streets')
        .setView([34.01, -118.48], 5, { 
            pan: { animate: true }, 
            zoom: { animate: true } 

map.setView([33.98, -118.42], 5);


Take a look at this fiddle.

You can use a function like:

function jumpTo(index){
    map.setView(positions[index], 4, {
        pan: {
            animate: true,
            duration: 2
        zoom: {
            animate: true

And control it on moveend event.


When I try to map the properties for an entity (Entity Framework), I get the error the type '__' must be a non-nullable value type

My mapping class looks like the following: public class EmployeeMap : EntityTypeConfiguration<EFEmployee> { public EmployeeMap() { HasKey(t => t.Id); Property(t => t.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); Property(t => t.HireDate).IsRequired(); //Property(t => t.JobTitle).IsRequired(); Property(t => t.Salary).IsRequired(); //Property(t => t.Certifications).IsRequired(); Property(t => t.VacationTime).IsRequired(); Property(t => t.SickTime).IsRequired(); //Property(t =>...

There should be one non-read-only mapping defined for the primary key field

Hi I've the following code (using eclipselink 2.6): Transmission: @Entity public class Transmission { @Column(name="TRANSMISSION_ID") @Id private Long id; @Column(name="TRANSMISSION_CONTENT") private String content; .... } HeaderPk: @Embeddable public class HeaderPk { // this is a foreign key to "TRANSMISSION_ID" in Transmission @Column(name="FK_TRANSMISSION_ID") private Long transmissionId; @Column(name="MAILBOX_ID") private String mailboxId; @Column(name="TRANSMISSION_TIME")...

In leaflet, how to calculate the Pixel Distance between two LatLng object?

There is a latlng distanceTo method: distanceTo( <LatLng> otherLatlng ) Number Returns the distance (in meters) to the given LatLng calculated using the Haversine formula. See description on wikipedia It calculates the distance (in meters) between two LatLng. However, sometimes I needs to know how many pixels are there...

Searching in specific indices with JSON object

I have a problem. In my application I'm using ElasticSearch. I'm posting JSON object to my ElasticSearch server. That JSON object contain DSL query. So, what I need to do, is to query specific index for some data. This is the query: { "query":{ "indices":{ "indices":[ "index-1" ], "query":{ "bool":{...

model isn't working as expected C#

My model is getting data I need, but I'm not sure how to organize it in the way I need. I have it where the model pulls a team, and a player. The issue is when mapping my data to the model it gives me duplicate teams, and doesn't allow...

AutoMapper: An exception of type 'AutoMapper.AutoMapperMappingException' occurred in AutoMapper.dll but was not handled in user code

I have a problem like this. But this answer it didn't work for me. I am working on a little project. I have two domain model (Post, Source): public class Post { public Post() { Sources = new HashSet<Source>(); } public int Id { get; set; } public string Title...

Using EF6 code-first, reference same property name

How to reference both ShippingAddressId and BillingAddressId properties in Customer class to Address class which has a diffrent key named AddressId? Running update-database -verbose causes error: Unable to determine the principal end of an association between the types 'Project1.Customer' and 'Project1.Address'. The principal end of this association must be explicitly...

How to make a dictionary of arrays?

I can't seem to figure out how containers.Map works. It's doing okay with characters and numbers, but flips out when I try to feed it arrays. How do I make something like this? function test global a a = containers.Map(); a(pi) = 3:14; a(5) = 4:2:10; end ...

Convert grayscale to color gradient in Java?

Is there any general algorithm or a provided class for mapping a grayscale value (0-255) to a value in a colour gradient? I am thinking of something of the sorts: public Color mapGrayscaleValue (byte value, Color[] gradientColors); I am wanting this to provide clearer highlights in what would otherwise be...

vim comment/uncomment with one mapping [duplicate]

This question already has an answer here: What's a quick way to comment/uncomment lines in Vim? 32 answers I'm new(bie) in vim. I've got the following mapping to comment my python code : nmap cc 0i#<ESC> I would like to have the same mapping to uncomment a line. I...

HIbernate mapping on the wrong froreign key

I have 2 classes Device and Position that have a relation one-to-many/many-to-one (One device has several positions, a position is associated to one and only one device). I have clearly specified in the hibernate mapping file that I want my table to join on device.DeviceID = position.FK_DeviceID, yet when i...

Texture mapping consuming physical memory

there's a problem with my texture mapping, when I execute the code, it run smoothly for 5-8 sec, then the framerate drop drastically, when I monitor the task manager, it seem the program consuming almost 95% of my physical memory, anybody know how to solve this problem?? I'm using visual...

Azure Table Storage - TableEntity map column with a different name

I am using Azure Table Storage as my data sink for my Semantic Logging Application Block. When I call a log to be written by my custom EventSource, I get columns similar to the ff.: EventId Payload_username Opcode I can obtain these columns by creating a TableEntity class that matches...

Many to One Relation in Symfony 2

I have a problem related to Doctrine2: 1- I have two tables joining on a many-to-one relation: Table 1 - Activity The Schema: Backend\adminBundle\Entity\Activity: type: entity table: activity indexes: result_id: columns: - result_id id: id: type: integer nullable: false unsigned: false comment: '' id: true generator: strategy: IDENTITY fields: .........

Mapping values of a matrix?

So I have a large matrix(4091252x2) that looks something like this: 439105 1053224 439105 1696241 439105 580064 439105 1464748 1836139 1593258 1464748 439105 1464748 1053224 1464748 1696241 1464748 580064 580064 439105 Basically, the matrix represents calls made from one person to another, represented by a personID (439105 calls 1053224). What...

Retrieve indexes of min and max values in np.ndarray

i am working on some tif files and i have to plot dependecies between temperature and vegatation index based on .tif file. It was just FYI. Now my programming problem. I'm using python 2.7 (x64). I have big ndarray form NumPy lib, contains values of temerature and second (same size)...

How to insert key and value to map that is inside another map in cpp?

I have this map : std::map<std::string, std::map<std::string, std::string> > objects; As far as I know, when I write objects[key] it will replace the value of the key already exists, but here I want it to add to the second map if the pair doesn't exist. Example: Current MAP :("key1",map(<"key_a","value_a">,<"key_c","value_d">)) input:...

Symfony2 / Doctrine2 : how to access an entity annotation mapping?

In my Symfony2/doctrine2 application, I have two entities, Media and Recipe. They can be linked by a oneToMany or a ManyToMany association. In the case of a oneToMany relationship, I am using the following code to retrieve the Recipe linked to an instance of Media : $accessor = PropertyAccess::createPropertyAccessor(); $reflect...

Mapping int to int (in Java)

In Java. How can I map a set of numbers(integers for example) to another set of numbers? All the numbers are positive and all the numbers are unique in their own set. The first set of numbers can have any value, the second set of numbers represent indexes of an...

org.hibernate.MappingException: Unknown entity: from xxx

I was trying to resolve issue which I posted here But, now I'm getting another issue. :( org.hibernate.MappingException: Unknown entity: from EmpTest at org.hibernate.internal.SessionFactoryImpl.getEntityPersister( at org.hibernate.internal.SessionImpl.getOuterJoinLoadable( at org.hibernate.internal.SessionImpl.list( at org.hibernate.internal.CriteriaImpl.list( at com.model.EmpModelImp.getAll( at...

Spring RequestBody Mapping maps all attributes to null values

i have the following RESTfull method : @RequestMapping(value = "/budgetLines", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public void create(@RequestBody BudgetLine budgetLine) { System.out.println("Before Persisting in the repository " + budgetLine);; } I'am consuming this method inside a web application, i checked using the network analysis tool (in the...

Error while loading raster data in netlogo

I am unable to load raster image into netlogo. Following is the code i have used: extensions [ gis ] globals [ raster-dataset ] to setup set raster-dataset gis:load-dataset "D:/SUKHJIT PROJECT/1979sup2.asc" end The error message displayed: Extension exception: only GEOGCS and PROJCS are supported error while observer running GIS:LOAD-DATASET called...

Leaflet slider group by year

I'm using leaflet slider - - but I can't get the desired result, even if from the plugin description it seems it can do. I have a collection of features, geometry type is polygon, where I've inserted a property "time" as requested by the plugin. I've tried bot with...

What is wrong with this ST_CONTAINS statement PostGIS - Find point in polygon

I'm trying the following: Event.where('ST_Contains(?,ST_SetSRID(location, 4326)::geography)', search_polygon::geography) add getting the error *** NoMethodError Exception: undefined method `geography' for but without that (::geography) I get a message telling me to cast, what do I do? HINT: No function matches the given name and argument types. You might need to add explicit...

Control pan and zoom animation duration in mapbox.js

I'm making an animated map showing a series of points using Mapbox.js. Ideally, I want to smoothly switch focus between points by combining zoom and pan like this example created in d3.js. I wonder if there is anyway to control the pan & zoom animation speed (mainly to slow it...

Area measurement not showing correct measurements

I am trying to get the area of polygons drawn. But the area's I am getting is roughly 50% larger than they should be. draw.on('drawend', funciton(e){ var geom = e.feature.getGeometry(); if(drawType === 'Polygon'){ var rawArea = geom.getArea(); var cleanArea = rawArea / 10000; // Convert to hectares } }); Some...

OpenLayers - Get Geometry Projection

How can I get projection of a point or geometry in openlayers (2.12)? for example: x = 30.453789 , y = 35.637485 ==> EPSG:4326 and x = 3667550.3453 , y = 2205578.3453 ==> EPSG:900913 appreciate any help...

Change lowercase and uppercase of characters in java

If I want to create a dictionary where the user can create a custom alphabet (that still uses unicode) Is there a way to change lowercase and uppercase mapping of the characters? Let's say I want the lowercase of 'I' to be 'ı' instead of 'i' or upperCase of 'b'...

Error: isTRUE(gpclibPermitStatus()) is not TRUE

This question may be a duplicate of an earlier unanswered one. I still have the problem. I am trying to use a zipcode shapefile and coming up with the following error: tract <- readOGR(dsn = ".", layer = "cb_2013_us_zcta510_500k") tract<-fortify(tract, region="GEOID10") Error: isTRUE(gpclibPermitStatus()) is not TRUE I have tried installing...

Separate forward and backward relation in overpass-api

I need to get from overpass-api all the data about one, specific public transport line. Let's say it has a number 148 in my city. I use something like this example below but this gives me combined ways of forward and backward routes. How can I get them separately? <osm-script...

R Creating a Character Column from a Numeric Column w/o using For Loop

I am trying to create a column of characters based on an existing column of numbers, preferably without using a for loop. I have come up with a variety of ways to do this, but I keep feeling like I'm making this far more complicated than it needs to be....

Is there a way to make a Point feature show as text?

In Leaflet there is an option for icons to be div's instead of images. Which meant you could make a marker which is just text, essentially a label which could be moved by the user. Which is what I am trying to reproduce using OL3 with no success. Is there...

Openlayers 3.5 and GeoJSON

I'm having a problem with OpenLayers 3.5. I'm trying to use the one-off loading strategy to grab features from a GeoJSON file. I'm adding a new layer to an already instantiated map. My code looks like this: var vectorSource = new ol.source.Vector({ url: layerInfo.url, format: new ol.format.GeoJSON() }); var pointsLayer...

how to get coordinates from SpatialPolygon

i'm getting a polygon from the drawpoly using: x<- ogrListLayers(file_map) shape=readOGR(file_map, layer=x) #will load the shapefile to your dataset. plot(shape) polygon<- drawPoly() but, I'm trying to get the coordinates from polygon, but i can't: [email protected] [[1]] An object of class "Polygons" Slot "Polygons": [[1]] An object of class "Polygon" Slot...

Add brands through company, it's possible? How?

I have this two tables (see pics below) mapped as follow: class Brand { ... /** * @var Company * * @ORM\ManyToOne(targetEntity="Company") * @ORM\JoinColumn(name="companies_id", referencedColumnName="id") */ protected $company; } class Company { ... } I need to add support for add a new Brand from Company but I have not...

Is there a way to configure Elasticsearch so that it will prevent creating new type in specific index?

For example: I have index people and document type person-info. I explicitly defined its mapping by: curl -XPUT 'http://localhost:9200/people/_mapping/person-info' -d ' { "person-info" : { "properties" : { // some mapping } } } Once I inserted some documents to person_info instead of person-info by mistake. So Elasticsearch automatically created...

JavaScript objects: 'addEventListener is not a function'

I create an array of JavaScript objects called elements and loop through it in order to draw every one on a canvas as well as hooking up a few event handlers to it. However, I get an error stating that 'Uncaught TypeError: elements[i].addEventListener is not a function' Here is the...

Serve private mapping from S3 tiles by proxying data or signing urls through heroku?

I want to store mapping tiles in a private S3 bucket. Each tile has its own URL and each set of tiles could potentially have GBs of tiles. I then want to visualise these tiles through a front end mapping client (e.g leaflet). This client pulls tiles as it needs...

Copy web-builder created website to new hosting

I have a website created in a web-building online app (link to the app: The app doesn't allow me to actually view the folder structure of my web, it's something more like creating a blog using blogspot by google or similar web apps. The problem is that I want...

In leaflet/mapbox, why can't I set the duration of `map.fitBounds`?

I tried this: map.fitBounds(L.polyline([L.latLng(40,9), L.latLng(1,2)]).getBounds(), { padding: [50, 50], maxZoom: 17, animate: true, duration: 10 }); I expect the animation to take 10 seconds to complete, but it completes very fast.. Does anyone have ideas about how to make the duration longer for fitBounds?...

Creating analyzed and not_analyzed index on all fields in Elasticsearch

Im pretty new to Elasticsearch. I have a requirement of creating ALL string fields with an "analyzed" and "not_analyzed" index. I have been able to do it for 1 or 2 fields, but how can I do this if I have 50 fields in my document? I have used the...

Marker or overlay moving animation moving smoothly in openlayers 3

I created a plunkr which has a moving marker like a car. var olview = new ol.View({ center: [-5484111.13, -1884437.22], zoom: 18, minZoom: 2, maxZoom: 20 }); var osm = new ol.source.OSM(); var lineString = new ol.geom.LineString([]); var map = new ol.Map({ target: 'map', view: olview, renderer: 'canvas', layers: [...

Writing lat/long geometries to a feature class field

I have a point feature class with over 80 million features that need to have fields added to include both the lat/long coordinates in two different fields. While it is easy to calculate this in ArcMap, I need to write a script that will write both to the table then...

Calculate latitude/longitude between two other coordinates certain meters away

I am working on a Javascript function for calculating a coordinate with latitude and longitude on a "line" between two other coordinates. This coordinate that i need to calculate for example is 300 meters away from the first coordinate while the distance between the two coordinates is 1600 meters. What...

Selenium Web Driver : How to map html elements to Java Object.

As part of Selenium Web-driver learning I came across a scenario. Please let me know the professional approach to proceed. I am testing a eCommerce application where while I click on Mobile link all mobile phones are getting displayed.I want to check whether they are sorted based on name and...

Mapping from One Sheet to Another Fill Unfilled chracter

So I have one excel document that has partially filled character array ("|" shows excel column line): Current Result ("_" is a space): 1111GGH80100022190 1112QQH80100023201 1113GGH80100045201 1114AAH80100025190 So my current code outputs this above result. The problem is that characters 1-5 and 21-24 get skipped over. In general if there...

can't force GROK parser to enforce integer/float types on haproxy logs

Doesn't matter if integer/long or float, fields like time_duration (all time_* really ) map as strings in kibana logstash index. I tried using mutate ( did not work either. How can i correctly enforce numeric type instead of strings on these fields? My /etc/logstash/conf.d/haproxy.conf: input { syslog { type =>...

Leaflet package in R not plotting all coordinates

I'm trying to plot using leaflet with a somewhat sizable set of coordinates (~34K latitude/longitude pairs) however, using the code below it seems that leaflet is only plotting a small portion of these: data <- read.csv("Food_inspections.csv", header = TRUE) names(data) <- tolower(names(data)) data1 <- filter(data, risk == c("Risk 1 (High)","Risk...

PowerShell map persistent sharepoint path

I'm trying to map the path to a SharePoint document library in a persistent way. It's strange that this works fine: $Sharepoint = '\\\stuff\Documents\Folders - Permission matrix' New-PSDrive -Name P -Root $Sharepoint -PSProvider FileSystem -Credential $Credentials But this doesn't work: New-PSDrive -Persist -Name P -Root $Sharepoint -PSProvider FileSystem -Credential $Credentials...